Image frame sequence compression method and device, electronic equipment and storage medium

By employing variable-length encoding and differential encoding algorithms for control bytes in embedded devices to compress image frame sequences, the problem of large storage space occupation is solved, and efficient image frame sequence compression is achieved.

CN121750876APending Publication Date: 2026-03-27HANGZHOU RONGLING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-13
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Image frame sequences in embedded devices suffer from problems such as large storage space consumption and low compression efficiency.

Method used

Image frame sequences are compressed using a variable-length encoding algorithm based on control bytes and a differential encoding algorithm. Efficient encoding is achieved by identifying the similarities and differences between image frames.

Benefits of technology

It significantly reduces the storage space occupied by image frames, improves compression efficiency, achieves an extremely high inter-frame compression ratio, and reduces the overall data volume.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121750876A_ABST
    Figure CN121750876A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data compression, and discloses an image frame sequence compression method and device, electronic equipment and a storage medium, the method is applied to embedded equipment, and the method comprises the steps that a first image frame and a second image frame are acquired, and the first image frame and the second image frame are images with adjacent time sequences; compressing the pixel data of the first image frame based on a variable length coding algorithm of control bytes to obtain a first compressed data stream; determining difference pixel data of the second image frame and the first image frame; and based on a differential coding algorithm of control bytes, compressing the difference pixel data to obtain a second compressed data stream. Through the technical scheme of the invention, the problems of large storage space occupation and low general compression efficiency of the image frame sequence on the embedded equipment are solved, the storage space occupation of the image frame sequence in the embedded equipment is reduced, and the compression efficiency of the image frame sequence is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data compression technology, specifically to methods, apparatus, electronic devices, and storage media for compressing image frame sequences. Background Technology

[0002] In embedded device graphics display applications, such as animated expressions on smart toys, it is often necessary to process continuous sequences of image frames. These devices generally suffer from hardware constraints such as limited storage space, scarce memory resources, and weak computing power.

[0003] In related technologies, common image formats such as Portable Network Graphics (PNG) and Graphics Interchange Format (GIF) or sequences thereof are often used to store animation frames. However, these formats are not specifically optimized for embedded animation scenarios and suffer from limited compression ratios and large storage space requirements; while computationally complex and efficient video coding standards are difficult to decode in real time on resource-constrained microcontrollers.

[0004] In other words, in related technologies, image frame sequences on embedded devices suffer from problems such as large storage space consumption and low compression efficiency. Summary of the Invention

[0005] This application provides a method, apparatus, electronic device, and storage medium for compressing image frame sequences, in order to solve the problems of large storage space occupation and low general compression efficiency of image frame sequences on embedded devices in related technologies.

[0006] In a first aspect, this application provides a method for compressing an image frame sequence, the method comprising: Acquire a first image frame and a second image frame, wherein the first image frame and the second image frame are temporally adjacent images; Based on a variable-length encoding algorithm for control bytes, the pixel data of the first image frame is compressed to obtain a first compressed data stream; Determine the difference pixel data between the second image frame and the first image frame; The differential encoding algorithm based on control bytes is used to compress the difference pixel data to obtain a second compressed data stream.

[0007] In one optional implementation, the pixel data of the first image frame is compressed based on a variable-length encoding algorithm for control bytes to obtain a first compressed data stream, including: The consecutive identical pixel values ​​in the first image frame are taken as repeating segments of pixels; Multiple consecutive different pixel values ​​in the first image frame are used as text field pixels; For repeated segment pixels and text field pixels, corresponding control bytes are generated respectively. The highest bit of the control byte is used to identify the segment type, and the remaining bits are used to identify the segment length. A first compressed data stream is generated based on the control byte and the pixel data corresponding to the control byte.

[0008] In one optional implementation, corresponding control bytes are generated for repeating segment pixels and text segment pixels, including: For repeated pixel segments, a first control byte is generated, followed by a pixel value. The number of times this pixel value should be repeated is determined by the length information in the first control byte. For each pixel in the text field, a second control byte is generated. The second control byte is followed by multiple pixel values, and the number of pixel values ​​is determined by the length information in the second control byte.

[0009] In one optional implementation, a differential encoding algorithm based on control bytes is used to compress the difference pixel data to obtain a second compressed data stream, including: The continuous pixel regions that have not changed in the difference pixel data are used as skip segments; The continuous pixel regions that change in the differential pixel data are considered as the change segments; A corresponding third control byte is generated for the skip segment, wherein the highest bit of the third control byte is set to the first preset value to identify the skip segment, and the remaining bits are used to identify the length of the skip segment; A corresponding fourth control byte is generated for the change segment. The highest bit of the fourth control byte is set to the second preset value to identify the change segment, and the remaining bits are used to identify the length of the change segment. Multiple pixel values ​​corresponding to the change segment are stored after the fourth control byte. A second compressed data stream is generated based on the third control byte, the fourth control byte, and the multiple pixel values ​​corresponding to the changed segments stored after the fourth control byte.

[0010] In one alternative implementation, the method further includes: Acquire overlay data, which includes independently compressed color stream data and transparency stream data; Decode the color stream data and the transparency stream data separately to obtain the overlay color buffer and the overlay transparency buffer; Based on the data in the overlay transparency buffer, perform an alpha blending operation on the pixels in the overlay color buffer and the corresponding pixels in the background image frame; Output the composite image frame data obtained after the mixing operation.

[0011] In one alternative implementation, after obtaining the first compressed data stream, the method further includes: The first image frame is divided into multiple decoding segments along the row direction; The decoding loop is executed sequentially for each of the multiple decoding segments. The decoding loop includes: sequentially reading data from the first compressed data, decoding the pixel data corresponding to the current decoding segment into the buffer by parsing the control bytes, and outputting the pixel data of the current decoding segment.

