Lossless compression coding method of pulse video data and readable storage medium

By employing context-based adaptive prediction and lossless entropy coding methods, the high cost and demanding data processing requirements of traditional high-speed photography techniques are addressed, enabling efficient compression and lossless reconstruction of pulse video data.

CN121442094BActive Publication Date: 2026-06-26SHANGHAI GMT DIGITAL TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANGHAI GMT DIGITAL TECH
Filing Date
2025-11-10
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Traditional high-speed photography technology is costly and has high data processing requirements. The high sampling frequency of pulse video data leads to high data rate, requiring efficient compression encoding.

Method used

A context-based adaptive prediction method is adopted. By initializing the pixel context, the pixel value is predicted and the error bit string is calculated for lossless entropy encoding, which is then combined with zero-order exponential Golomb code for compression.

Benefits of technology

It significantly improves the compression ratio, achieves efficient lossless data reconstruction, and reduces data volume and computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121442094B_ABST
    Figure CN121442094B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of lossless compression codec of pulse video data and readable storage medium, and the encoding method includes: obtaining the parameter of each frame of pulse video data and initializes frame number and the context of each pixel;Frame by frame processing data, for each pixel, according to its context, prediction value is obtained by prediction;Error between actual value and prediction value is calculated, and error bit string is generated, wherein prediction correct is recorded as 0, and prediction error is recorded as 1;Error bit string is losslessly entropy coded;Finally, the encoding data is packed with frame parameter, and the context of each pixel is updated according to actual value for the prediction of next frame.The present application can effectively capture the space-time correlation of pulse video data based on the adaptive prediction of context, greatly reduce the amount of information that needs to be encoded, and significantly improve compression ratio.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of high-speed photography technology, and in particular to a lossless compression encoding and decoding method for pulse video data and a readable storage medium. Background Technology

[0002] With the continuous development of video technology, people's demand for shooting high-speed moving objects is becoming increasingly urgent. However, although traditional high-speed photography can reach thousands or even tens of thousands of frames per second, the cost is too high, and it can only be used in special fields such as scientific research, thus delaying its widespread application.

[0003] Traditional high-speed photography is based on the principle of timed exposure, controlling the exposure time of photosensitive materials (such as film or CMOS sensors) through the shutter, accumulating charge and generating brightness values ​​within fixed time intervals. Traditional methods use the extracted charge count as the brightness of the corresponding pixel in the integrator. In the era of digital photography, this brightness is quantized into an integer, represented by 8 bits or more. This presents two problems: First, the processor needs to have very high sensitivity because, in high-speed photography, the signal is distributed across all time intervals, making the signal acquired in each interval very weak; second, the processor needs to have very high data processing speed because, in high-speed photography, the amount of data is directly proportional to the frame rate.

[0004] A new high-speed photography technology called "pulse video" has recently emerged. This technology differs from traditional methods in its shooting principle. It employs an integration-comparison mechanism. An integrator accumulates the charge output by the photoelectric converter. A comparator compares the charge on the integrator with a preset threshold at fixed time intervals. If the accumulated charge on the integrator reaches the preset threshold, it outputs 1 and clears the charge on the integrator; otherwise, it outputs 0 and retains the charge on the integrator. Clearly, this method differs significantly from traditional shooting methods. Traditional methods extract the charge from the integrator at fixed time intervals, clearing the charge regardless of its amount.

[0005] Therefore, pulse video can effectively overcome two problems of traditional high-speed photography: First, pulse video does not require extracting the specific signal strength for each time interval; it only needs to compare the signal strength (charge count) with a preset threshold. Second, each pixel generates only 1 bit of data per time interval, reducing the amount of data.

[0006] Because pulse video has a very high sampling frequency, although each pixel only outputs 1 bit at each moment, the data rate is still very high. Therefore, pulse video data needs to be compressed and encoded. Summary of the Invention

[0007] The purpose of this invention is to provide a lossless compression encoding and decoding method and a readable storage medium for pulse video data. This method can effectively capture the spatiotemporal correlation of pulse video data based on context-based adaptive prediction, greatly reducing the amount of information that needs to be encoded and significantly improving the compression ratio.

[0008] To achieve the above objectives, the present invention provides a lossless compression coding method for pulse video data, comprising the following steps:

