CN115941953A - FPGA-based video lossless compression method and system and electronic equipment - Google Patents

FPGA-based video lossless compression method and system and electronic equipment Download PDF

Info

Publication number
CN115941953A
CN115941953A CN202211564180.7A CN202211564180A CN115941953A CN 115941953 A CN115941953 A CN 115941953A CN 202211564180 A CN202211564180 A CN 202211564180A CN 115941953 A CN115941953 A CN 115941953A
Authority
CN
China
Prior art keywords
data
reference frame
coded
encoding
mapping table
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211564180.7A
Other languages
Chinese (zh)
Inventor
范春晖
张志存
刘正
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hefei Haitu Microelectronics Co ltd
Original Assignee
Hefei Haitu Microelectronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hefei Haitu Microelectronics Co ltd filed Critical Hefei Haitu Microelectronics Co ltd
Priority to CN202211564180.7A priority Critical patent/CN115941953A/en
Publication of CN115941953A publication Critical patent/CN115941953A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a video lossless compression method, a video lossless compression system and electronic equipment based on an FPGA (field programmable gate array). The method comprises the steps of acquiring a reference frame and a non-reference frame of an image sequence, carrying out difference value calculation based on the non-reference frame and the reference frame, and acquiring difference values corresponding to all pixels of the non-reference frame and the occurrence times of different difference values; acquiring first coded data of each pixel for a non-reference frame according to a preset first mapping table, wherein the first mapping table is a one-to-one mapping relation between a difference value and the first coded data, the first coded data in the first mapping table comprise different coded values with different digits, and the number of coded digits of the first coded data corresponding to the difference value in the first mapping table is inversely proportional to the occurrence frequency of the difference value; and taking the coded data corresponding to the non-reference frame data and the reference frame image data as compressed video data. The invention realizes the real-time high-efficiency lossless compression of the image in the FPGA in the recording process.

Description