[0012] In one alternative implementation, after generating the second compressed data stream, the method further includes: A reference frame buffer is determined, which stores the pixel data of the first image frame obtained by decoding the first compressed data stream; Divide the baseline frame buffer into multiple fragments to be updated in the row direction; Update multiple segments to be updated sequentially. Based on the second compressed data stream, update operations are performed in the region of the current updated segment in the reference frame buffer. The update operations are as follows: if it is a skipped segment, the original pixel data is kept to obtain the updated segment; if it is a changed segment, new pixel data is written to obtain the updated segment, and the updated segment is output.

[0013] Secondly, this application provides an image frame sequence compression apparatus for use in embedded devices, the apparatus comprising: The acquisition module is used to acquire a first image frame and a second image frame, wherein the first image frame and the second image frame are temporally adjacent images; The first frame compression module is used to compress the pixel data of the first image frame based on a variable-length encoding algorithm of control bytes to obtain the first compressed data stream; The image difference module is used to determine the difference pixel data between the second image frame and the first image frame; The variable frame compression module is used to compress the difference pixel data based on the differential encoding algorithm of the control byte to obtain a second compressed data stream.

[0014] Thirdly, this application provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the image frame sequence compression method described in the first aspect or any corresponding embodiment.

[0015] Fourthly, this application provides a computer-readable storage medium storing computer instructions for causing a computer to execute the image frame sequence compression method described in the first aspect or any corresponding embodiment.

[0016] Fifthly, this application provides a computer program product, including computer instructions for causing a computer to execute the image frame sequence compression method described in the first aspect or any corresponding embodiment.

[0017] The image frame sequence compression method provided in this application achieves the following beneficial technical effects compared to existing technologies: First and second image frames are acquired, being temporally adjacent, providing a data source for compression based on inter-frame correlation; a variable-length coding algorithm based on control bytes is used to compress the pixel data of the first image frame, resulting in a first compressed data stream, effectively eliminating significant spatial redundancy within a single frame and significantly reducing the storage space occupied by the first frame; the difference pixel data between the second and first image frames is determined, obtaining the inter-frame variation portion and avoiding redundant storage of invariant data; a differential coding algorithm based on control bytes is used to compress the difference pixel data, resulting in a second compressed data stream. By encoding only the variation information, an extremely high inter-frame compression ratio is achieved in animation sequences, significantly reducing the overall data volume and improving compression efficiency. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this application; Figure 2 This is a flowchart illustrating an image frame sequence compression method according to an embodiment of this application; Figure 3 This is a structural block diagram of an image frame sequence compression apparatus according to an embodiment of this application; Figure 4 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0021] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0022] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0023] As one optional application scenario in the embodiments of this application, such as Figure 1 As shown, the compression system for this image frame sequence may include at least one terminal device and at least one server. Figure 1 The system is illustrated in the example, which includes a computer 101, a mobile terminal 102, and a server 103, and the terminal devices such as the computer 101 and the mobile terminal 102 are connected to the server 103 through a network 110.

[0024] Specifically, the terminal device can be a smartphone, tablet, laptop, PDA, desktop computer, game console, smart TV, smart wearable device, in-vehicle terminal, VR (Virtual Reality) device, AR (Augmented Reality) device, etc. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranet, local area network, wide area network, mobile communication network, and combinations thereof.

[0025] It should be noted that, Figure 1 This is merely an example of an application scenario and does not limit the scope of protection of this application.

[0026] The embodiments of this application will be described below with reference to the accompanying drawings. It should be understood that the pages shown in the drawings are merely examples, and various page designs are possible in practice. The various graphic elements on the page may have different arrangements and different visual representations, one or more elements may be omitted or replaced, and one or more other elements may also be present; no limitations are imposed on the embodiments of this application. Furthermore, the embodiments are primarily described below with reference to terminal device 110. It should be understood that the actions described relative to terminal device 110 can be performed by application 101 on terminal device 110, or can be performed by application 101 in conjunction with its server (e.g., server 120).

[0027] This application provides an image frame sequence compression method. By introducing a two-layer compression mechanism that combines variable-length coding based on control bytes with differential coding, the method can significantly reduce the storage footprint and transmission load of the sequence frames while ensuring image quality, and significantly reduce the dependence of the decoding process on memory resources.

[0028] According to an embodiment of this application, an embodiment of an image frame sequence compression method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0029] This embodiment provides an image frame sequence compression method that can be used in embedded devices. Figure 2 This is a flowchart of an image frame sequence compression method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps: Step S201: Obtain the first image frame and the second image frame, wherein the first image frame and the second image frame are temporally adjacent images.

[0030] Specifically, the first image frame refers to the starting frame or reference frame in the animation sequence, such as the complete frame of the "open eyes" state in the smart toy's facial expression animation. The second image frame refers to the frame immediately following the first image frame, such as the frame of "starting to blink." The two are consecutive in playback time.

[0031] By acquiring two consecutive frames, a data foundation is established for subsequent compression based on the high similarity between frames. The technical advantage lies in the fact that by locking temporally adjacent frame pairs, it becomes possible to efficiently encode only the differences between frames, thus providing a prerequisite for significantly reducing the amount of data stored in subsequent frames.

[0032] Step S202: Based on the variable-length encoding algorithm of the control byte, the pixel data of the first image frame is compressed to obtain the first compressed data stream.

[0033] Specifically, the variable-length encoding algorithm for control bytes refers to a lossless / low-loss compression algorithm designed for the characteristics of embedded animation. The first compressed data stream refers to the binary data sequence generated after the first image frame is compressed using the above algorithm. It consists of a series of "control bytes + corresponding pixel data" units in sequence. For example, a control byte identifying a repeating segment is followed by a pixel value to be repeated, or a control byte identifying a text field is followed by a string of original pixel values. This data stream is the basis for subsequent decoding operations and the benchmark for differential comparison with subsequent frames.