[0009] S1. Obtain the number of rows, columns, and frames per second for each frame of the pulse video data, and initialize the frame number n=0 and the context c(n,x,y) for each pixel;

[0010] S2. For each frame, repeat the following sub-steps until all frames have been processed:

[0011] S21. Obtain the nth frame pulse video data, denoted as d(n,x,y), where x and y are the column index and row index of the pixel, respectively, and the value of d(n,x,y) is 0 or 1;

[0012] S22. Predict the value of the pixel at the nth time based on the context c(n,x,y) of each pixel to obtain the predicted value p(n,x,y);

[0013] S23. Calculate the error between the actual value d(n,x,y) and the predicted value p(n,x,y) of each pixel, and generate the error bit string e(n,x,y); where e(n,x,y)=0 if the prediction is correct, and e(n,x,y)=1 if the prediction is incorrect.

[0014] S24. Perform lossless entropy encoding on the error bit string e(n,x,y);

[0015] S25. Pack the lossless entropy encoded data with the frame number n and other frame parameters to form the encoded data of the nth frame;

[0016] S26. Update the context c(n+1,x,y) of each pixel according to the actual value d(n,x,y) to prepare for processing the next frame.

[0017] Optionally, in S1, initializing the context for each pixel includes:

[0018] Initialize all g(k) in the context c(n,x,y) of each pixel to 0; where g(k) is a key parameter used to describe the history of light intensity changes in each pixel, k=0~13.

[0019] Optionally, S22 includes:

[0020] M bit strings pre(m) of length 16 are pre-stored in the encoder, where M is a preset positive integer, m = 0 to M-1;

[0021] The context c(n,x,y) consists of 14 8-bit unsigned integers, i.e., c(n,x,y)={g(0), g(1),..., g(13)}, where g(0) is the number of consecutive 0s up to the previous time step, and g(k) is the number of 0s between the k-th 1 and the (k+1)-th 1 in the past time step;

[0022] An index m is generated based on the comparison between the value of g(k) and a preset threshold.

[0023] A bit width b is generated based on the value of g(0);

[0024] The final predicted value p(n,x,y) is obtained by querying the (15-b)th bit of the bit string pre(m).

[0025] Optionally, S24 includes:

[0026] The error bit string e(n,x,y) is arranged in the order of raster scanning to form a scanning sequence;

[0027] Record the number of zeros between two adjacent 1s before the first 1, and generate a sequence of consecutive zeros z(j), j=0~J-1, where J is the number of 1s in e(n,x,y);

[0028] J is represented using a 22-bit unsigned integer;

[0029] z(j) is encoded using 0th-order exponent Golomb codes.

[0030] Optionally, S25 includes: arranging the encoded data in a specific order, which includes at least a frame start marker, the number of rows H and columns W in each frame, the number of frames n, and the entropy-coded pixel data.

[0031] Based on the same inventive concept, the present invention provides a pulse video data decoding method, comprising the following steps:

[0032] S100. Obtain a pulse video encoded data stream, wherein the pulse video encoded data stream is generated by the lossless compression encoding method for pulse video data according to any one of claims 1-5;

[0033] S200. Repeat the following sub-steps until the data stream decoding is complete:

[0034] S210. Locate the frame start marker in the data stream and decode the frame number n, the number of rows H, and the number of columns W in each frame.

[0035] S220. If n=0, initialize the context of each pixel; otherwise, naturally restore to the same context state as at the end of the previous frame before processing the nth frame.

[0036] S230. Decode the error bit string e(n,x,y) of the current frame, and reconstruct the complete error bit matrix e(x,y) based on the entropy decoding result.

[0037] S240. Using the context of the current frame and the error bit matrix e(x,y), reconstruct the original pulse data d(n,x,y) pixel by pixel;

[0038] S250. Update the context of each pixel based on the reconstructed original pulse data d(n,x,y) to prepare for processing the next frame.

[0039] Optionally, S230 includes:

[0040] First, read a 22-bit integer and decode it to get the number of 1s J in e(n,x,y);

[0041] Then, the J consecutive zero numbers z(j) are decoded sequentially using the zero-order exponent Golomb code;

[0042] Based on the decoded J and z(j) sequences, the error bit matrix e(x,y) is reconstructed.

[0043] Optionally, S240 includes:

[0044] Traverse each pixel position according to the raster scan order;