FPGA-based video lossless compression method and system and electronic equipment
Technical Field
The invention relates to the technical field of image compression, in particular to a video lossless compression method and system based on an FPGA and electronic equipment.
Background
In some cameras/video cameras, a storage unit is often arranged, the existing cameras for security protection, monitoring, household use and the like often compress images and then store the images into the cameras, and for some cameras applied to special fields, such as scientific research and industry, images need to be analyzed and measured, the images are required to retain original information, and the lossless image data is ensured in the storage process. And the single image of the original image occupies a large amount of storage, and when the recording time is long or the recording frame rate is high, the capacity is quickly occupied.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a video lossless compression method, a video lossless compression system and electronic equipment based on an FPGA (field programmable gate array), which can realize high-efficiency lossless compression on images in real time in the FPGA in the recording process.
In a first aspect, the present application provides a video lossless compression method based on an FPGA, including:
acquiring a reference frame and a non-reference frame of an image sequence, and performing difference value calculation based on the non-reference frame and the reference frame to acquire difference values corresponding to all pixels of the non-reference frame and the occurrence times of different difference values;
acquiring first coded data of each pixel of a non-reference frame according to a preset first mapping table, wherein the first mapping table is a one-to-one mapping relation between a difference value and the first coded data, the first coded data in the first mapping table comprise different coded values with different digits, and the number of coded digits of the first coded data corresponding to the difference value in the first mapping table is inversely proportional to the occurrence frequency of the difference value;
and the coded data corresponding to the non-reference frame data and the reference frame image data are used as compressed video data.
In some embodiments, the minimum number of encoding bits of the first encoded data in the first mapping table is 1.
In some embodiments, the different coded values of the different number of bits include different coded values when the number of bits is i bits respectively, where i is an integer from 1 to 8, and the different coded values of the i bits include all coded values within a range from 0 to an i-bit character coding maximum value.
In some embodiments, a method for configuring first encoded data corresponding to different differences in the first mapping table includes:
sorting the different difference values from large to small based on the occurrence times to form a difference value sequence;
and sequentially assigning first coded data to the difference value sequence from the difference value with the largest occurrence frequency, wherein the sequence of the first coded data is as follows: the number of encoding bits is i and the encoding value is increased one by one from 0 up to the maximum value of the i-bit character encoding, the number of update encoding bits is i = i +1 and the encoding value is increased one by one from 0 up to the maximum value of the i + 1-bit character encoding.
In some embodiments, after obtaining the first encoded data of each pixel for the non-reference frame according to the preset first mapping table, the method further includes: adding second coded data for representing the number of bits of the first coded data before each first coded data, wherein the number j of coded bits of the second coded data is determined based on the number m of classes of the coded bits of the first coded data, 2 j-1 <m≤2 j
Each pixel is encoded based on third encoded data that is a combination of the second encoded data and the first encoded data to form a difference value.
In some embodiments, the encoded value of the second encoded data added before the first encoded data is proportional to the number of bits of the first encoded data.
In some embodiments, after the encoded data corresponding to the non-reference frame data and the reference frame image data are used as compressed video data, decoding the compressed video data includes:
receiving code stream data of a non-reference frame, and successively acquiring second coded data and first coded data corresponding to each pixel;
acquiring a difference value corresponding to each pixel through a first mapping table based on first coded data corresponding to each pixel;
determining an original pixel value for each pixel on the non-reference frame based on the reference frame image data and the difference value;
the successively acquiring the second encoded data and the first encoded data corresponding to each pixel includes:
(1) Reading the j bit data from the 1 st bit data of the code stream data, and taking the j bit data as second coded data corresponding to the first pixel;
(2) Continuously reading a-bit data as a-bit first encoding data corresponding to a first pixel based on the encoding value a of the second encoding data;
(3) Sequentially reading j bits of second coded data and corresponding bits of first coded data from subsequent unread data of the code stream data to serve as second coded data and first coded data corresponding to a next pixel;
(4) And (4) repeating the step (3) until the code stream data reading is finished.
In some implementations, the reference frame is an image frame in the image sequence preceding the non-reference frame or a custom image frame that is not the image sequence.
In a second aspect, the present application provides an FPGA-based video lossless compression system, including:
the frame difference analysis unit is used for acquiring a reference frame and a non-reference frame in the image sequence, performing difference value calculation based on the non-reference frame and the reference frame, and acquiring difference values corresponding to all pixels of the non-reference frame and the occurrence times of different difference values;
the non-reference frame encoding method includes acquiring first encoding data of each pixel according to a preset first mapping table for a non-reference frame, wherein the first mapping table is a one-to-one mapping relation between a difference value and the first encoding data, the first encoding data in the first mapping table include different encoding values with different digits, and the number of encoding digits of the first encoding data corresponding to the difference value in the first mapping table is inversely proportional to the occurrence frequency of the difference value;
and the compressed video acquisition unit is used for taking the coded data corresponding to the non-reference frame data and the reference frame image data as compressed video data.
In a third aspect, the present application provides an electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor implements the method of any one of claims 1-7 by executing the executable instructions.
The video lossless compression method, the video lossless compression system and the electronic equipment based on the FPGA have the following beneficial effects that:
1. according to the invention, the first coded data in the first mapping table comprise different coded values with different digits, and the coded digit number of the first coded data corresponding to the difference value in the first mapping table is inversely proportional to the occurrence frequency of the difference value, so that less than 8-bit characters can be adopted to express one pixel, and further, less than 8-bit characters are adopted to code the pixels corresponding to the difference value with more occurrence frequencies, so that most of pixels in the whole image can be coded by less than 8-bit characters, the coded data amount of the whole image is effectively reduced, and the image compression ratio is improved.
2. The invention can carry out lossless compression on the video through the first coding data and the second coding data, and the frame difference calculation and coding method can be conveniently realized in the FPGA, thereby realizing efficient lossless compression.
Drawings
FIG. 1 is a schematic overall flow chart of a FPGA-based video lossless compression method in an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for obtaining a first mapping table in the embodiment of the present application;
FIG. 3 is a schematic flowchart of a video decoding method corresponding to a video lossless compression method in an embodiment of the present application;
FIG. 4 is a schematic structural diagram of an FPGA-based video lossless compression system in an embodiment of the present application;
FIGS. 5 and 6 are reference frame and non-reference frame images, respectively, of a test image in an embodiment of the present application;
FIG. 7 is a frame difference layout of a test image non-reference frame image in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The specific embodiments described herein are merely illustrative of the invention and do not delimit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The video lossless compression method based on the FPGA provided by the embodiment of the application comprises the following steps:
step 1, acquiring a reference frame and a non-reference frame of an image sequence, performing difference calculation based on the non-reference frame and the reference frame, and acquiring differences corresponding to all pixels of the non-reference frame and the occurrence times of different differences;
step 2, acquiring first coded data of each pixel for a non-reference frame according to a preset first mapping table, wherein the first mapping table is a one-to-one mapping relation between a difference value and the first coded data, the first coded data in the first mapping table comprise different coded values with different digits, and the number of coded digits of the first coded data corresponding to the difference value in the first mapping table is inversely proportional to the occurrence frequency of the difference value;
and 3, taking the coded data corresponding to the non-reference frame data and the reference frame image data as compressed video data.
In the application, only the coded data of the difference value between the non-reference frame data and the reference frame data is stored for the non-reference frame data, and the data after the whole video compression comprises the coded data corresponding to the non-reference frame data and the reference frame image data.
For the first encoded data:
the difference value with the largest occurrence times is coded by using the minimum coding bit number, namely a 1-bit character. In the embodiment of the present application, the above-mentioned "inverse ratio" is not an inverse ratio in a strict sense, and the present application may divide the number of times based on the difference valueAnd when the difference number of times in the current subsection is smaller than the difference number of times in the previous subsection, coding the difference number of times in the current subsection by using more digits than the coding number of times in the previous subsection. That is, if the differences are sorted from large to small according to the occurrence frequency of the differences in the first mapping table, the number of coding bits of the corresponding first coded data is gradually increased, and if the differences S occur 1 Number of occurrences is C 1 Difference S 2 Number of occurrences of C 2 At C 1 Greater than C 2 In the case of (2), the difference value S 1 Corresponding coded bit number i of first coded data P P Number of coded bits i of first coded data Q or less Q
On the basis, in the prior art, each pixel of the image is encoded by using 8-bit characters (for expressing a gray value of 0-255), in the application, less than 8-bit characters can be used for expressing one pixel, and further, less than 8-bit characters are used for encoding the pixels corresponding to the difference values with more occurrence times, so that most of the pixels in the whole image are encoded by using less than 8-bit characters, the encoded data volume of the whole image is effectively reduced, and the image compression ratio is improved.
It should be noted that, in the embodiment of the present application, the encoded data refers to a binary encoding sequence composed of 0 and 1, and the encoding value indicates the size of the binary encoding sequence, for example, the encoding value of the encoded data "11" is 3, and the encoding bit number of the encoded data "11" is 2.
In some embodiments, the step 1 of obtaining the difference values corresponding to all pixels of the non-reference frame and the occurrence times of the different difference values and implementing the difference values based on the FPGA includes:
(11) Reading a difference value corresponding to a current pixel of a non-reference frame;
(12) Acquiring a first memory area storage address corresponding to the difference value based on a third mapping table, and adding 1 to the storage content of the first memory area storage address, wherein the third mapping table is a one-to-one mapping relation between the difference value and the first memory area storage address;
(13) Reading a difference value corresponding to a next pixel of the non-reference frame;
(14) And (5) repeating the steps (11) to (13) until the difference value reading corresponding to all the pixels of the non-reference frame is finished.
In a preferred embodiment, the minimum value of the number of coded bits of the first coded data in the first mapping table in step 2 is 1.
Further, considering that the number of coded bits of the first coded data corresponding to the difference in the first mapping table is inversely proportional to the number of occurrences of the difference, and considering that in a continuous image sequence of a video, most of image contents of two adjacent frames do not change, the difference may be concentrated near 0, the number of occurrences of the difference is the largest, and the number of occurrences of the difference is smaller than 0.
In a preferred embodiment, the different encoding values with different bit numbers included in the first mapping table in step 2 are different encoding values with bit numbers being i bits respectively, where i is an integer from 1 to 8, and the different encoding values with bit number i include all encoding values within a range from 0 to a maximum value of i-bit character encoding.
It will be appreciated that in order to further ensure that the data amount of the encoded data of the entire image is as small as possible, the first encoded data preferably uses different encoded values of 1-bit characters, and when the different encoded values of 1-bit characters are used up, the different encoded values of 2-bit characters are used, i.e. the number of encoded bits of the first encoded data preferably uses continuous 1,2,3, instead of using intermittent numbers of encoded bits such as 1,5, 10. Similarly, the first encoding data preferably adopts all encoding values within the maximum value range of the i-bit character encoding of the current encoding bit number, and then considers the i + 1-bit encoding value.
It can be understood that the gray value of the image pixel is within 0-255, the difference value of the image pixel is between-254 and 254, the total is 509 difference data, and then the encoding bit number of the first encoding data is an integer from 1 to 8, and 2 is accumulated 1 +2 2 +2 3 +2 4 +2 5 +2 6 +2 7 +2 8 =510 encoded values, 509 difference data can be covered.
In some embodiments, the method for configuring the first encoded data corresponding to different differences in the first mapping table in step 2 includes:
step 21, sorting the different difference values from large to small based on the occurrence frequency to form a difference value sequence;
step 22, assigning first coded data to the difference sequence in sequence from the difference with the largest occurrence frequency, wherein the sequence of the first coded data is as follows: the number of encoding bits is i and the encoding value is increased one by one from 0 up to the maximum value of the i-bit character encoding, the number of update encoding bits is i = i +1 and the encoding value is increased one by one from 0 up to the maximum value of the i + 1-bit character encoding.
In one embodiment, 1 st to 2 nd of the difference sequence are ordered from large to small 1 For the difference, two different code values 0 and 1 with code number 1 can be used as the first code data, for the 2 nd of the difference sequence 1 +1 to 2 1 +2 2 The difference may adopt one of 00, 01, 10, and 11 with the encoding bit number of 2 as the first encoding data, for example, the first encoding data corresponding to the first 6 differences in the difference sequence may be 1,0, 00, 10, 11, 01 in turn, that is, the order of the encoding values when the encoding bit number is i in the first encoding data is not limited.
In another embodiment, in order to facilitate assigning first coded data to different differences of a difference sequence, sequentially adopting, as the first coded data, coded values that are sequentially increased from 0 to the maximum value of the i-bit character code for the difference sequence ordered from large to small, for example, when the coded number is 1, sequentially adopting, as the first coded data, coded values that are sequentially increased from 0 to the maximum value of the 1-bit character code for the differences of the difference sequence, that is, 0,1, then updating the coded number to i =2, sequentially assigning 00, 01, 10, 11 to subsequent differences of the difference sequence, then updating the coded number to i =3, and so on until all the differences in the first mapping table configure corresponding first coded data.
It is understood that, in one embodiment, all difference data between-254 to 254 and 509 difference data in total may be included in the first mapping table, and the corresponding first encoding data in the first mapping table includes 0,1, 00, 01, 10, 11 1 +2 2 +2 3 +2 4 +2 5 +2 6 +2 7 +2 8 In this embodiment, the first mapping table may be applied to a plurality of video compression codes with more shooting scenes.
Of course, in another embodiment, the first mapping table may be only applicable to compression coding of a certain section of video of a certain shooting scene, that is, the difference values in the first mapping table only include difference values (less than 509 difference values) of all non-reference frames and reference frames in a certain section of video to be compressed, and the first coded data in the first mapping table also only includes a part (less than 509 coded data) of the 510 coded data.
In some embodiments, after the step 2 of obtaining the first encoded data of each pixel for the non-reference frame according to the preset first mapping table, the method further includes:
step 23, adding second coded data for representing the number of bits of the first coded data before each first coded data, wherein the number j of coded bits of the second coded data is determined based on the number m of classes of coded bits of the first coded data, 2 j-1 <m≤2 j
And 24, coding each pixel based on third coded data formed by combining the second coded data and the first coded data into difference values.
In consideration of the fact that when the video compressed by the first encoded data is decoded, the received image stream to be decoded cannot be efficiently identified and the encoding length corresponding to each pixel cannot be obtained, that is, the first encoded data of each pixel cannot be accurately obtained, in the present application, for the first encoded data, second encoded data used for representing the number of bits of the first encoded data is additionally added in front of the first encoded data. In order to minimize the number of the coded bits of the second coded data, the maximum coded value of the second coded data used for the coded bits of the second coded data can cover the minimum coded bits of the multiple types of the coded bits of the first coded data. That is, for example, if there are 5, 6, 7 or 8 kinds of classes of coded bits of the first coded data, 3 bits may be used as the coded bits of the second coded data. If the number of types of the encoding bits of the first encoding data is 3 or 4, the encoding bits of the second encoding data only need to be 2 bits.
In some embodiments, the encoded value of the second encoded data added before the first encoded data is proportional to the number of bits of the first encoded data.
It should be noted that, the second encoded data used for representing the number of bits of the first encoded data is added before the first encoded data, and a mapping relationship may be configured between the second encoded data and the number of bits of the first encoded data, and a second mapping table is established to store the mapping relationship, so as to implement representing the number of bits of the first encoded data by the second encoded data. For example, if the encoding bit number of the second encoded data is 3 bits, the second encoded data of the 1-8 bits first encoded data can be as shown in the following table:
Figure BDA0003985626190000081
TABLE 1 correspondence of first encoded data bits to second encoded data bits
Further, after the step 3, that is, after the encoded data corresponding to the non-reference frame data and the reference frame image data are used as compressed video data, decoding the compressed video data, the method includes:
step 41, receiving code stream data of a non-reference frame, and successively acquiring second coded data and first coded data corresponding to each pixel;
step 42, obtaining a difference value corresponding to each pixel through a first mapping table based on the first coded data corresponding to each pixel;
step 43, determining an original pixel value of each pixel on the non-reference frame based on the reference frame image data and the difference value;
in step 41, the acquiring the second encoded data and the first encoded data corresponding to each pixel sequentially includes:
(1) Reading the j bit data from the 1 st bit data of the code stream data, and taking the j bit data as second coded data corresponding to the first pixel;
(2) Continuously reading a-bit data as a-bit first coded data corresponding to a first pixel based on the coded value a of the second coded data;
(3) Sequentially reading j bits of second coded data and corresponding bits of first coded data from subsequent unread data of the code stream data to serve as second coded data and first coded data corresponding to a next pixel;
(4) And (4) repeating the step (3) until the code stream data reading is completed.
When decoding, the reference frame does not need to be decoded, the frame difference of the coded frame is recovered according to a decoding table, the code stream firstly judges the first 3 bits, single data is taken according to the first 3 bits, the data is directly assigned as the address of the decoding table, and the data is taken out to obtain the frame difference. And then combining the reference frame, adding and subtracting the gray scale pixel by pixel, and recovering the original frame.
In one embodiment, in step 1, the reference frame is an image frame preceding the non-reference frame in the image sequence or a custom image frame of the non-image sequence.
Preferably, in the present application, if the reference frame is an image frame preceding a non-reference frame in the image sequence, the first frame image of the image sequence is used as the reference frame, and the subsequent N frame images are used as the non-reference frames, when it is found that the compression efficiency is low, the reference frame, that is, the custom image frame of the non-image sequence is automatically added, and the 1 frame reference frame plus the N frame coding frame are used as 1 coding segment.
It can be understood that, in the embodiment of the present application, for the first encoded data and the second encoded data, in specific implementation, a RAM may be opened inside the FPGA to store and call the first encoded data and the second encoded data, which is denoted as an encoding table, and at the same time, a RAM may be opened to store a decoding table in a matching manner.
In the coding table RAM, each storage unit stores one piece of coded data (including 3-bit second coded data and 1-8-bit first coded data), and considering that the number of coded data bits corresponding to different frame difference values is not fixed in the embodiment of the present application, the first 4 bits of the data stored in each storage unit of the coding table RAM of the present application are used for identifying the effective number of the coded data.
The corresponding relation between the decoding table and the coding table is the same, and for the convenience of addressing, the decoding table RAM takes the coded data as an address and the address as data for storage.
Based on the foregoing video lossless compression method based on FPGA, the embodiment of the present application further provides a video lossless compression system based on FPGA, and the system includes:
the frame difference analysis unit is used for acquiring a reference frame and a non-reference frame in the image sequence, performing difference calculation based on the non-reference frame and the reference frame, and acquiring differences corresponding to all pixels of the non-reference frame and the occurrence times of different differences;
the first coding unit is used for acquiring first coding data of each pixel for a non-reference frame according to a preset first mapping table, wherein the first mapping table is a one-to-one mapping relation between a difference value and the first coding data, the first coding data in the first mapping table comprise different coding values with different digits, and the number of coding digits of the first coding data corresponding to the difference value in the first mapping table is in inverse proportion to the occurrence frequency of the difference value;
and the compressed video acquisition unit is used for taking the coded data corresponding to the non-reference frame data and the reference frame image data as compressed video data.
It can be understood that, in order to facilitate extraction of the first encoded data for each pixel during decoding, that is, to quickly obtain the number of encoded bits of the first encoded data for each pixel, embodiments of the present application further include a second encoding unit, configured to, after obtaining the first encoded data for each pixel according to a preset first mapping table for a non-reference frame, add, before each first encoded data, second encoded data for representing the number of bits of the first encoded data, where the number j of encoded bits of the second encoded data is determined based on the number m of classes of encoded bits of the first encoded data, 2 j-1 <m≤2 j
Based on the foregoing video lossless compression method based on FPGA, an embodiment of the present application further provides an electronic device, where the electronic device includes:
a processor;
a memory for storing processor-executable instructions;
the processor executes the executable instructions to realize the FPGA-based video lossless compression method.
It is understood that the electronic device in the embodiment of the present application may be an FPGA-based high-speed camera.
Based on the FPGA-based video lossless compression method, the test results are as follows:
the two images are tested as shown in fig. 5 and 6, and the frame difference distribution of the 2 nd frame is calculated by taking the 1 st frame (fig. 5) as a reference frame as shown in fig. 7, wherein the total number of the 6 gray difference values with the highest occurrence probability accounts for 74% of the total pixel number. The resolution of the image data is 2592 × 1920, the occupied data volume is 4860KB, the occupied data volume after compression is 3110KB, and the compression rate is 64%, namely the video compression method is equivalent to 1.5 times of storage capacity expansion.
The present invention is not limited to the above-described embodiments, and those skilled in the art will be able to make various modifications without creative efforts from the above-described conception, and fall within the scope of the present invention.