[0034] As an example, a dedicated control byte is used. The highest bit of this byte is used to identify whether the current data segment is a repeating segment (such as consecutive identical colors) or a text segment (such as consecutive different colors), while the remaining bits are used to indicate the pixel length contained in the segment. The algorithm achieves high-efficiency compression by identifying consecutive identical pixel regions (repeating segments) and consecutive non-identical pixel regions (text segments) in the image, and generating control bytes and corresponding pixel data for each.

[0035] Step S203: Determine the difference pixel data between the second image frame and the first image frame.

[0036] Specifically, difference pixel data refers to the set of data used to describe the differences between two image frames, obtained by comparing the second image frame with the first image frame pixel by pixel. It is the "increment" or "change mask" of the second frame relative to the first frame. This data can usually be represented as an array of the same size as the image, where: the values ​​of unchanged pixels are marked with specific values ​​(such as 0), indicating that the pixel at this location is the same as in the first frame and no additional information is needed. The values ​​of changed pixels are recorded as the actual new pixel values ​​at that location in the second frame. For example, in a blinking animation, the difference pixel data mainly contains the new color values ​​of the eyelid area, while most of the unchanged background area is marked as unchanged.

[0037] In one possible implementation, the difference pixel data can be obtained by performing a subtraction operation between corresponding pixels of the first image frame and the second image frame.

[0038] Step S204: Based on the differential encoding algorithm of the control byte, the difference pixel data is compressed to obtain the second compressed data stream.

[0039] Specifically, the differential encoding algorithm for the control byte refers to the algorithm used to compress inter-frame difference data. It reuses the control byte from the aforementioned steps, with its highest bit used to identify whether the current data segment is a skipped segment (i.e., a continuous pixel region completely identical to the previous frame) or a changed segment (i.e., a continuous pixel region that has changed). The difference pixel data is scanned, and continuous regions marked as unchanged are encoded as skipped segments containing only control bytes. Continuous regions that have changed are encoded as changed segments containing the new pixel values ​​after the control bytes. The second compressed data stream refers to the binary data sequence generated after performing the above differential encoding on the difference pixel data. This data stream no longer contains complete second frame information but consists of a series of control instructions (skip / change) and only the new pixel data, thus achieving extreme compression of the second image frame.

[0040] The differential encoding algorithm of the control byte is used to encode the differential pixel data into a skip segment of the control byte and a segment of the change of the new pixel value after the control byte.

[0041] The image frame sequence compression method provided in this embodiment obtains a first image frame and a second image frame, which are temporally adjacent images, providing a data source for compression based on inter-frame correlation. A variable-length encoding algorithm based on control bytes is used to compress the pixel data of the first image frame, resulting in a first compressed data stream. This effectively eliminates a large amount of spatial redundancy within a single frame image, significantly reducing the storage space occupied by the first frame. The difference pixel data between the second and first image frames is determined, obtaining the inter-frame variation portion and avoiding the repeated storage of invariant data. A differential encoding algorithm based on control bytes is then used to compress the difference pixel data, resulting in a second compressed data stream. By encoding only the variation information, an extremely high inter-frame compression ratio is achieved in the animation sequence, significantly reducing the overall data volume and improving compression efficiency.

[0042] In an optional implementation, step S202 includes: Step S301: Select consecutive identical pixel values ​​in the first image frame as repeating segment pixels.

[0043] Step S302: Take multiple consecutive different pixel values ​​in the first image frame as text field pixels.

[0044] Step S303: Generate corresponding control bytes for repeating segment pixels and text field pixels respectively. The highest bit of the control byte is used to identify the segment type, and the remaining bits are used to identify the segment length.

[0045] Step S304: Generate a first compressed data stream based on the control byte and the pixel data corresponding to the control byte.

[0046] Specifically, a repeating pixel segment refers to a sequence of pixels in an image that appears consecutively and has the same numerical value. For example, in an RGB565 format image (each pixel is represented by 16 bits), a pure white background area might contain 100 consecutive pixels, each with a value of 0xFFFF. These 100 pixels constitute a repeating pixel segment. A textural pixel segment refers to a sequence of pixels in an image that appears consecutively but has different numerical values. For example, in an area containing a color gradient, the pixel values ​​might be 0x1234, 0x2345, and 0x3456. These three consecutive pixels constitute a textural pixel segment.

[0047] Identify consecutive identical pixel values ​​in the first image frame and designate them as repeating segments to represent pixels that are repetitive and compressible. Then, designate multiple consecutive distinct pixel values ​​in the first image frame as text segments to represent distinct pixels to be encoded. Based on the control byte setting rules, generate corresponding control bytes for the repeating segments and text segments, and then use the control bytes and the corresponding pixel data to generate the first compressed data stream.

[0048] In one example, the raw data of a row of pixels in the first image frame in RGB565 format is: 0xFF00, 0xFF00, 0xFF00, 0x1234, 0x5678, 0x9ABC. This raw data is 12 bytes long. According to the steps of this embodiment, it is encoded as follows: The first three pixels (0xFF00) are identified as being identical and are treated as a repeating segment of pixels.

[0049] The last three pixels (0x1234, 0x5678, 0x9ABC) were identified as different and treated as a single text field pixel.

[0050] Generate control bytes for the repeating segment pixels. The length of the repeating segment pixels is 3, so the remaining positions representing the number of repeating pixels are: length - 1 = 2. Because its type is a repeating segment, set the highest bit M of the control byte to 1, so this control byte is 0x82 (i.e., binary 1000 0010). Generate control bytes for this text field. Its length is 3, length - 1 = 2. Its type is a text field, M=0. Therefore, the control byte is 0x02.

