Screen image coding method, decoding method, system, equipment and medium
By collecting multiple frames of images and determining macroblocks in the screen image coding and decoding, the target code stream is generated, which solves the problem of difficulty in balancing fluency and clarity in low-bandwidth environments in the existing technology, and achieves the reduction of code stream and picture quality. Quality improvement.
Patent Information
- Application Number
- CN202310225791.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-09
- Publication Date
- 2024-09-10
AI Technical Summary
In an environment with low bandwidth or poor network quality, it is difficult for the existing technology to balance fluency and clarity in screen image encoding and decoding. It is usually necessary to sacrifice fluency to ensure clarity or sacrifice clarity to ensure fluency.
By collecting multiple frames of images, the initial macroblocks, reference macroblocks and target macroblocks are determined, and coding is performed based on these macroblocks to generate the target code stream, and decoding is performed at the decoding end to achieve motion vector filling between frames and reduce code stream, while reducing the code stream without affecting the user experience to achieve a balance between fluency and clarity.
It effectively reduces the code flow, improves the smoothness of the picture, and at the same time reduces the loss of image clarity in the quantization process, achieving a balance between smoothness and clarity, and is suitable for environments with limited bandwidth.
Smart Images

Figure CN118632004A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image coding and decoding technology, and in particular to a screen image coding method, decoding method, system, device and medium. Background Art
[0002] With the rapid development of electronic technology, more and more office methods are becoming intelligent. Therefore, the encoding and decoding method of screen images has become a problem that needs to be solved. Among them, the main feature of screen images is that there are large areas with exactly the same pixels in adjacent frames.
[0003] In the prior art, in an environment with low bandwidth or poor network quality, the image smoothness is ensured by adjusting the quantization parameters and reducing the image quality, or the frame dropping method is adopted, that is, the smoothness is sacrificed to ensure the image clarity as much as possible. However, the balance between smoothness and clarity is relatively lacking.
[0004] With respect to screen image encoding methods, ensuring image clarity that meets the requirements of office workers while ensuring smoothness is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention
[0005] The purpose of the present invention is to overcome the deficiencies of the prior art and to provide a screen image encoding method, decoding method, system, device and medium so as to achieve a balance between the clarity and smoothness of the image.
[0006] In a first aspect, an embodiment of the present disclosure provides a screen image encoding method, comprising:
[0007] Sequentially capturing a first frame image and a second frame image, and determining a first initial macroblock, a first reference macroblock, and a first target macroblock based on the first frame image and the second frame image, wherein the first reference macroblock and the first target macroblock are determined by comparing the second frame image with a changed macroblock in the first frame image, and the first target macroblock has the same code stream as the first initial macroblock;
[0008] When a target triggering action is detected, the second frame of image is cached and a third frame of image is captured;
[0009] Acquire the third frame image, and determine a second target macroblock based on the first frame image and the third frame image, wherein the second target macroblock is determined by a macroblock that changes between the third frame image and the first frame image;
[0010] The third frame image is encoded based on the first initial macroblock, the first reference macroblock, the first target macroblock and the second target macroblock to obtain a target code stream, and the target code stream is sent to a decoding device.
[0011] As an implementable embodiment, optionally, encoding the third frame image based on the first initial macroblock, the first reference macroblock, the first target macroblock, and the second target macroblock to obtain a target bitstream includes:
[0012] Encoding the second target macroblock based on the first initial macroblock to obtain a first code stream, wherein the first code stream includes a first motion vector, and the first motion vector is a motion vector from the first initial macroblock to the second target macroblock;
[0013] Encoding the first target macroblock and the first reference macroblock based on the first initial macroblock to obtain a second code stream, wherein the second code stream includes a second motion vector, and the second motion vector is a motion vector from the first initial macroblock to the first target macroblock;
[0014] The first code stream and the second code stream are merged to obtain a target code stream.
[0015] As an implementable method, optionally, encoding the first target macroblock and the first reference macroblock based on the first initial macroblock to obtain a second bitstream includes:
[0016] Based on the position information of the first initial macroblock in the first frame image, obtaining first encoding information of the first reference macroblock from the third frame image;
[0017] Based on the position information of the first initial macroblock in the first frame image, obtaining second encoding information of the first target macroblock in the first frame image;
[0018] A second code stream is determined according to the first coding information and the second coding information.
[0019] In a second aspect, an embodiment of the present disclosure provides a screen image decoding method, comprising:
[0020] Receive the target code stream sent by the encoding device;
[0021] Decoding the target code stream to obtain a first motion vector, a second motion vector, a first target macroblock, and a second target macroblock;
[0022] The first target macroblock and the second target macroblock are filled into a reconstructed frame space based on the first motion vector and the second motion vector.
[0023] As an implementable embodiment, optionally, filling the first target macroblock and the second target macroblock into the reconstructed frame space based on the first motion vector and the second motion vector includes:
[0024] Loop decoding to obtain a first target macroblock and a second target macroblock;
[0025] Based on the first motion vector, filling the first target macroblock obtained by decoding into a first reconstructed frame space to obtain a first image;
[0026] Based on the second motion vector, filling the second target macroblock obtained by decoding into a second reconstructed frame space to obtain a second image;
[0027] The second image is cached and the first image is displayed.
[0028] In a third aspect, an embodiment of the present disclosure provides a screen image coding system, including: an image acquisition module, a frame buffer module, an inter-frame coding module, a scene determination module, an intra-frame coding module and a code stream fusion module;
[0029] The image acquisition module is configured to acquire image information;
[0030] The inter-frame buffer module is configured to buffer a target image frame upon detecting a target trigger action, wherein the number of frames corresponding to the target image frame is greater than or equal to 2;
[0031] The inter-frame coding module is configured to perform inter-frame motion search on the image information to determine a full-frame motion vector;
[0032] The scene determination module is configured to determine whether the image information includes a composite frame scene;
[0033] The intra-frame encoding module is configured to perform intra-frame encoding on a target macroblock included in the image information, wherein the target macroblock is determined by a macroblock that changes between the second frame image and the first frame image and / or by a macroblock that changes between the third frame image and the second frame image;
[0034] The code stream fusion module is configured to fuse the code streams corresponding to the macroblocks to obtain a target code stream and send the target code stream to a decoding system.
[0035] In a fourth aspect, an embodiment of the present disclosure provides a screen image decoding system, including: a code stream parsing module, an inter-frame decoding module, an intra-frame decoding module, a reconstructed frame generation module and a cache module;
[0036] The bitstream parsing module is configured to receive a target bitstream sent by the encoding system, and parse the target bitstream to obtain a bitstream corresponding to each macroblock;
[0037] an inter-frame decoding module configured to parse the composite frame;
[0038] An intra-frame decoding module, configured to perform intra-frame decoding on the macroblock;
[0039] A reconstructed frame generation module is configured to fill the decoded macroblocks into the reconstructed frame space;
[0040] The cache module is configured to cache the last frame image included in the parsed composite frame.
[0041] In a fifth aspect, an embodiment of the present disclosure provides a computer device, including:
[0042] one or more processors;
[0043] a storage device for storing one or more programs,
[0044] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of the first aspect or the second aspect.
[0045] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of the first aspect or the second aspect.
[0046] The screen image encoding and decoding method and encoding and decoding system provided by the embodiments of the present disclosure sequentially capture a first frame image and a second frame image, and determine a first initial macroblock, a first reference macroblock and a first target macroblock based on the first frame image and the second frame image, wherein the first reference macroblock and the first target macroblock are determined by macroblocks that are changed in the second frame image compared with the first frame image, and the first target macroblock has the same code stream as the first initial macroblock; upon detecting a target trigger action, cache the second frame image and capture the third frame image; obtain the third frame image, and determine a second target macroblock based on the first frame image and the third frame image, wherein the second target macroblock is determined by macroblocks that are changed in the third frame image compared with the first frame image; encode the third frame image based on the first initial macroblock, the first reference macroblock, the first target macroblock and the second target macroblock to obtain a target code stream, and send the target code stream to a decoding device. By encoding two frames of images into one and sacrificing one frame of image, a considerable proportion of the bit rate can be reduced (the bit rate can be reduced by half in the best case) without affecting the user experience, making the picture smoother. Moreover, because the bit rate is reduced, light quantization can also be performed in the quantization link, with less loss of image clarity, thus achieving a balance between clarity and smoothness. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] 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.
[0048] Figure 1 It is a flowchart of a screen image encoding method provided by an embodiment of the present disclosure;
[0049] Figure 2A-2C is a schematic diagram of a screen image provided by an embodiment of the present disclosure;
[0050] Figure 3 is a structural schematic diagram of a screen image encoding system provided by an embodiment of the present disclosure;
[0051] Figure 4 It is a flowchart of a screen image decoding method provided by an embodiment of the present disclosure;
[0052] Figure 5 is a structural schematic diagram of a screen image decoding system provided by an embodiment of the present disclosure;
[0053] Figure 6 It is a structural diagram of a computer device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0054] 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.
[0055] The present disclosure provides a method for encoding a screen image. Figure 1 As shown, the screen image encoding method includes the following steps:
[0056] S110 , sequentially collecting a first frame image and a second frame image, and determining a first initial macroblock, a first reference macroblock, and a first target macroblock based on the first frame image and the second frame image.
[0057] The first reference macroblock and the first target macroblock are determined by comparing the changed macroblocks in the second frame image with the first frame image, and the first target macroblock has the same code stream as the first initial macroblock.
[0058] The screen image encoding method provided by the embodiment of the present disclosure is mainly for encoding screen images, wherein screen images are different from natural images in that they are computer-synthesized. In common office scenes, there will be large areas with completely identical pixels in adjacent frames of the screen image, which is rare in natural images. In natural images, even if the picture looks still, it is rare for large areas in two frames to be completely identical. Based on the characteristic that there are large areas with completely identical pixels in adjacent frames of the screen image, the embodiment of the present disclosure provides a screen image encoding method, firstly capturing a first frame image and a second frame image, through the first frame image and the second frame image, it can be determined whether the currently acquired image is a screen image, and after capturing the first frame image and the second frame image, a first initial macroblock, a first reference macroblock, and a first target macroblock are determined based on the first frame image and the second frame image.
[0059] For details, see Figure 2A-2C , Figure 2A is the first frame image, Figure 2B is the second frame image, Figure 2C is the third frame image, Figure 2A-2C In the figure, the first initial macroblock is area A, the first reference macroblock is area B, and the first target macroblock is area C. The first reference macroblock B and the first target macroblock C are determined by the macroblocks that have changed in the second frame image compared with the first frame image, that is, the first target macroblock C is generated by the motion of the first initial macroblock in area A of the first frame image. In the second frame image, the pixels of areas B and C have changed compared with those of the first frame image.
[0060] Figure 2A-2C This is an example of a screen image of a typical office scene of dragging a window. In the first frame of the image, the text editor is in the upper left corner, in the second frame of the image it is dragged to the middle position, and in the third frame of the image it is dragged to the lower right corner. The main problem solved by the embodiment of the present disclosure is to reduce the bit rate and ensure clarity in this scenario of dragging windows. This scenario is extremely common in actual remote desktop applications. In an environment with good network quality such as a local area network, the bit rate size is not sensitive, and the bit rate can be allowed to be larger while ensuring the image quality. However, in a wide area network with lower bandwidth, there are restrictions on bandwidth, and the bit rate cannot be too large, otherwise it will be stuck. In order to ensure smoothness, the image quality can only be reduced. The image quality is blurry during the movement. Figure 2A-2C The example below shows three frames. In fact, a large number of frames will be generated during the dragging process. For example, 30 frames are generated per second at a frame rate of 30fps. The intermediate frames can be used to Figure 2A-2C The second and third frames in the figure are used to represent the situation.
[0061] S120: When a target triggering action is detected, cache the second frame image and capture the third frame image.
[0062] The target trigger action exemplarily includes a mouse action, such as selecting and moving the mouse. When the target trigger action is detected, it can be determined that the user is dragging a desktop element such as a form, that is, the image is a screen image.
[0063] After the target triggering action is detected, the second frame image is cached at this time, and when the third frame image arrives, the third frame image is first compiled.
[0064] S130 , acquiring a third frame image, and determining a second target macroblock based on the first frame image and the third frame image.
[0065] The second target macroblock is determined by a macroblock that changes between the third frame image and the first frame image.
[0066] Specific, combined Figure 2C , the second target macroblock is area D.
[0067] Specifically, the specific process of obtaining the third frame image and determining the second target macroblock based on the first frame image and the third frame image is as follows: Figure 2A and Figure 2C Compared with the first frame image, the third frame image has part of area E that appeared in the first frame image. Therefore, the macroblocks in area E can be directly marked as "unchanged" macroblocks without using JPEG encoding. Each macroblock only needs one type marking information, which saves the bitstream of area E.
[0068] The area D is the area moved from the area A to the area D in the first frame image, so the code stream of the area D is the same as the code stream of the area A.
[0069] S140, encoding the third frame image based on the first initial macroblock, the first reference macroblock, the first target macroblock and the second target macroblock to obtain a target code stream, and sending the target code stream to a decoding device.
[0070] As a specific implementation manner, encoding the third frame image based on the first initial macroblock, the first reference macroblock, the first target macroblock, and the second target macroblock to obtain a target code stream, and sending the target code stream to a decoding device, including:
[0071] The second target macroblock is encoded based on the first initial macroblock to obtain a first code stream, the first code stream includes a first motion vector, and the first motion vector is a motion vector from the first initial macroblock to the second target macroblock; based on the first initial macroblock, the first target macroblock and the first reference macroblock are encoded to obtain a second code stream, the second code stream includes a second motion vector, and the second motion vector is a motion vector from the first initial macroblock to the first target macroblock; the first code stream and the second code stream are merged to obtain a target code stream.
[0072] In a specific implementation, encoding the first target macroblock and the first reference macroblock based on the first initial macroblock to obtain a second bitstream includes:
[0073] Based on the position information of the first initial macroblock in the first frame image, the first coding information of the first reference macroblock is obtained from the third frame image; based on the position information of the first initial macroblock in the first frame image, the second coding information of the first target macroblock is obtained from the first frame image; and the second code stream is determined according to the first coding information and the second coding information.
[0074] First, it is analyzed that the scene is a scene of image element dragging. Then, the second frame image is cached. When the third frame image arrives, the third frame image is first compiled. The reference frame is the first frame image. Since the area E part has appeared in the first frame image, the macroblocks of this part can be directly marked as "unchanged" macroblocks, without using JPEG for encoding. Each macroblock only needs one type mark information, which saves the code stream of area E. The area D part is the same as the code stream of area A in the first frame image. Therefore, based on the first initial macroblock, the second target macroblock can be directly encoded to obtain the first code stream, that is, the code stream corresponding to the macroblock that has changed in the third frame image. At this time, the first code stream includes the first motion vector of the first initial macroblock moving to the second target macroblock. Due to the dragging of the form, the macroblocks of area A in the first frame image are all displaced. By obtaining the position of the macroblocks in area A in the first frame image and the position in the third frame image, the common displacement corresponding to the macroblocks in area A is determined, and the first motion vector is determined.
[0075] After the third frame is edited, it does not end, but immediately starts to edit the content of the second frame. It can refer to the first and third frames at the same time. Its encoding method is as follows: the content of area B is exactly the same as the part at the same position in the third frame, so the content of area B can also be marked as an "unchanged" macroblock. In addition, it is necessary to record the reference frame as the third frame; when encoding the content of area B of the second frame, a frame of content is not generated separately, but each macroblock information in area B of the third composite frame is filled in area B of the second frame, that is, the type is "unchanged" macroblock, and the reference frame number is the third frame; the part of area C can refer to the first frame. Due to the dragging of the window, the macroblocks therein are displaced. The common displacement of these macroblocks is counted, which is called the global motion vector. Therefore, the macroblocks inside area C will also add information to the code stream of the composite frame, that is, the type is MV offset type macroblock, the reference frame is the first frame, and the global motion vector is not reflected in each macroblock, but is placed in the frame header of the composite frame. The frame header of the composite frame will have two global motion vector fields, one is the third frame image relative to the reference frame, which is the first frame image, and the other is the second frame image relative to the first frame image. The parts outside area B and area C, in this example, have not changed relative to the first frame image, and can all be marked as "unchanged" macroblocks, that is, this macroblock type information can be attached to each macroblock of the composite frame.
[0076] After the above encoding process, this composite frame actually contains all the information of the second and third frames. In fact, the second frame has almost no JPEG intra-frame coding for macroblocks, and all is generated by prediction. When decoding, if the first and third frames are decoded, the information of the second frame can be directly reconstructed by pixel copying, so the code stream of the second frame can be almost ignored. At the same time, since the original data of the second and third frames are encoded into the same code stream packet, it is avoided that the second frame adds additional redundant data such as frame header information and the position number of each macroblock. The third frame can be directly reused, which further reduces the code stream. At the same time, it can be guaranteed that as long as the code stream of the third frame is received during transmission, the code stream of the second frame must also be received by the user, ensuring reliability. It is precisely because the code stream of the second frame is very small that this aggregation to obtain a composite frame is possible. Otherwise, according to the size of the conventional unidirectional prediction, the data packet of the two frames aggregated is too large, which may also bring pressure to the transmission. Since the solution fixedly encodes two adjacent frames into a composite frame, there is no need for frame type analysis and no continuous multi-frame caching. Therefore, the negative effect of delay is very small and it can be applied to real-time office applications where the frame rate requirements are not very high.
[0077] In the above embodiment, when the second target macroblock is encoded based on the first initial macroblock to obtain the first bitstream, the method further includes:
[0078] The third frame image is marked as a composite frame image.
[0079] After the third frame image is captured, the third frame image is marked as a composite frame image, so that the editing of the second frame image begins immediately instead of ending after the third frame image is edited. The first frame image and the third frame image are referenced when editing the second frame image.
[0080] A screen image encoding method provided by an embodiment of the present disclosure sequentially captures a first frame image and a second frame image, and determines a first initial macroblock, a first reference macroblock and a first target macroblock based on the first frame image and the second frame image, wherein the first reference macroblock and the first target macroblock are determined by macroblocks that are changed in the second frame image compared with the first frame image, and the first target macroblock has the same code stream as the first initial macroblock; upon detecting a target trigger action, caches the second frame image and captures a third frame image; obtains the third frame image, and determines a second target macroblock based on the first frame image and the third frame image, wherein the second target macroblock is determined by macroblocks that are changed in the third frame image compared with the first frame image; encodes the third frame image based on the first initial macroblock, the first reference macroblock, the first target macroblock and the second target macroblock to obtain a target code stream, and sends the target code stream to a decoding device. By encoding two frames of images into one and sacrificing one frame of image, a considerable proportion of the bit rate can be reduced (the bit rate can be reduced by half in the best case) without affecting the user experience, making the picture smoother. Moreover, because the bit rate is reduced, light quantization can also be performed in the quantization link, with less loss of image clarity, thus achieving a balance between clarity and smoothness.
[0081] Based on the above embodiments, the present disclosure provides a screen image encoding system, such as Figure 3 As shown, the screen image coding system includes: an image acquisition module 210, a frame buffer module 220, an inter-frame coding module 230, a scene determination module 240, an intra-frame coding module 250 and a code stream fusion module 260; the image acquisition module is configured to acquire image information; the inter-frame buffer module is configured to cache the target image frame when a target trigger action is detected, wherein the number of frames corresponding to the target image frame is greater than or equal to 2; the inter-frame coding module is configured to perform inter-frame motion search on the image information to determine the full-frame motion vector; the scene determination module is configured to determine whether the image information includes a composite frame scene; the intra-frame coding module is configured to perform intra-frame coding on the target macroblock contained in the image information, wherein the target macroblock is determined by the macroblock changed in the second frame image compared with the first frame image and / or by the macroblock changed in the third frame image compared with the second frame image; the code stream fusion module is configured to fuse the code streams corresponding to each macroblock to obtain the target code stream and send it to the decoding system.
[0082] The image acquisition module, specifically, the image acquisition module acquires images from a source end, exemplarily, remotely acquires images from a desktop of a server computer, and the image acquisition module outputs original image frames in a YUV444 space.
[0083] The inter-frame cache module caches one frame to be encoded. Since the scenario is remote office and has real-time characteristics, it is limited to caching only one frame to be encoded.
[0084] The main task of the inter-frame coding module is to perform motion search between frames to determine the full-frame motion vector. The full-frame motion vector is a motion vector with screen coding characteristics. Unlike natural image coding, the screen content is often a large area of color blocks moving in the same direction. In other words, if many macroblocks in the frame have inter-frame motion vector matching characteristics, if the motion vectors of not every macroblock are the same, there must be a motion vector that is used by the largest number of macroblocks at the same time. Specifically for the scene in Figure 2, this full-frame motion vector is actually the position where the text window moves to the right and downward. Each frame only encodes one motion vector, which is the full-frame motion vector; after finding the motion vector, the inter-frame coding module will also analyze each macroblock of the full frame to determine which macroblocks are of the motion vector matching type, that is, using the motion vector, offsetting in the reference frame can obtain the original data of the macroblocks of the current frame to be encoded; Figure 2B In the example, all macroblocks in region C are motion vector matching type macroblocks.
[0085] Scene determination module, in the embodiment of the present disclosure, although the one-frame delay caused by the introduction of one cache frame is not easily perceived by the user, it is still necessary to ensure zero delay as much as possible, that is, one frame is edited by one frame. Since the present solution solves the situation of dragging the image area, there is no need to perform frame caching and there is no need to have a one-frame delay in other situations except this situation, so a scene determination module is needed to determine and detect the scene, and the specific determination steps are: Step 1: Detect the mouse action fed back from the decoding end, if it is found that the mouse is pressed and the displacement is superimposed at the same time, it is determined to enter the composite frame mode and skip the second step detection; if the mouse action is detected and the composite frame mode is currently in the composite frame mode, it is determined to exit the composite frame mode; Step 2: Perform full-frame image detection, set a minimum area threshold such as W_min*H_min, if it is found that the area with a width and height of W*H (the area needs to have a width and height greater than the set area threshold) appears: the macroblocks in the area are all motion vector matching macroblocks, then it is determined to enter the composite frame mode; otherwise, if it is currently in the composite frame mode, it is determined to exit the composite frame mode.
[0086] An intra-frame coding module, which performs intra-frame coding on a macroblock. In the embodiment of the present disclosure, JPEG is used to encode the intra-frame macroblock;
[0087] The code stream fusion module merges the code streams of all macroblocks to generate a full-frame code stream.
[0088] In the screen image coding system, the inter-frame buffer module and the scene determination module are both established for composite frame coding. The composite frame is established to reduce the bit rate during the dragging process. Figure 2A-2C The areas that need to be encoded in each frame in the three-frame scene are marked, that is, these areas are the newly rendered content compared with the previous frame, which is the reference frame. The second frame image marks area B. If the second frame image refers to the first frame, then the area B part has never appeared in the first frame image and is rendered in the second frame image; the third frame image marks area E, which is represented by dotted lines and shaded parts. It is a non-rectangular part. This part has never appeared in the second frame image relative to the second frame image and is newly rendered in the third frame image. Conventional real-time scene encoding only has forward reference, that is, the second frame image refers to the first frame image, and the third frame image refers to the second frame image. In this way, area B in the second frame image and area E in the third frame image must be encoded independently, which will produce a relatively large code stream. If bidirectional reference frames are added, which frames are determined to be bidirectional reference frames? This process requires caching multiple frames for analysis, and multiple frames need to be decoded and reordered at the decoding end, which will cause a large delay. In addition, if the unidirectional reference frame is erroneous or lost during transmission, the bidirectional reference frame that refers to it will also be erroneous and cannot be decoded. This is why real-time applications do not use bidirectional reference frames.
[0089] The process proposed in this scheme is as follows: first, the scene is analyzed to be a scene of image element dragging, and then the second frame image is cached. When the third frame image arrives, the third frame image is first compiled, and the reference frame is the first frame image. Since part of area E has appeared in the first frame image, the macroblocks of this part can be directly marked as "unchanged" macroblocks, without the need to use JPEG for encoding. Each macroblock only needs one type marking information, which saves the code stream of area E; and the third frame is recorded as a composite frame. The composite frame does not end after the content of the third frame image is compiled, but immediately starts to compile the content of the second frame image. It can refer to the second frame image and the third frame image at the same time. Its encoding method is as follows:
[0090] (1) The content of region B is exactly the same as the part at the same position of the third frame image, so the content of region B can also be marked as an "unchanged" macroblock. In addition, it is necessary to record that the reference frame is the third frame image. When encoding the content of region B of the second frame, a separate frame of content is not generated, but each macroblock information in region B of the third composite frame is filled in the information of the second frame image, that is, the type is an "unchanged" macroblock, and the reference frame number is the third frame.
[0091] (2) The part of area C can refer to the first frame image. As the window is dragged, the macroblocks therein are displaced. The inter-frame coding module will count the common displacement of these macroblocks, which is called the global motion vector. Therefore, the macroblocks inside area C will also add information to the code stream of the composite frame, that is, the type is MV offset type macroblock, and the reference frame is the first frame image. The global motion vector is not reflected in each macroblock, but is placed in the frame header of the composite frame. The frame header of the composite frame will have two global motion vector fields, one is the third frame image relative to the reference frame, that is, the first frame image, and the other is the second frame image relative to the first frame image.
[0092] (3) The portion outside area B and area C, in this example, has not changed relative to the first frame image and can all be marked as "unchanged" macroblocks, that is, this macroblock type information can be appended to each macroblock of the composite frame.
[0093] After the above encoding process, this composite frame actually contains all the information of the third frame and the second frame. In fact, the second frame has almost no JPEG intra-frame coding for macroblocks, and all is generated by prediction. When decoding, if the first and third frames are decoded, the information of the second frame can be directly reconstructed by pixel copying, so the code stream of the second frame can be almost ignored. At the same time, since the original data of the second and third frames are encoded into the same code stream packet, it is avoided that the second frame adds additional redundant data such as frame header information and the position number of each macroblock, and the third frame can be directly reused, which further reduces the code stream. At the same time, it can be guaranteed that as long as the code stream of the third frame arrives during transmission, the code stream of the second frame must also be received by the user, ensuring reliability. It is precisely because the code stream of the second frame is very small that this aggregation to obtain a composite frame becomes possible. Otherwise, according to the size of the conventional unidirectional prediction, the data packet of the two frames aggregated is too large, which may also bring pressure to the transmission. Since the solution fixedly encodes two adjacent frames into a composite frame, there is no need for frame type analysis and no continuous multi-frame caching. Therefore, the negative effect of delay is very small and it can be applied to real-time office applications where the frame rate requirements are not very high.
[0094] As a specific implementation, the present disclosure also provides a screen image decoding method, such as Figure 4 As shown, the image decoding method includes:
[0095] S310: Receive a target bitstream sent by an encoding device.
[0096] S320, decoding the target code stream to obtain a first motion vector, a second motion vector, a first target macroblock, and a second target macroblock.
[0097] S330 , filling the first target macroblock and the second target macroblock into the reconstructed frame space based on the first motion vector and the second motion vector.
[0098] In a specific implementation, the screen image decoding system receives a frame stream, which may be a normal frame or a composite frame. After receiving the target stream, the frame type is parsed to see if it is a composite frame. If not, conventional intra-frame decoding and inter-frame motion vector offset reconstruction, i.e., inter-frame decoding, are performed. After the full-frame macroblock is decoded, it is directly sent to the display module for display. If the frame stream is a composite frame type, two motion vectors, the first motion vector and the second motion vector, need to be decoded from the frame header, which are used in the forward reconstruction and bidirectional reconstruction of each macroblock, respectively. Correspondingly, two macroblocks will be decoded, corresponding to the two decoding frame spaces. The macroblocks of the full frame are decoded cyclically; for each macroblock position, two code streams need to be decoded, which are filled into two reconstructed frames after decoding, which are forward and bidirectional respectively; after the composite stream is decoded, two reconstructed frames are generated, one frame needs to be cached and one frame displayed, and the bidirectional reconstructed frame is displayed first, and then the unidirectional reconstructed frame is displayed.
[0099] This solution takes advantage of the redundancy between adjacent frames when dragging the window. If only one-way reference is used, the exposed part of the new frame will inevitably require intra-frame encoding to generate a larger bitrate. This solution introduces the type of composite frame. In the dragging scenario, the bitrate size is greatly reduced at the cost of only 1 frame delay, thereby improving the picture quality and smoothness.
[0100] Based on the above embodiments, the present disclosure also provides a screen image decoding system. Figure 5 As shown, the screen image decoding system includes: a code stream parsing module 410, an inter-frame decoding module 420, an intra-frame decoding module 430, a reconstructed frame generation module 440 and a cache module 450; the code stream parsing module 410 is configured to receive the target code stream sent by the encoding system, and parse the target code stream to obtain the code stream corresponding to each macroblock; the inter-frame decoding module is configured to parse the composite frame; the intra-frame decoding module is configured to perform intra-frame decoding on the macroblock; the reconstructed frame generation module is configured to fill the decoded macroblock into the reconstructed frame space; the cache module is configured to cache the last frame image included in the parsed composite frame.
[0101] At the decoding end, if a composite P frame type code stream is received, two global motion vectors will be decoded when decoding the frame header, and two copies of macroblock information will be decoded when decoding each macroblock. The main modules of the decoding end are:
[0102] The code stream parsing module will parse the frame header to analyze whether it is a normal frame or a composite frame, and parse the code stream of each macroblock, and hand it over to the specific decoding module to decode the macroblock;
[0103] An inter-frame decoding module, for a composite frame, parses two global motion vectors of a frame header, and applies the two global motion vectors to perform two decoding operations on each macroblock of the composite frame;
[0104] Intra-frame decoding module, performs JPEG decoding on macroblocks;
[0105] The reconstructed frame generation module fills the macroblocks decoded by the intra-frame decoding module and the inter-frame decoding module into the reconstructed frame space. If it is a composite frame type, two frames need to be filled, corresponding to Figure 2A-2C The third frame image and the second frame image in;
[0106] After the composite frame is decoded, the third frame image and the second frame image are generated simultaneously, and the cache module first caches the third frame image;
[0107] In the display management module, under normal circumstances, after the composite frame is solved, the bidirectional reference frame is displayed first, which corresponds to the second frame image in the previous example. After a fixed interval, the third frame image is displayed. This fixed interval time is calculated by 1000 / fps. FPS is the frame rate, and 1000 / fps is the average display interval per frame. At the same time, when displaying the second frame image, if it is found that the display time of the previous frame is later than the time it should be displayed, the third frame image should be displayed in advance. This adjustment work is also completed in the display module.
[0108] After entering the composite encoding mode, the encoder caches one frame every other frame and then compiles the two-frame code stream into one composite frame. However, at the decoder, two frames are generated each time decoding is performed, and one frame is cached and displayed. It should be noted that due to the introduction of composite frames, there will be a one-frame delay at the decoder during the composite frame scene. However, the delay of one frame is not sensitive to the human eye. This one-frame delay saves up to half of the code stream, which can be exchanged for smoothness and clarity, which is very worthwhile.
[0109] The present application also provides a computer device. Figure 6 , Figure 6 This is a basic structural block diagram of the computer device in this embodiment.
[0110] The computer device includes a memory 610 and a processor 620 that are connected to each other through a system bus. It should be noted that the figure only shows a computer device with components 610-620, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), digital signal processors (DSP), embedded devices, etc.
[0111] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.
[0112] The memory 610 includes at least one type of readable storage medium, and the readable storage medium includes a non-volatile memory or a volatile memory, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc., and the RAM may include a static RAM or a dynamic RAM. In some embodiments, the memory 610 may be an internal storage unit of a computer device, for example, a hard disk or a memory of the computer device. In other embodiments, the memory 610 may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, or a flash card (Flash Card) equipped on the computer device. Of course, the memory 610 may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 610 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the above method. In addition, the memory 610 may also be used to temporarily store various data that have been output or are to be output.
[0113] The processor 620 is generally used to perform the overall operation of the computer device. In this embodiment, the memory 610 is used to store program codes or instructions, the program code includes computer operation instructions, and the processor 620 is used to execute the program codes or instructions stored in the memory 610 or process data, such as running the program code of the above method.
[0114] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0115] Another embodiment of the present application also provides a computer-readable medium, which may be a computer-readable signal medium or a computer-readable medium. A processor in a computer reads a computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or a combination of steps in the above method; and generate a device for implementing the functional actions specified in each block or a combination of blocks in the block diagram.
[0116] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the above methods stored in the memory.
[0117] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.
[0118] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0119] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0120] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.
[0121] In the claims, any reference symbols placed between brackets shall not be construed as limiting the claims. The word "comprising" described in the present application does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented with the aid of hardware comprising several different elements and with the aid of a suitably programmed computer. In a unit claim that lists a number of devices, several units of these devices may be embodied by the same hardware item. The use of first, second, and third, etc. does not indicate any order, and these words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
[0122] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A screen image encoding method, characterized in that: include: Sequentially capturing a first frame image and a second frame image, and determining a first initial macroblock, a first reference macroblock, and a first target macroblock based on the first frame image and the second frame image, wherein the first reference macroblock and the first target macroblock are determined by comparing the second frame image with a changed macroblock in the first frame image, and the first target macroblock has the same code stream as the first initial macroblock; When a target triggering action is detected, the second frame of image is cached and a third frame of image is captured; Acquire the third frame image, and determine a second target macroblock based on the first frame image and the third frame image, wherein the second target macroblock is determined by a macroblock that changes between the third frame image and the first frame image; The third frame image is encoded based on the first initial macroblock, the first reference macroblock, the first target macroblock and the second target macroblock to obtain a target code stream, and the target code stream is sent to a decoding device.
2. The method according to claim 1, characterized in that The encoding process of the third frame image based on the first initial macroblock, the first reference macroblock, the first target macroblock and the second target macroblock to obtain a target code stream includes: Encoding the second target macroblock based on the first initial macroblock to obtain a first code stream, wherein the first code stream includes a first motion vector, and the first motion vector is a motion vector from the first initial macroblock to the second target macroblock; Encoding the first target macroblock and the first reference macroblock based on the first initial macroblock to obtain a second code stream, wherein the second code stream includes a second motion vector, and the second motion vector is a motion vector from the first initial macroblock to the first target macroblock; The first code stream and the second code stream are merged to obtain a target code stream.
3. The method according to claim 2, characterized in that The encoding of the first target macroblock and the first reference macroblock based on the first initial macroblock to obtain a second bitstream includes: Based on the position information of the first initial macroblock in the first frame image, obtaining first encoding information of the first reference macroblock from the third frame image; Based on the position information of the first initial macroblock in the first frame image, obtaining second encoding information of the first target macroblock in the first frame image; A second code stream is determined according to the first coding information and the second coding information.
4. The method according to claim 2, characterized in that: The step of encoding the second target macroblock based on the first initial macroblock to obtain the first bitstream further includes: The third frame image is marked as a composite frame image.
5. A screen image decoding method, characterized in that: include: Receive the target code stream sent by the encoding device; Decoding the target code stream to obtain a first motion vector, a second motion vector, a first target macroblock, and a second target macroblock; The first target macroblock and the second target macroblock are filled into a reconstructed frame space based on the first motion vector and the second motion vector.
6. The method according to claim 5, characterized in that The filling the first target macroblock and the second target macroblock into the reconstructed frame space based on the first motion vector and the second motion vector comprises: Loop decoding to obtain a first target macroblock and a second target macroblock; Based on the first motion vector, filling the first target macroblock obtained by decoding into a first reconstructed frame space to obtain a first image; Based on the second motion vector, filling the second target macroblock obtained by decoding into a second reconstructed frame space to obtain a second image; The second image is cached and the first image is displayed.
7. A screen image encoding system, characterized in that: include: Image acquisition module, frame buffer module, inter-frame coding module, scene determination module, intra-frame coding module and code stream fusion module; The image acquisition module is configured to acquire image information; The inter-frame buffer module is configured to buffer a target image frame upon detecting a target trigger action, wherein the number of frames corresponding to the target image frame is greater than or equal to 2; The inter-frame coding module is configured to perform inter-frame motion search on the image information to determine a full-frame motion vector; The scene determination module is configured to determine whether the image information includes a composite frame scene; The intra-frame encoding module is configured to perform intra-frame encoding on a target macroblock included in the image information, wherein the target macroblock is determined by a macroblock that changes between the second frame image and the first frame image and / or by a macroblock that changes between the third frame image and the second frame image; The code stream fusion module is configured to fuse the code streams corresponding to the macroblocks to obtain a target code stream and send the target code stream to a decoding system.
8. A screen image decoding system, characterized in that: include: Code stream parsing module, inter-frame decoding module, intra-frame decoding module, reconstructed frame generation module and cache module; The bitstream parsing module is configured to receive a target bitstream sent by the encoding system, and parse the target bitstream to obtain a bitstream corresponding to each macroblock; an inter-frame decoding module configured to parse the composite frame; An intra-frame decoding module, configured to perform intra-frame decoding on the macroblock; A reconstructed frame generation module is configured to fill the decoded macroblocks into the reconstructed frame space; The cache module is configured to cache the last frame image included in the parsed composite frame.
9. A computer device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4 or 5 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 or 5 to 6 is implemented.