Claims (10)

1. A video lossless compression method based on FPGA is characterized by comprising the following steps:
acquiring a reference frame and a non-reference frame of an image sequence, and performing difference value calculation based on the non-reference frame and the reference frame to acquire difference values corresponding to all pixels of the non-reference frame and the occurrence times of different difference values;
acquiring first coded data of each pixel for a non-reference frame according to a preset first mapping table, wherein the first mapping table is a one-to-one mapping relation between a difference value and the first coded data, the first coded data in the first mapping table comprise different coded values with different digits, and the number of coded digits of the first coded data corresponding to the difference value in the first mapping table is inversely proportional to the occurrence frequency of the difference value;
and taking the coded data corresponding to the non-reference frame data and the reference frame image data as compressed video data.
2. The FPGA-based video lossless compression method according to claim 1, wherein the minimum number of encoding bits of the first encoding data in the first mapping table is 1.
3. The method according to claim 2, wherein the different coding values with different bit numbers comprise different coding values with respective bit numbers of i bits, wherein i is an integer from 1 to 8, and the different coding values with i bits comprise all coding values within a maximum coding value range from 0 to i bits of character.
4. The FPGA-based video lossless compression method according to claim 3, wherein the method for configuring the first encoded data corresponding to the different difference values in the first mapping table includes:
sorting the different difference values from large to small based on the occurrence times to form a difference value sequence;
and sequentially assigning first coded data to the difference value sequence from the difference value with the largest occurrence frequency, wherein the sequence of the first coded data is as follows: the number of encoding bits is i and the encoding value is increased one by one from 0 up to the maximum value of the i-bit character encoding, the number of update encoding bits is i = i +1 and the encoding value is increased one by one from 0 up to the maximum value of the i + 1-bit character encoding.
5. The method of claim 1, wherein after the obtaining the first encoded data of each pixel for the non-reference frame according to the preset first mapping table, the method further comprises: adding second coding data for representing the number of bits of the first coding data before each first coding data, wherein the number j of the coding bits of the second coding data is determined based on the number types m of the coding bits of the first coding data, 2 j-1 <m≤2 j
Each pixel is encoded based on third encoded data that is a combination of the second encoded data and the first encoded data to form a difference value.
6. The FPGA-based video lossless compression method of claim 5, wherein the coding value of the second encoded data added before the first encoded data is proportional to the number of bits of the first encoded data.
7. The FPGA-based lossless video compression method of claim 5, comprising: after the encoded data corresponding to the non-reference frame data and the reference frame image data are used as compressed video data, when decoding the compressed video data, the method includes:
receiving code stream data of a non-reference frame, and successively acquiring second coded data and first coded data corresponding to each pixel;
acquiring a difference value corresponding to each pixel through a first mapping table based on first coded data corresponding to each pixel;
determining an original pixel value for each pixel on the non-reference frame based on the reference frame image data and the difference value;
the successively acquiring the second encoded data and the first encoded data corresponding to each pixel includes:
(1) Reading a j bit data from the 1 st bit data of the code stream data, and taking the j bit data as a second coded data corresponding to a first pixel;
(2) Continuously reading a-bit data as a-bit first coded data corresponding to a first pixel based on the coded value a of the second coded data;
(3) Sequentially reading j bits of second coded data and corresponding bits of first coded data from subsequent unread data of the code stream data to serve as second coded data and first coded data corresponding to a next pixel;
(4) And (4) repeating the step (3) until the code stream data reading is finished.
8. The FPGA-based video lossless compression method of claim 6, wherein the reference frame is an image frame preceding a non-reference frame in the image sequence or a custom image frame of the non-image sequence.
9. An FPGA-based video lossless compression system, comprising:
the frame difference analysis unit is used for acquiring a reference frame and a non-reference frame in the image sequence, performing difference value calculation based on the non-reference frame and the reference frame, and acquiring difference values corresponding to all pixels of the non-reference frame and the occurrence times of different difference values;
the non-reference frame encoding method includes acquiring first encoding data of each pixel according to a preset first mapping table for a non-reference frame, wherein the first mapping table is a one-to-one mapping relation between a difference value and the first encoding data, the first encoding data in the first mapping table include different encoding values with different digits, and the number of encoding digits of the first encoding data corresponding to the difference value in the first mapping table is inversely proportional to the occurrence frequency of the difference value;
and the compressed video acquisition unit is used for taking the encoded data corresponding to the non-reference frame data and the reference frame image data as compressed video data.
10. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory for storing processor-executable instructions;
wherein the processor implements the method of any one of claims 1-7 by executing the executable instructions.
CN202211564180.7A 2022-12-07 2022-12-07 FPGA-based video lossless compression method and system and electronic equipment Pending CN115941953A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211564180.7A CN115941953A (en) 2022-12-07 2022-12-07 FPGA-based video lossless compression method and system and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211564180.7A CN115941953A (en) 2022-12-07 2022-12-07 FPGA-based video lossless compression method and system and electronic equipment