[0045] Using the context c(n,x,y) of the current pixel and the pre-stored bit string pre(m), predict the predicted value p(n,x,y) of the pixel.

[0046] Read the error bit matrix e(x,y). If e(x,y) is 0, then the original pulse data d(n,x,y) is equal to the predicted value p(n,x,y); if e(x,y) is 1, then the original pulse data d(n,x,y) is equal to 1 minus the predicted value p(n,x,y).

[0047] Optionally, the pre-stored bit string pre(m) is generated in advance by statistical analysis of a large amount of pulse video data.

[0048] Based on the same inventive concept, the present invention provides a readable storage medium having a computer program stored thereon, wherein when the computer program is executed, it can implement the lossless compression encoding method for pulse video data as described above, and / or implement the pulse video data decoding method as described above.

[0049] The lossless compression encoding and decoding method and readable storage medium for pulse video data provided by this invention have at least one of the following beneficial effects:

[0050] 1) High compression efficiency: By predicting the value of each pixel based on the context of its historical data, and using the difference between the actual value and the predicted value as the encoding object, the spatiotemporal correlation of pulse video data is effectively utilized, significantly reducing the amount of information that needs to be encoded. Then, entropy coding is performed on the generated sparse error sequence to further eliminate statistical redundancy, thereby achieving high compression efficiency while ensuring pixel-level lossless recovery.

[0051] 2) Lossless reconstruction: Encoding and decoding use the exact same prediction and context update rules, ensuring that the original data can be reconstructed accurately;

[0052] 3) Computationally efficient: The prediction process mainly involves table lookup and simple logical operations. The entropy encoding adopts efficient zero-order exponential Golomb codes, and the overall algorithm complexity is relatively low, making it suitable for real-time processing. Attached Figure Description

[0053] Those skilled in the art will understand that the accompanying drawings are provided to better understand the invention and do not constitute any limitation on the scope of the invention. Wherein:

[0054] Figure 1 A flowchart of a lossless compression coding method for pulse video data provided in an embodiment of the present invention;

[0055] Figure 2 This is a flowchart of a pulse video data decoding method provided in an embodiment of the present invention. Detailed Implementation

[0056] To make the objectives, advantages, and features of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the drawings are in a very simplified form and use non-precise proportions, and are only used to facilitate and clearly illustrate the purpose of the embodiments of this invention. Please refer to the accompanying drawings to make the objectives, features, and advantages of this invention more apparent and understandable. It should be understood that the structures, proportions, sizes, etc., depicted in the accompanying drawings are only used to complement the content disclosed in the specification, for those skilled in the art to understand and read, and are not intended to limit the implementation conditions of this invention. Any modifications to the structure, changes in proportions, or adjustments to the size, if they are the same as or similar to the effects and objectives achieved by this invention, should still fall within the scope of the technical content disclosed in this invention.

[0057] As used herein, the singular forms “a,” “an,” and “the” include plural objects unless otherwise expressly stated. As used herein, the term “or” is generally used to mean “and / or” unless otherwise expressly stated. As used herein, the term “a number” is generally used to mean “at least one” unless otherwise expressly stated. As used herein, the term “at least two” is generally used to mean “two or more” unless otherwise expressly stated.

[0058] Please refer to Figure 1 This invention provides a lossless compression coding method for pulse video data, comprising:

[0059] S1. Obtain the number of rows, columns, and frames per second for each frame of the pulse video data, and initialize the frame number n=0 and the context for each pixel;

[0060] S2. For each frame, repeat the following sub-steps until all frames have been processed:

[0061] S21. Obtain the nth frame pulse video data, denoted as d(n,x,y), where x and y are the column index and row index of the pixel, respectively, and the value of d(n,x,y) is 0 or 1;

[0062] S22. Predict the value of the pixel at the nth time based on the context c(n,x,y) of each pixel to obtain the predicted value p(n,x,y);

[0063] S23. Calculate the error between the actual value d(n,x,y) and the predicted value p(n,x,y) of each pixel, and generate the error bit string e(n,x,y); where e(n,x,y)=0 if the prediction is correct, and e(n,x,y)=1 if the prediction is incorrect.

[0064] S24. Perform lossless entropy encoding on the error bit string e(n,x,y);

[0065] S25. Pack the lossless entropy encoded data with the frame number n and other frame parameters to form the encoded data of the nth frame;

[0066] S26. Update the context c(n+1,x,y) of each pixel according to the actual value d(n,x,y) to prepare for processing the next frame.

[0067] First, execute S1 to obtain the basic parameters of the pulse video data, including the number of rows (height H), the number of columns (width W), and the number of frames per second (frame rate F) for each frame. Initialize the current frame counter n=0. Next, initialize the context c(n,x,y) for each pixel position (x,y). In a preferred embodiment, the context c(n,x,y) consists of 14 8-bit unsigned integers, i.e., c(n,x,y)={g(0), g(1), ..., g(13)}, where g(0) is the number of consecutive 0s up to the previous moment, and g(k) is the number of 0s between the k-th 1 and the (k+1)-th 1 in the past.

[0068] In S1, initializing the context for each pixel includes:

[0069] Initialize all g(k) in the context c(n,x,y) of each pixel to 0; where g(k) is a key parameter used to describe the history of light intensity changes in each pixel, k=0~13.

[0070] Then execute S2, and repeat steps S21 to S26 for each frame (from frame 0 to frame N-1).

[0071] First, execute S21 to obtain the nth frame pulse video data, denoted as d(n,x,y), where x and y are the column index and row index of the pixel, respectively, and the value of d(n,x,y) is 0 or 1.

[0072] Then execute S22 to predict the value of the pixel at the nth time based on the context c(n,x,y) of each pixel, and obtain the predicted value p(n,x,y).

[0073] In a preferred embodiment, S22 includes:

[0074] M bit strings pre(m) of length 16 are pre-stored in the encoder, where M is a preset positive integer, m = 0 to M-1;

[0075] An index m is generated based on the comparison between the value of g(k) and a preset threshold.

[0076] A bit width b is generated based on the value of g(0);

[0077] The final predicted value p(n,x,y) is obtained by querying the (15-b)th bit of the bit string pre(m).

[0078] Specifically, in S22, a predicted value p(n,x,y) is generated based on the context c(n,x,y) of each pixel. The core of this process is to query a pre-stored bit string dictionary, which contains M bit strings pre(m) of length 16. The value of M is determined by the number of possible context states, for example, it can be 65536 (2^m). 16 ).

[0079] Based on the numerical distribution of each g(k) in the context c(n,x,y), an index m is obtained by mapping through a set of preset rules (e.g., comparing the value of g(k) with a series of preset thresholds).

[0080] For example:

[0081] If g(k), k = 1~13, are all less than 2, then let

[0082] m=(1<<13)+(g(1)<<(13-1))+(g(2)<<(13-2))+...+(g(13)<<(13-13))

[0083] Otherwise, if g(k), k = 1~7, are all less than 4, then let

[0084] m=(1<<14)+(g(1)<<(14-2))+(g(2)<<(14-4))+...+(g(7)<<(14-14))

[0085] Otherwise, if g(k), k = 1~4, are all less than 8, then let

[0086] m=(1<<12)+(g(1)<<(12-3))+(g(2)<<(12-6))+...+(g(4)<<(12-12))

[0087] Otherwise, if g(k), k=1~3, are all less than 32, then let

[0088] m=(1<<15)+(g(1)<<(15-5))+(g(2)<<(15-10))+(g(3)<<(15-15))

[0089] Otherwise, if g(k), k=1~3, are all less than 32, then let

[0090] m=( (g(1)>63?63:g(1)) << 6 )+(g(2)>63?63:g(2))

[0091] At the same time, a bit width b is determined based on the value of g(0) (the number of consecutive 0s), that is...

[0092] b=g(0)>15?15:g(0)

[0093] The final predicted value p(n,x,y) is obtained by querying the (15-b)th bit of the bit string pre(m). The value of this bit (0 or 1) is the predicted value, i.e.:

[0094] p(n,x,y) = (pre(m) >> (15-b)) & 0x0001

[0095] In a preferred embodiment, the pre-stored bit string pre(m) is pre-generated by performing offline statistical analysis on a large number of representative pulse video sample data. Its generation process is a typical training process:

[0096] Data preparation: Collect multiple pulse video data as a training set.

[0097] State statistics: For each pixel in the training set at each time step, based on its current context state c(n,x,y) (mapped to index m), record the frequency of the actual bit value (0 or 1) that appears in the next time step under that state.

[0098] Rule extraction: For each specific context state (i.e., each index m), select the bit value (0 or 1) that appears more frequently in that state as its "best prediction value".

[0099] Dictionary construction: For each state m, the best predicted value is filled into the corresponding position of the 16-bit bit string pre(m) according to its relationship with the bit width b determined by g(0). This complete set containing the predicted bit strings corresponding to all M states is the pre-stored bit string dictionary. This dictionary needs to be stored in both the encoder and decoder to ensure that the prediction rules of both are consistent.

[0100] Then execute S23 to calculate the error between the actual value d(n,x,y) and the predicted value p(n,x,y) of each pixel, and generate the error bit string e(n,x,y); where e(n,x,y)=0 if the prediction is correct, and e(n,x,y)=1 if the prediction is incorrect.

[0101] Next, step S24 is executed to perform lossless entropy encoding on the error bit string e(n,x,y). In a preferred embodiment, step S24 includes:

[0102] The error bit string e(n,x,y) is arranged in the raster scan order to form a scan sequence, i.e.

[0103] e(n,0,0),e(n,1,0),...,e(n,W-1,0),e(n,0,1),...,e(n,W-1,1),...,...,e(n,0,H-1),e(n,W-1,H-1);

[0104] Record the number of zeros between two adjacent 1s before the first 1, and generate a sequence of consecutive zeros z(j), j=0~J-1, where J is the number of 1s in e(n,x,y);

[0105] J is represented using a 22-bit unsigned integer;

[0106] z(j) is encoded using 0th-order exponent Golomb codes.

[0107] Exponential Golomb codes are highly efficient at encoding small values, and since the values ​​in the z(j) sequence are usually small, they can achieve good compression results.

[0108] Next, step S25 is executed, which packages the lossless entropy encoded data (the z(j) sequence after exponential Golomb encoding and the 22-bit integer representing J) with the frame number n and other frame parameters to form the encoded data of the nth frame. Specifically, step S25 includes arranging the encoded data in a specific order, which at least includes the frame start marker, the number of rows H and columns W in each frame, the frame number n, and the lossless entropy encoded data J and z(j), and packaging them to form the final encoded data output of the nth frame.

[0109] Finally, S26 is executed, updating the context c(n+1,x,y) of each pixel based on the actual value d(n,x,y) to prepare for processing the next frame. The update rules are as follows:

[0110] If d(n,x,y) equals 0, then let

[0111] g(0) = (g(0)+1)>255 ? 255 : (g(0)+1);

[0112] If d(n,x,y) equals 1, then let

[0113] g(k) = g(k-1), k = 13~1;

[0114] g(0)=0.

[0115] Based on this, please refer to Figure 2 This invention also provides a pulse video data decoding method. Decoding is the reverse process of the above encoding, but its core lies in the perfect synchronization between the decoder and encoder. It includes the following steps:

[0116] S100. Obtain the pulse video encoded data stream, which is generated according to the lossless compression encoding method of the pulse video data described above.

[0117] S200. Repeat the following sub-steps until the data stream decoding is complete:

[0118] S210. Locate the frame start marker in the data stream and decode the frame number n, the number of rows H, and the number of columns W in each frame.

[0119] S220. If n=0, initialize the context of each pixel; otherwise, naturally restore to the same context state as at the end of the previous frame before processing the nth frame.

[0120] S230. Decode the error bit string e(n,x,y) of the current frame, and reconstruct the complete error bit matrix e(x,y) based on the entropy decoding result.

[0121] S240. Using the context of the current frame and the error bit matrix e(x,y), reconstruct the original pulse data d(n,x,y) pixel by pixel;

[0122] S250. Update the context of each pixel based on the reconstructed original pulse data d(n,x,y) to prepare for processing the next frame.

[0123] First, execute S100 to obtain the pulse video encoded data stream using the lossless compression encoding method described above for the pulse video data.

[0124] Then execute S200, and repeat sub-steps S210-S250 until the data stream decoding is complete.

[0125] First, execute S210 to locate the frame start marker in the data stream and decode the frame number n, as well as the number of rows H and columns W contained in each frame.

[0126] Then execute S220. If n=0, initialize the context of each pixel in the same way as the encoder; otherwise, the decoder should use the data and update rules that have been decoded in the previous frame to naturally restore the context state to the same state as the encoder at the end of the frame before processing the nth frame.

[0127] Next, step S230 is executed to decode the error bit string e(n,x,y) of the current frame, and to reconstruct the complete error bit matrix e(x,y) based on the entropy decoding result. Preferably, step S230 includes:

[0128] First, read a 22-bit integer and decode it to get the number of 1s J in e(n,x,y);

[0129] Then, the J consecutive zero numbers z(j) are decoded sequentially using the zero-order exponent Golomb code;

[0130] Based on the decoded J and z(j) sequences, the error bit matrix e(x,y) is reconstructed.

[0131] Then, S240 is executed to reconstruct the original pulse data d(n,x,y) pixel by pixel using the context of the current frame and the error bit matrix e(x,y).

[0132] The decoding process uses the exact same context c(n,x,y) and the exact same pre-stored bit string pre(m) as the encoding process to calculate the predicted value p(n,x,y) of the current pixel, specifically including:

[0133] Traverse each pixel position according to the raster scan order;

[0134] Using the context c(n,x,y) of the current pixel and the pre-stored bit string pre(m), predict the predicted value p(n,x,y) of the pixel.

[0135] Read the error bit matrix e(x,y). If e(x,y) is 0, then the original pulse data d(n,x,y) is equal to the predicted value p(n,x,y); if e(x,y) is 1, then the original pulse data d(n,x,y) is equal to 1 minus the predicted value p(n,x,y).

[0136] Finally, step S250 is executed, updating the context of each pixel based on the reconstructed raw pulse data d(n,x,y) to prepare for processing the next frame. Based on the reconstructed raw pulse data d(n,x,y), the context c(n,x,y) is updated to c(n+1,x,y) according to the exact same rules as the encoder. This step ensures that the context models of the decoder and encoder remain synchronized after processing each pixel, laying the foundation for correctly decoding the next frame or the next pixel.

[0137] Based on the same inventive concept, embodiments of the present invention also propose a readable storage medium storing a computer program thereon, which, when executed, can implement the lossless compression encoding method for pulse video data as described above, and / or implement the pulse video data decoding method as described above.

[0138] A readable storage medium can be a tangible device capable of holding and storing instructions for use by an instruction execution device, such as, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer programs described herein can be downloaded from the readable storage medium to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. Networks can include copper transmission cables, fiber optic transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. Each computing / processing device's network adapter card or network interface receives and forwards a computer program from the network for storage on a readable storage medium within the respective computing / processing device. The computer program used to perform the operations of this invention can be execution instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as "C" or similar languages. The computer program can execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuits, such as programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), are personalized by utilizing state information from a computer program. These electronic circuits can execute computer-readable program instructions, thereby realizing various aspects of the present invention.

[0139] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, systems, and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by a computer program. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. These computer programs can also be stored in a readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the readable storage medium storing the computer program comprises an article of manufacture including instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams.

[0140] A computer program may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the computer program executing on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0141] In summary, this invention provides a lossless compression encoding and decoding method for pulse video data and a readable storage medium. Through context-based adaptive prediction, it effectively captures the spatiotemporal correlation of pulse video data, greatly reducing the amount of information that needs to be encoded and significantly improving the compression ratio. Furthermore, the encoding and decoding employ the exact same prediction and context update rules, ensuring that the original data can be accurately reconstructed.

[0142] The above description is merely a description of preferred embodiments of the present invention and is not intended to limit the scope of the invention in any way. Any changes or modifications made by those skilled in the art based on the above disclosure are within the protection scope of the present invention. Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the present invention and its equivalents, the present invention also intends to include these modifications and variations.

Claims

1. A lossless compression coding method for pulse video data, characterized in that, Includes the following steps: S1. Obtain the number of rows, columns, and frames per second for each frame of the pulse video data, and initialize the frame number n=0 and the context c(n,x,y) for each pixel; S2. For each frame, repeat the following sub-steps until all frames have been processed: S21. Obtain the nth frame pulse video data, denoted as d(n,x,y), where x and y are the column index and row index of the pixel, respectively, and the value of d(n,x,y) is 0 or 1; S22. Predict the value of the pixel at the nth time based on the context c(n,x,y) of each pixel to obtain the predicted value p(n,x,y); S23. Calculate the error between the actual value d(n,x,y) and the predicted value p(n,x,y) of each pixel, and generate the error bit string e(n,x,y); where e(n,x,y)=0 if the prediction is correct, and e(n,x,y)=1 if the prediction is incorrect. S24. Perform lossless entropy encoding on the error bit string e(n,x,y); S25. Pack the lossless entropy encoded data with the frame number n and other frame parameters to form the encoded data of the nth frame; S26. Update the context c(n+1,x,y) of each pixel according to the actual value d(n,x,y) to prepare for processing the next frame; In step S1, initializing the context for each pixel includes: Initialize all g(k) in the context c(n,x,y) of each pixel to 0; where g(k) is a key parameter used to describe the history of light intensity change of each pixel, k=0~13; S22 includes: M bit strings pre(m) of length 16 are pre-stored in the encoder, where M is a preset positive integer, m = 0 to M-1; The context c(n,x,y) consists of 14 8-bit unsigned integers, i.e., c(n,x,y)={g(0), g(1), ..., g(13)}, where g(0) is the number of consecutive 0s up to the previous time step, and g(k) is the number of 0s between the k-th 1 and the (k+1)-th 1 in the past. An index m is generated based on the comparison between the value of g(k) and a preset threshold. A bit width b is generated based on the value of g(0); The final predicted value p(n,x,y) is obtained by querying the (15-b)th bit of the bit string pre(m).

2. The lossless compression coding method for pulse video data according to claim 1, characterized in that, S24 includes: The error bit string e(n,x,y) is arranged in the order of raster scanning to form a scanning sequence; Record the number of zeros between two adjacent 1s before the first 1, and generate a sequence of consecutive zeros z(j), j=0~J-1, where J is the number of 1s in e(n,x,y); J is represented using a 22-bit unsigned integer; z(j) is encoded using 0th-order exponent Golomb codes.

3. The lossless compression coding method for pulse video data according to claim 1, characterized in that, S25 includes arranging the encoded data in a specific order, which includes at least a frame start marker, the number of rows H and columns W in each frame, the number of frames n, and the entropy-coded pixel data.

4. A method for decoding pulse video data, characterized in that, Includes the following steps: S100. Obtain a pulse video encoded data stream, wherein the pulse video encoded data stream is generated by the lossless compression encoding method for pulse video data according to any one of claims 1-3; S200. Repeat the following sub-steps until the data stream decoding is complete: S210. Locate the frame start marker in the data stream and decode the frame number n, the number of rows H, and the number of columns W in each frame. S220. If n=0, then initialize the context of each pixel; Otherwise, it will naturally revert to the exact same context state as at the end of the frame before processing the nth frame; S230. Decode the error bit string e(n,x,y) of the current frame, and reconstruct the complete error bit matrix e(x,y) based on the entropy decoding result. S240. Using the context of the current frame and the error bit matrix e(x,y), reconstruct the original pulse data d(n,x,y) pixel by pixel; S250. Update the context of each pixel based on the reconstructed original pulse data d(n,x,y) to prepare for processing the next frame; Wherein, S240 includes: Traverse each pixel position according to the raster scan order; Using the same context c(n,x,y) and the same pre-stored bit string pre(m) as the current pixel in the encoding process, predict the predicted value p(n,x,y) of the pixel. Read the error bit matrix e(x,y). If e(x,y) is 0, then the original pulse data d(n,x,y) is equal to the predicted value p(n,x,y); if e(x,y) is 1, then the original pulse data d(n,x,y) is equal to 1 minus the predicted value p(n,x,y).

5. The pulse video data decoding method according to claim 4, characterized in that, S230 includes: First, read a 22-bit integer and decode it to get the number of 1s J in e(n,x,y); Then, the J consecutive zero numbers z(j) are decoded sequentially using the zero-order exponent Golomb code; Based on the decoded J and z(j) sequences, the error bit matrix e(x,y) is reconstructed.

6. The pulse video data decoding method according to claim 4, characterized in that, The pre-stored bit string pre(m) is generated in advance by statistical analysis of a large amount of pulse video data.

7. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it can implement the lossless compression encoding method for pulse video data according to any one of claims 1-3, and / or implement the pulse video data decoding method according to any one of claims 4-6.