[0051] For repeating pixel segments, a pixel value of 0xFF00 (occupying 2 bytes) is stored after control byte 0x82. For text segments, three pixel values ​​of 0x1234, 0x5678, and 0x9ABC (occupying a total of 6 bytes) are stored consecutively after control byte 0x02. Ultimately, the first compressed data stream consists of the following byte sequence: 0x82, 0xFF, 0x00, 0x02, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC That is, the original 12 bytes of data are compressed into 10 bytes.

[0052] This implementation identifies repetitive and textual regions in images and encodes them using control bytes with a unified structure, significantly improving the compression efficiency of single-frame images while maintaining image quality. This scheme is particularly suitable for processing large areas of monochrome or gradient regions commonly found in embedded animations, achieving a high compression ratio. Furthermore, the generated compressed data stream has a regular format and simple decoding logic, greatly reducing the computational complexity and memory requirements of the decoder. This provides crucial technical support for achieving real-time decoding and playback of high-quality animations on resource-constrained embedded devices.

[0053] In an optional implementation, step S2023 includes: Step S401: For repeated segment pixels, generate a first control byte, followed by a pixel value. The number of times the pixel value should be repeated is determined by the length information in the first control byte.

[0054] Specifically, the first control byte is the metadata byte used to identify and control a repeating segment (composed of consecutive identical pixels). Its highest bit (M) is fixed at 1, indicating that the segment is a repeating segment; its lower 7 bits are used to store a value that is equal to the number of pixels in the repeating segment minus 1 (i.e., length - 1).

[0055] The encoder calculates the value that should be stored in the lower 7 bits based on the length of the identified repeating pixel segment, thus generating the first control byte. Subsequently, only the pixel value of one pixel in the repeating pixel sequence is stored.

[0056] Step S402: For the text field pixels, generate a second control byte. The second control byte is followed by multiple pixel values. The number of pixel values ​​is determined by the length information in the second control byte.

[0057] Specifically, the second control byte is a metadata byte used to mark a text field pixel and define its length. Its highest bit (M bit) is fixed to the second logical value (0) to indicate that the segment is a text field pixel. The remaining 7 bits (lower 7 bits) store a value equal to the number of pixels constituting the text field minus 1 (i.e., length - 1). In this step, the encoder calculates the value of length - 1 based on the number of pixels contained in the identified text field and encodes it into the lower 7 bits to generate the second control byte.

[0058] As an example, the raw pixel data for one line of the first image frame in RGB565 format is: 0xFF00, 0xFF00, 0xFF00, 0x1234, 0x5678, 0x9ABC. This line contains 6 pixels, and according to RGB565 format (2 bytes per pixel), the raw pixel data occupies 12 bytes. The encoder performs the following operations: The first three pixel values ​​0xFF00 are identified as consecutive and identical, forming a repeating segment with a length of 3. The length is calculated as length - 1 = 2. The first control byte is generated: M = 1, with the lower 7 bits set to 2, therefore this byte is 0x82. Subsequently, only one pixel value, 0xFF00 (occupying 2 bytes: 0xFF, 0x00), is stored.

[0059] The last three pixel values, 0x1234, 0x5678, and 0x9ABC, are identified as consecutive but distinct, forming a text field with a length of 3. The length is calculated as length - 1 = 2. A second control byte is generated: M=0, with the lower 7 bits set to 2, therefore this byte is 0x02. Subsequently, these three pixel values ​​are stored consecutively (occupying a total of 6 bytes: 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC).

[0060] Finally, the first compressed data stream generated by this embodiment is the following byte sequence: 0x82, 0xFF, 0x00, 0x02, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC The original 12 bytes (6 pixels * 2 bytes / pixel) of data were compressed to 10 bytes, thus reducing the amount of data.

[0061] This implementation uses structured control bytes to efficiently process consecutive identical pixels (repeating segments) and consecutive different pixels (text segments) in an image, achieving a high compression ratio for single-frame image data while ensuring image quality. The algorithm is specifically optimized for large areas of monochrome or smooth gradient regions commonly found in embedded animations, with compression efficiency significantly higher than general formats. Simultaneously, the generated compressed data stream has a uniform format and simple, direct decoding logic, greatly reducing the computational burden and memory overhead of the decoder, providing a key technological foundation for achieving smooth animation playback in resource-constrained embedded environments.

[0062] In an optional implementation, step S204 includes: Step S401: Select the continuous pixel regions in the difference pixel data that have not changed as skip segments.

[0063] Specifically, a skipped segment refers to a region in the differential pixel data that consists of multiple consecutive pixels whose values ​​are exactly the same as those at the corresponding positions in the first image frame. It represents a portion of the second frame that does not need to be updated. For example, in a blinking animation, large static areas such as the face and background show no change in pixel values ​​compared to the first frame; these consecutive regions are identified as skipped segments. Identifying skipped segments is to completely omit this part of the data during encoding.

[0064] Step S402: The continuous pixel regions in the difference pixel data that have changed are taken as the change segments.

[0065] Specifically, a change segment refers to a region in the differential pixel data consisting of multiple consecutive pixels whose values ​​have changed relative to the first image frame. It represents the portion that must be updated in the second frame. For example, the area covered by the lower eyelid movement during blinking, where pixel values ​​change from skin color to eyelid color, is identified as a change segment.

[0066] Step S403: Generate a corresponding third control byte for the skip segment, wherein the highest bit of the third control byte is set to a first preset value to identify the skip segment, and the remaining bits are used to identify the length of the skip segment.

[0067] Specifically, the third control byte refers to a set of control metadata specifically used by the instruction decoder to "skip" a segment of pixels. Its highest bit (M) is fixed at 1 (the first preset value), indicating that the control byte corresponds to a skip segment. Its lower 7 bits store a value equal to the number of consecutive pixels contained in the skip segment minus 1 (i.e., length - 1). This control byte is not followed by any pixel data.

[0068] Step S404: Generate a corresponding fourth control byte for the change segment. The highest bit of the fourth control byte is set to a second preset value to identify the change segment, and the remaining bits are used to identify the length of the change segment. Multiple pixel values ​​corresponding to the change segment are stored after the fourth control byte.

[0069] Specifically, the fourth control byte refers to the control metadata used by the instruction decoder to "write" new pixel data. Its highest bit (M) is fixed at 0 (the second preset value), indicating that this control byte corresponds to a change segment. Its lower 7 bits store a value equal to the number of new pixels contained in the change segment minus 1 (i.e., length - 1). After this control byte, all the new pixel values ​​in the change segment must be stored consecutively.

[0070] Step S405: Generate a second compressed data stream based on the third control byte, the fourth control byte, and the multiple pixel values ​​corresponding to the changed segments stored after the fourth control byte.

[0071] Specifically, the second compressed data stream refers to a binary data sequence composed of a series of "third control bytes" and "fourth control bytes + new pixel data" units concatenated sequentially. It fully encodes the minimum set of instructions for updating the second frame from the first frame, but no longer contains the complete pixel information of the second frame.

[0072] As an example, Suppose that a certain row of the previous frame (the first image frame) is a pixel sequence [A, A, A, B, B, B, C, C, C].

[0073] The corresponding behavior of the current frame (second image frame) is [A, A, A, X, Y, Z, C, C, C].

[0074] The difference pixel data shows that only the middle B, B, B changed to X, Y, Z.

[0075] The encoder performs the following operations: Identify the first A, A, A (3 unchanged pixels) as a skipped segment.

[0076] Identify the X, Y, Z (3 changing pixels) in the middle as the changing segment.

[0077] Generate a third control byte for the skip segment (length 3): M=1, length-1=2, so it is 0x82.

[0078] Generate a fourth control byte for the changing segment (length 3): M=0, length-1=2, so it is 0x02, and then store three new pixel values ​​X, Y, Z consecutively after it. Each new pixel value occupies 2 bytes.

[0079] A second compressed data stream is generated [0x82, 0x02, X, Y, Z]. 0x82 (1 byte), 0x02 (1 byte), pixel X (2 bytes), pixel Y (2 bytes), and pixel Z (2 bytes) total 8 bytes. That is, the original complete data of 9 pixels (assuming 2 bytes per pixel, a total of 18 bytes) is compressed into this data stream (in this example, 5 control / data units, a total of 8 bytes), significantly improving the compression ratio.

[0080] This implementation uses a differential coding algorithm to encode only the pixel regions that have changed in the second image frame, while representing the large number of unchanged regions with only minimal control instructions (skip segments). This fully leverages the high temporal correlation between adjacent frames in the animation sequence, achieving an extremely high inter-frame compression ratio. In typical scenarios such as blinking and lip movements, the data volume of subsequent frames can be reduced by more than 90%, greatly saving storage space and transmission bandwidth.

[0081] In one alternative implementation, the method further includes: Step a1: Obtain overlay data, which includes independently compressed color stream data and transparency stream data.

[0082] Specifically, overlay data refers to a layer of image data used to overlay semi-transparent or transparent effects onto a background image, such as highlights, shadows, and halos in character animation. Its characteristics include potentially irregular shapes and gradual changes in transparency. Color stream data refers to a compressed data stream formed by independently compressing the pure color information (such as pixel values ​​in RGB565 format) within the overlay layer (e.g., using the aforementioned variable-length encoding algorithm). Transparency stream data refers to a compressed data stream formed by independently compressing the alpha information (usually 8 bits, ranging from 0-255) corresponding to each pixel in the overlay layer.

[0083] Step a2: Decode the color stream data and the transparency stream data respectively to obtain the overlay color buffer and the overlay transparency buffer; Specifically, the overlay color buffer is a region in memory stored after the color stream data is decoded, containing the color values ​​(e.g., RGB565) of all pixels in the overlay. The overlay transparency buffer is another region in memory stored after the transparency stream data is decoded, containing the transparency values ​​(A8) that correspond one-to-one with the pixels in the overlay color buffer.

[0084] This step decodes two independent data streams in parallel or sequentially to recover the color and transparency information of the overlay, preparing for subsequent pixel-level blending.

[0085] Step a3: Based on the data in the overlay transparency buffer, perform an alpha blending operation on the pixels in the overlay color buffer and the corresponding pixels in the background image frame.

[0086] Specifically, the background image frame refers to the complete image frame that serves as the underlying layer of the synthesis. It can be the first or second image frame obtained by the aforementioned method, or it can be other static backgrounds.

[0087] For each pixel location, based on the overlay's opacity (α) at ​​that location, the overlay color (overlay_color) and the background color (base_color) are mixed according to a formula. A typical formula (for each color channel) is as follows: result_color = (overlay_color * α + base_color * (255 - α)) / 255 Step a4: Output the synthesized image frame data obtained after the mixing operation.

[0088] Specifically, synthetic image frame data refers to the pixel data of the new image frame that is finally generated after Alpha blending operations and includes overlay visual effects.

[0089] The resulting composite image frame data can be used for direct display or further processing.

[0090] As an example, suppose a character's eyes need a "star-shaped" highlight effect as an overlay. In the overlay data, the color stream data is compressed and stored to contain the golden (RGB565) pixels inside the star, while the transparency stream data is compressed and stored to contain the information about the star's gradient from the center to the edge (alpha value from 255 to 0). Decompressing the two streams separately yields a star-shaped overlay color buffer (all golden) and its corresponding overlay transparency buffer (opaque at the center, transparent at the edges).

[0091] Use the character's facial image as the background image frame. Perform pixel-by-pixel alpha blending. In the central region of the star (α≈255), the output color is basically golden yellow; in the edge region (α≈0), the output color is basically the skin tone of the background; in the intermediate transition region, the output is a smooth blend of the two colors.

[0092] Output the final composite image frame data, which is a character's facial image with soft starlight highlights.

[0093] This implementation achieves efficient compression and real-time synthesis of overlay color and transparency information. While maintaining a high compression ratio (through independent dual-stream compression), the scheme introduces complete alpha blending capabilities, enabling the creation of complex image overlays with subtle semi-transparent effects (such as highlights and shadows) even on resource-constrained embedded devices. This significantly enhances visual expressiveness, and the decoding and synthesis processes are computationally controllable, meeting real-time requirements.

[0094] In one optional implementation, after generating the first compressed data stream in step S304, the method further includes: Step b1: Divide the first image frame into multiple decoding segments in the row direction.

[0095] Specifically, decoding segments refer to the process of continuously dividing the first image frame in the vertical direction (row direction) into several image sub-regions. For example, an image that is 160 rows high can be divided into two decoding segments, each containing 80 rows.

[0096] Based on the preset slice size (e.g., the slice_rows parameter), determine the number of decoding slices into which the first image frame is divided, and the number of image rows contained in each decoding slice.

[0097] Step b2: Sequentially execute a decoding loop for each of the multiple decoding segments. The decoding loop includes: sequentially reading data from the first compressed data, decoding the pixel data corresponding to the current decoding segment into a buffer by parsing the control bytes, and outputting the pixel data of the current decoding segment.

[0098] Specifically, data is read sequentially starting from the beginning of the first compressed data stream (or the end of the previous segment). First, the control byte is parsed; its highest bit determines whether the current segment is a repeating segment or a text segment, and the lower 7 bits determine the pixel length of the segment. According to the instructions in the control byte, the corresponding number of pixel data are decoded and written to a buffer only large enough to hold the pixels of one decoded segment. For example, for an 80-line segment, the buffer size is only half the size of the entire frame buffer. Once all pixel data for a decoded segment has been successfully decoded and filled into the buffer, the data in that buffer (i.e., the complete pixel data of the current segment) is immediately output for display or as a reference for subsequent processing. Subsequently, the same buffer is cleared or overwritten and reused for decoding the next segment.

[0099] As an example, assuming the first image frame is 160 rows (height) * 160 columns (width), in RGB565 format (2 bytes per pixel), and slice_rows = 80, the decoding process of the first compressed data stream is as follows: The first image frame is divided into two decoding segments: segment 1 (lines 0-79) and segment 2 (lines 80-159).

[0100] Taking shard 1 as an example: The decoder reads sequentially from the beginning of the first compressed data stream.

[0101] Upon encountering control byte 0x82, it is parsed as a repeating segment with a length of 3. Subsequently, a pixel value of 0xFF00 is read and repeated 3 times before being written to the beginning of the buffer.

[0102] Next, the control byte 0x02 is encountered, which is parsed into a text field with a length of 3. Then, three pixel values, 0x1234, 0x5678, and 0x9ABC, are read consecutively and written to the buffer in sequence.

[0103] The decoder continues to parse control bytes and pixel data until it generates all 160*80=12800 pixels (25600 bytes) for the 80 rows of slice 1 and fills the buffer.

[0104] Output the 25,600 bytes of pixel data for slice 1.

[0105] The decoder then continues processing the remainder of the first compressed data stream, reusing the same buffer to decode the pixel data of slice 2 (lines 80-159), and outputs it upon completion.

[0106] This implementation introduces an incremental processing strategy based on spatial dimensions during the decoding process, cleverly transforming tasks with large memory requirements into the reuse of small memory blocks. This fundamentally solves the bottleneck problem of embedded devices being unable to process high-resolution image sequences due to insufficient memory, providing crucial support in resource-constrained environments.

[0107] In one alternative implementation, after generating the second compressed data stream, the method further includes: Step c1: Determine the reference frame buffer, which stores the pixel data of the first image frame obtained by decoding the first compressed data stream; Step c2: Divide the reference frame buffer into multiple fragments to be updated in the row direction; Step c3: Update multiple segments to be updated in sequence. According to the second compressed data stream, perform the update operation in the area of ​​the current updated segment in the reference frame buffer. The update operation is as follows: if it is a skipped segment, keep the original pixel data to obtain the updated segment; if it is a changed segment, write the new pixel data to obtain the updated segment, and output the updated segment.

[0108] Specifically, the reference frame buffer refers to a contiguous region stored in memory containing the complete pixel data of the decoded first image frame. It is obtained by decoding the first compressed data stream using the aforementioned method and serves as the reference and operation object for updating and generating subsequent image frames using differential data (the second compressed data stream). The slices to be updated refer to several contiguous sub-regions obtained by logically dividing the reference frame buffer in the vertical (row) direction. Each slice to be updated corresponds to a portion of the final image rows. The purpose of this division is to apply differential updates in a streaming, low-memory-consumption manner.

[0109] In one example, assume the first image frame is 160 rows by 160 columns (RGB565 format), decoded, and stored in the base frame buffer. The second compressed data stream encodes the following change: from row 70 to row 90, 20 consecutive pixels change from color B to a new color X.

[0110] If the fragment size is set to 80 rows, then step c2 divides the base frame buffer into two fragments to be updated: fragment 1 (rows 0-79) and fragment 2 (rows 80-159).

[0111] For the first fragment to be updated (rows 0-79), the decoder sequentially parses the second compressed data stream and performs the following operations: Processing skipped segments (from the beginning of the image to the beginning of the change): The decoder first parses one or more skip segment control bytes (such as 0x82). These control bytes indicate that all pixels between the image start position (row 0, column 0) and the change start position (row 70, column 10) have not changed. Based on these control bytes, the decoder moves its internally maintained "current pixel position" pointer forward by the corresponding number of pixels until it points to the position at row 70, column 10. During this time, the pixel data in the reference frame buffer remains unchanged.

[0112] Processing changed segments (writing new pixels): The decoder then parses a change segment control byte (e.g., 0x13, indicating a length of 20). This control byte indicates that 20 new pixel values ​​(all of color X) will follow immediately. The decoder reads these 20 new pixel values ​​sequentially from the data stream and writes them into the reference frame buffer at 20 consecutive pixel positions (i.e., row 70, column 10 to column 29) starting from the "current pixel position" pointer (i.e., row 70, column 10), overwriting the existing color B. After writing is complete, the pointer moves forward 20 pixels.

[0113] Handling skipped segments (from the end of the change to the end of the fragment): Next, the decoder continues parsing until it encounters one or more skip segment control bytes. These control bytes indicate that all pixels from row 70, column 30 to row 79, column 159 (the end of the first piece to be updated) remain unchanged. Based on these instructions, the decoder moves the pointer to row 80, column 0 (the beginning of the second piece to be updated). This stage also does not modify the buffer data.

[0114] Output the updated shard data: At this point, the reference frame buffer area corresponding to the first segment to be updated (rows 0-79) has been completely updated according to the second compressed data stream. The decoder immediately outputs the pixel data corresponding to this segment (i.e., all pixels in rows 0 to 79 of the reference frame buffer). At this time, the output data already contains the updated color X of row 70.

[0115] This implementation systematically solves the dependency on the complete frame buffer when applying differential compression on embedded devices by utilizing a segmented update mechanism that works in conjunction with segmented decoding. It ensures that the entire process, from decoding the first frame to differential updates of all subsequent frames, can be executed efficiently and smoothly in a very low-memory environment, thus enabling the practical application of high-compression animation sequences on resource-constrained terminals.

[0116] This embodiment also provides an image frame sequence compression device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0117] This embodiment provides a compression device for image frame sequences, such as... Figure 3 As shown, it includes: The acquisition module 301 is used to acquire a first image frame and a second image frame, wherein the first image frame and the second image frame are temporally adjacent images; The first frame compression module 302 is used to compress the pixel data of the first image frame based on a variable-length encoding algorithm of control bytes to obtain a first compressed data stream; Image difference module 303 is used to determine the difference pixel data between the second image frame and the first image frame; The variable frame compression module 304 is used to compress the difference pixel data based on the differential encoding algorithm of the control byte to obtain a second compressed data stream.

[0118] In some alternative implementations, the first frame compression module 302 includes: The repeating segment pixel determination unit is used to identify consecutive identical pixel values ​​in the first image frame as repeating segment pixels. The text field pixel determination unit is used to determine multiple consecutive different pixel values ​​in the first image frame as text field pixels; The control byte generation unit is used to generate corresponding control bytes for repeating segment pixels and text field pixels respectively. The highest bit of the control byte is used to identify the segment type, and the remaining bits are used to identify the segment length. The first compressed data stream generation unit is used to generate a first compressed data stream based on the control byte and the pixel data corresponding to the control byte.

[0119] In some optional implementations, the control byte generation unit includes: The first control byte generation subunit is used to generate a first control byte for repeating segment pixels. The first control byte is followed by a pixel value, and the number of times the pixel value should be repeated is determined by the length information in the first control byte. The second control byte generation subunit is used to generate a second control byte for each text field pixel. The second control byte is followed by multiple pixel values, and the number of pixel values ​​is determined by the length information in the second control byte.

[0120] In some alternative implementations, the variable frame compression module 304 includes: The skip segment determination unit is used to identify continuous pixel regions in the difference pixel data that have not changed as skip segments; The change segment determination unit is used to identify continuous pixel regions in the difference pixel data that have changed as change segments. The third control byte determination unit is used to generate a corresponding third control byte for the skip segment. The highest bit of the third control byte is set to a first preset value to identify the skip segment, and the remaining bits are used to identify the length of the skip segment. The fourth control byte determination unit is used to generate a corresponding fourth control byte for the change segment. The highest bit of the fourth control byte is set to a second preset value to identify the change segment, and the remaining bits are used to identify the length of the change segment. Multiple pixel values ​​corresponding to the change segment are stored after the fourth control byte. The second compressed data stream generation unit is used to generate a second compressed data stream based on the third control byte, the fourth control byte, and multiple pixel values ​​corresponding to the changed segment stored after the fourth control byte.

[0121] In some alternative embodiments, the apparatus further includes: The overlay data acquisition module 305 is used to acquire overlay data, which includes independently compressed color stream data and transparency stream data. Decoding module 306 is used to decode color stream data and transparency stream data respectively to obtain overlay color buffer and overlay transparency buffer; The blending module 307 is used to perform alpha blending operations on the pixels of the overlay color buffer and the corresponding pixels of the background image frame based on the data of the overlay transparency buffer. Output module 308 is used to output the composite image frame data obtained after the mixing operation.

[0122] The first compressed data stream generation unit also includes: The decoding segmentation subunit is used to divide the first image frame into multiple decoding segments in the row direction; The decoding subunit is used to sequentially execute a decoding loop for each of the multiple decoding segments. The decoding loop includes: sequentially reading data from the first compressed data, decoding the pixel data corresponding to the current decoding segment into the buffer by parsing the control bytes, and outputting the pixel data of the current decoding segment.

[0123] The second compressed data stream generation unit also includes: A reference frame buffer determination subunit is used to determine the reference frame buffer, which stores the pixel data of the first image frame obtained by decoding the first compressed data stream; Update the fragment partitioning subunit, which is used to divide the reference frame buffer into multiple fragments to be updated in the row direction; The update subunit is used to perform updates on multiple segments to be updated in sequence. According to the second compressed data stream, the update operation is performed in the area of ​​the current update segment in the reference frame buffer. The update operation is as follows: if it is a skipped segment, the original pixel data is kept to obtain the update segment; if it is a changed segment, new pixel data is written to obtain the update segment, and the update segment is output.

[0124] The image frame sequence compression apparatus provided in this application can execute the image frame sequence compression method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0125] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0126] The following is a detailed reference. Figure 4 The diagram illustrates a structural schematic suitable for implementing the electronic device described in the embodiments of this application. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from memory 408 into random access memory (RAM) 403. The RAM 403 also stores various programs and data required for the operation of the electronic device. The processor 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0127] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0128] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 409, or installed from memory 408, or installed from ROM 402. When the computer program is executed by processor 401, it performs the functions defined in the image frame sequence compression method of embodiments of this application.

[0129] Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0130] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the image frame sequence compression method shown in the above embodiments is implemented.

[0131] A portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0132] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.

Claims

1. A method for compressing an image frame sequence, characterized in that, Applied to embedded devices, the method includes: Acquire a first image frame and a second image frame, wherein the first image frame and the second image frame are temporally adjacent images; Based on a variable-length encoding algorithm for control bytes, the pixel data of the first image frame is compressed to obtain a first compressed data stream; Determine the difference pixel data between the second image frame and the first image frame; Based on the differential encoding algorithm of the control byte, the differential pixel data is compressed to obtain a second compressed data stream.

2. The method according to claim 1, characterized in that, The variable-length encoding algorithm based on control bytes compresses the pixel data of the first image frame to obtain a first compressed data stream, including: The consecutive identical pixel values ​​in the first image frame are taken as repeating segments of pixels; Multiple consecutive different pixel values ​​in the first image frame are used as text field pixels; For the repeating segment pixels and the text segment pixels, corresponding control bytes are generated respectively, wherein the highest bit of the control byte is used to identify the segment type and the remaining bits are used to identify the segment length; The first compressed data stream is generated based on the control byte and the pixel data corresponding to the control byte.

3. The method according to claim 2, characterized in that, The step of generating corresponding control bytes for the repeating segment pixels and the text segment pixels includes: For the repeated segment pixels, a first control byte is generated, followed by a pixel value. The number of times the pixel value should be repeated is determined by the length information in the first control byte. For the pixel in the text field, a second control byte is generated, followed by multiple pixel values. The number of pixel values ​​is determined by the length information in the second control byte.

4. The method according to claim 1, characterized in that, The differential encoding algorithm based on the control byte compresses the difference pixel data to obtain a second compressed data stream, including: The continuous pixel regions that have not changed in the difference pixel data are treated as skipped segments; The continuous pixel regions that change in the differential pixel data are defined as change segments. A corresponding third control byte is generated for the skipped segment, wherein the highest bit of the third control byte is set to a first preset value to identify the skipped segment, and the remaining bits are used to identify the length of the skipped segment; A corresponding fourth control byte is generated for the change segment, wherein the highest bit of the fourth control byte is set to a second preset value to identify the change segment, the remaining bits are used to identify the length of the change segment, and multiple pixel values ​​corresponding to the change segment are stored after the fourth control byte. The second compressed data stream is generated based on the third control byte, the fourth control byte, and the multiple pixel values ​​corresponding to the changed segment stored after the fourth control byte.

5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Acquire overlay data, which includes independently compressed color stream data and transparency stream data; Decode the color stream data and the transparency stream data respectively to obtain the overlay color buffer and the overlay transparency buffer; Based on the data in the overlay transparency buffer, perform an alpha blending operation on the pixels in the overlay color buffer and the corresponding pixels in the background image frame; Output the composite image frame data obtained after the mixing operation.

6. The method according to claim 2, characterized in that, After obtaining the first compressed data stream, the process further includes: The first image frame is divided into multiple decoding segments in the row direction; A decoding loop is executed sequentially for each of the plurality of decoding segments. The decoding loop includes: sequentially reading data from the first compressed data, decoding the pixel data corresponding to the current decoding segment into a buffer by parsing control bytes, and outputting the pixel data of the current decoding segment.

7. The method according to claim 4, characterized in that, After generating the second compressed data stream, the method further includes: A reference frame buffer is determined, wherein the reference frame buffer stores the pixel data of the first image frame obtained by decoding the first compressed data stream; The reference frame buffer is divided into multiple fragments to be updated in the row direction; The updates are performed sequentially on the multiple segments to be updated. According to the second compressed data stream, the update operation is performed in the region of the current update segment in the reference frame buffer. The update operation is as follows: if it is a skipped segment, the original pixel data is kept to obtain the update segment; if it is a changed segment, new pixel data is written to obtain the update segment, and the update segment is output.

8. A compression apparatus for an image frame sequence, characterized in that, Applied to embedded devices, the device includes: The acquisition module is used to acquire a first image frame and a second image frame, wherein the first image frame and the second image frame are temporally adjacent images; The first frame compression module is used to compress the pixel data of the first image frame based on a variable-length encoding algorithm of control bytes to obtain a first compressed data stream; An image difference module is used to determine the difference pixel data between the second image frame and the first image frame; The variable frame compression module is used to compress the difference pixel data based on the differential encoding algorithm of the control byte to obtain a second compressed data stream.

9. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the image frame sequence compression method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the compression method for the image frame sequence according to any one of claims 1 to 7.