Publications (1)

Publication Number Publication Date
CN115941953A true CN115941953A (en) 2023-04-07

Family

ID=86550153

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211564180.7A Pending CN115941953A (en) 2022-12-07 2022-12-07 FPGA-based video lossless compression method and system and electronic equipment

Country Status (1)

Country Link
CN (1) CN115941953A (en)

Similar Documents

Publication Publication Date Title
US10834415B2 (en) Devices for compression/decompression, system, chip, and electronic device
JP7026878B2 (en) Quantization parameter prediction with maintained visual quality using deep neural network
CN1094623C (en) Method and circuit for extracting histogram and cumulative distribution function for image enhancement apparatus
JPH0258814B2 (en)
MXPA02010002A (en) Enhanced compression of gray level images.
RU2008150330A (en) COMPRESSING VIDEO DATA WITHOUT VISIBLE LOSS
CN108347602B (en) Method and apparatus for lossless compression of video data
Maleki et al. Blockcnn: A deep network for artifact removal and image compression
CN111131828B (en) Image compression method and device, electronic equipment and storage medium
CN112235569A (en) Fast video classification method, system and device based on H264 compressed domain
CN114640857A (en) Image compression method and 3D noise reduction method based on improved Huffman coding
CN108182712B (en) Image processing method, device and system
CN111432213A (en) Adaptive tile data size coding for video and image compression
US8559741B2 (en) Lossless image compression method
CN115941953A (en) FPGA-based video lossless compression method and system and electronic equipment
US8428381B2 (en) Image compression method with variable quantization parameter
CN114501011B (en) Image compression method, image decompression method and device
JPS60214181A (en) Coding system
CN104809747B (en) The statistical method and its system of image histogram
CN112348788A (en) Image quality evaluation method and device, electronic equipment and storage medium
CN111243046A (en) Image quality detection method, device, electronic equipment and storage medium
CN116668702B (en) Video coding method, device, terminal equipment and storage medium
CN114339305B (en) Virtual desktop image processing method and related device
CN116170599B (en) Synchronous real-time image compression method, system, medium and terminal
JP3123797B2 (en) Coding device and decoding device for predictive coding method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination