CN111294600A - Compression method, decompression method and device for video sequence frame - Google Patents
Compression method, decompression method and device for video sequence frame Download PDFInfo
- Publication number
- CN111294600A CN111294600A CN202010184103.3A CN202010184103A CN111294600A CN 111294600 A CN111294600 A CN 111294600A CN 202010184103 A CN202010184103 A CN 202010184103A CN 111294600 A CN111294600 A CN 111294600A
- Authority
- CN
- China
- Prior art keywords
- frame data
- video
- video frame
- difference
- data
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 60
- 230000006837 decompression Effects 0.000 title claims abstract description 55
- 238000007906 compression Methods 0.000 title abstract description 38
- 230000006835 compression Effects 0.000 title abstract description 38
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 55
- 238000009877 rendering Methods 0.000 claims abstract description 33
- 230000015654 memory Effects 0.000 claims description 20
- 238000004806 packaging method and process Methods 0.000 claims description 3
- 230000000694 effects Effects 0.000 abstract description 6
- 239000002609 medium Substances 0.000 description 11
- 230000006870 function Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 3
- 238000013144 data compression Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000013135 deep learning Methods 0.000 description 2
- 230000009191 jumping Effects 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 239000012120 mounting media Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/42—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
- H04N19/136—Incoming video signal characteristics or properties
- H04N19/137—Motion inside a coding unit, e.g. average field, frame or block difference
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/44—Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The embodiment of the application discloses a compression method, a decompression method and a device of video sequence frames, electronic equipment and a storage medium. According to the technical scheme provided by the embodiment of the application, when video frame data are compressed, each analyzed frame of video frame data is compared with the previous frame of video frame data, the corresponding difference rectangular areas are determined, data in each difference rectangular area are compressed one by using an LZ4 algorithm, and are packaged with the corresponding coordinate information and are sequentially stored in a video file. And when the video file is decompressed and played, decompressing each frame of read video frame data to extract a difference rectangular area and corresponding coordinate information, acquiring corresponding previous frame of video frame data in real time, and rendering the current video frame data based on the previous frame of video frame data, the difference rectangular area and the corresponding coordinate information. By adopting the technical means, the decompression data volume can be reduced, the video decompression efficiency can be improved, and the video decompression playing effect can be optimized.
Description
Technical Field
The embodiment of the application relates to the technical field of video compression, in particular to a compression method, a decompression method and a device for video sequence frames.
Background
At present, for video playing, on a high-performance platform (such as a platform of a home PC, a television, etc.), compression and decompression algorithms of the H264 standard are often used to achieve high-quality video image playing. For the embedded platform, the H264 standard compression and decompression algorithm adopts an algorithm with a large calculation amount, such as a predicted frame and dynamic fuzzy compensation, and the code of the algorithm is large and bloated, so that the algorithm is difficult to be put into the embedded platform for use.
For this reason, currently, a static digital image algorithm such as MJPEG is used as a video playing algorithm in the embedded platform to realize video playing of the embedded platform. However, when the MJPEG algorithm is used for video decompression, the consumed time is relatively long, and the fluency of video playing cannot be guaranteed.
Disclosure of Invention
The embodiment of the application provides a compression method, a decompression method and device of video sequence frames, an electronic device and a storage medium, which can improve the video compression and decompression efficiency and ensure the fluency of video playing.
In a first aspect, an embodiment of the present application provides a method for compressing frames of a video sequence, including:
when video frame data are compressed, compressing the analyzed first frame of video frame data by using an LZ4 algorithm and storing the first frame of video frame data into a video file;
comparing each frame of video frame data analyzed later with the previous frame of video frame data to determine a corresponding difference rectangular area;
and compressing the data in each difference rectangular area one by using an LZ4 algorithm, and packaging the data and corresponding coordinate information and sequentially storing the data and the corresponding coordinate information into the video file.
Further, comparing each frame of video frame data parsed after the pair with the previous frame of video frame data to determine a corresponding rectangular difference region, including:
cutting each frame of video frame data into rectangular grids with corresponding specifications, wherein the rectangular grids comprise a plurality of rectangular areas;
comparing the rectangular areas of the video frame data of the front frame and the rear frame one by one, determining the corresponding difference rectangular area, and marking the coordinate information of the difference rectangular area.
Further, the comparing the rectangular regions of the front and rear frames of video frame data one by one to determine the corresponding difference rectangular region includes:
rectangular areas corresponding to the front frame data and the rear frame data of the video frame are extracted, and corresponding difference rectangular areas are determined through pixel point-by-pixel point comparison.
Further, the comparing the rectangular regions of the front and rear frames of video frame data one by one to determine the corresponding difference rectangular region further includes:
and if the difference of the rectangular areas of the front frame data and the rear frame data is larger than a set threshold value, determining the whole video frame data as a corresponding difference rectangular area.
Further, the cutting each frame of video frame data into a rectangular grid with a corresponding specification, where the rectangular grid includes a plurality of rectangular regions, includes:
regions of the video frame data that do not meet the corresponding specification are set as separate rectangular regions.
In a second aspect, an embodiment of the present application provides a method for decompressing a frame of a video sequence, including:
when the video file is decompressed and played, decompressing the read first frame of video frame data by using an LZ4 algorithm, and rendering the decompressed first frame of video frame data in real time;
decompressing each frame of video frame data read later to extract a difference rectangular area and corresponding coordinate information, wherein the difference rectangular area is determined by comparing front and rear frames of video frame data when the video frame data are compressed;
and acquiring corresponding previous frame video frame data in real time, and rendering the current video frame data based on the previous frame video frame data, the difference rectangular area and the corresponding coordinate information.
Further, the rendering the current video frame data based on the previous frame of video frame data, the difference rectangular region and the corresponding coordinate information includes:
and copying the difference rectangular area to a corresponding area of the previous frame of video frame data through the coordinate information and rendering in real time.
In a third aspect, an embodiment of the present application provides an apparatus for decompressing frames of a video sequence, including:
the first decompression module is used for decompressing the read first frame of video frame data by using an LZ4 algorithm and rendering the decompressed first frame of video frame data in real time when the video file is decompressed and played;
the second decompression module is used for decompressing each frame of video frame data read later and extracting a difference rectangular area and corresponding coordinate information, and the difference rectangular area is determined by comparing front and rear frames of video frame data when the video frame data are compressed;
and the rendering module is used for acquiring corresponding previous frame video frame data in real time and rendering the current video frame data based on the previous frame video frame data, the difference rectangular area and the corresponding coordinate information.
In a fourth aspect, an embodiment of the present application provides an electronic device, including:
a memory and one or more processors;
the memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of decompressing frames of a video sequence as described in the second aspect.
In a fifth aspect, embodiments of the present application provide a storage medium containing computer-executable instructions for performing the method for decompressing frames of a video sequence according to the second aspect when executed by a computer processor.
According to the embodiment of the application, when video frame data are compressed, each analyzed frame of video frame data is compared with the previous frame of video frame data, the corresponding difference rectangular areas are determined, data in each difference rectangular area are compressed one by using an LZ4 algorithm, and the data and corresponding coordinate information are packaged and sequentially stored in a video file. And when the video file is decompressed and played, decompressing each frame of read video frame data to extract a difference rectangular area and corresponding coordinate information, acquiring corresponding previous frame of video frame data in real time, and rendering the current video frame data based on the previous frame of video frame data, the difference rectangular area and the corresponding coordinate information. By adopting the technical means, the decompression data volume can be reduced and the video decompression efficiency can be improved by compressing and decompressing the difference area between the video frames. And through the LZ4 algorithm, the video file can be decompressed and restored on the embedded platform without loss, and the video decompression playing effect is optimized.
Drawings
Fig. 1 is a flowchart of a method for compressing frames of a video sequence according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a rectangular region difference determination process according to a first embodiment of the present application;
FIG. 3 is a flowchart of compressing and saving video frame data according to a first embodiment of the present application;
fig. 4 is a flowchart of a method for decompressing frames of a video sequence according to an embodiment of the present application;
fig. 5 is a flowchart of video frame data decompression rendering according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an apparatus for decompressing frames of a video sequence according to a second embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to a third embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, specific embodiments of the present application will be described in detail with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some but not all of the relevant portions of the present application are shown in the drawings. Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The application provides a compression method and a decompression method of video sequence frames, which aim to reduce the video frame data needing to be compressed and improve the video compression and decompression efficiency by compressing and decompressing a difference area between each frame of video frames when the video frame data are compressed. And further adopting an LZ4 algorithm (dictionary compression and decompression algorithm) to compress and decompress video frame data, wherein the LZ4 algorithm has the greatest advantage of being a lossless compression algorithm with the highest speed in the current open source compression algorithm, can further improve the compression and decompression efficiency of the video frame data, enables a video file to be decompressed and restored on an embedded platform in a lossless manner, and optimizes the video decompression and playing effect. Compared with the traditional MJPEG algorithm, when the video frame data is compressed and decompressed, the format of the method is the video format that each JPEG picture is placed next to each other in sequence. When the video is decompressed and played, each JPEG picture is analyzed and rendered on the screen. This compression and decompression method, when tested on a development board at RT1052 (CPU max frequency 528MHZ, core Cortex M7), required 300 milliseconds on average to resolve an 800 × 480 resolution JPEG picture. Since at least 30 pictures need to be played in 1 second to smoothly play a video, and each picture takes no more than 33 milliseconds (the 33 milliseconds include parsing pictures and rendering pictures), it is obvious that a video with a resolution of 800 × 480 cannot be smoothly played on an embedded platform by using the conventional MJPEG algorithm. Therefore, the compression method and the decompression method of the video sequence frame are provided to solve the technical problems of poor smoothness and low decompression efficiency of video decompression and playing of the existing embedded platform.
The first embodiment is as follows:
fig. 1 is a flowchart of a method for compressing video sequence frames according to an embodiment of the present disclosure, where the method for compressing video sequence frames provided in this embodiment may be performed by a device for compressing video sequence frames, the device for compressing video sequence frames may be implemented in a software and/or hardware manner, and the device for compressing video sequence frames may be formed by two or more physical entities or may be formed by one physical entity. Generally, the compression device for the frames of the video sequence is a corresponding video compression device adapted to the embedded platform.
The following description will be made taking, as an example, a compression apparatus of a video sequence frame as an apparatus for performing a compression method of a video sequence frame. Referring to fig. 1, the method for compressing frames of a video sequence specifically includes:
and S110, when the video frame data are compressed, compressing the analyzed first frame of video frame data by using an LZ4 algorithm and storing the first frame of video frame data into a video file.
Specifically, when video frame data is compressed, since the video frame data is compressed by using the difference region between the video frames in the embodiment of the present application, when a video picture is analyzed to obtain first frame video frame data, since the first frame video frame data is the first frame of the entire video sequence frame, all the first frame video frame data needs to be compressed and stored in a video file. So that the difference region is determined by comparing the compressed second video frame data with the first video frame data.
It should be noted that the video frame data compression algorithm used in the embodiment of the present application is not a common picture compression algorithm, but a dictionary compression algorithm of LZ4 is used, and the LZ4 compression algorithm is a relatively fast lossless compression algorithm in the current open source compression algorithm, and can improve the compression speed of the video frame data, thereby improving the video compression efficiency. Meanwhile, the embodiment of the application compresses non-image information such as difference region data and region coordinate information between frames, so that the LZ4 compression algorithm is more convenient to use than a common image compression algorithm, and the efficiency is higher.
And S120, comparing each frame of video frame data analyzed later with the previous frame of video frame data, and determining a corresponding difference rectangular area.
Further, after the first frame of video frame data is compressed, when each frame of video frame data obtained by analyzing the picture is compressed, the difference area is determined by comparison, and the difference area is compressed and stored. Specifically, when determining a difference region between two frames of video frame data, the embodiment of the present application cuts a video frame into rectangular grids, and determines the difference region based on the corresponding comparison of each rectangular region of the rectangular grids, and defines the difference region as the difference rectangular region.
Specifically, referring to fig. 2, a flowchart for determining the difference rectangular region is provided, where the flow for determining the difference rectangular region includes:
s1201, cutting each frame of video frame data into rectangular grids with corresponding specifications, wherein the rectangular grids comprise a plurality of rectangular areas;
s1202, comparing the rectangular areas of the front frame data and the rear frame data one by one, determining the corresponding difference rectangular areas, and marking the coordinate information of the difference rectangular areas.
Since the resolution of each frame of video picture is the same, the rectangular grid size of each frame of video data is the same when each frame of video data is cut into rectangular grids. For example, each 16 × 16 resolution is set as a rectangular region with a fixed specification, and the whole picture (frame) is cut into rectangular regions, each of which contains corresponding coordinate information. When the rectangular areas of the two frames of video frame data are compared, the rectangular areas of the two frames of video frame data with the same coordinate information are compared, and the rectangular area with the difference determined by the comparison is determined as the difference rectangular area.
Further, when comparing the two rectangular areas, the corresponding rectangular areas corresponding to the front and back frames of video frame data are extracted, and the corresponding difference rectangular areas are determined by comparing the pixels one by one. It can be understood that pixel point data is compared according to the same rectangular region of the previous and subsequent frames, in the corresponding rectangular region, the outer border (Bounding box) of the difference rectangle in the region is found out through comparing pixel points one by one, and the difference rectangle region is marked as the difference rectangular region and the corresponding coordinate information of the difference rectangular region is stored, so that the determination of the difference rectangular region is completed. There are many technical means for determining the picture difference through pixel point comparison, and this embodiment of the present application is not subject to fixed restrictions and is not described herein in detail.
In one embodiment, if the difference between the rectangular areas of the two frames of video frame data before and after is greater than the set threshold, the entire video frame data is determined as the corresponding difference rectangular area. It can be understood that, when comparing two frames of video frame data, if a large area of difference rectangular region occurs, which results in that the entire compression size of the difference rectangular region is already larger than the size of a picture compressed by the LZ4 algorithm, the entire picture is set to be a large difference rectangular region for data compression instead, so as to avoid that the compressed data corresponding to one frame of video frame data is too large.
In one embodiment, areas of the video frame data that do not meet the corresponding specification are set as separate rectangular areas. For example, setting each 16 × 16 resolution as a rectangular region with a fixed specification, it is obvious that there may be redundant rectangular regions in the rectangular grid corresponding to one frame of video frame data, and the redundant rectangular regions are not full of 16 × 16 resolution, i.e. the set specification is not met. Then the redundant rectangular area is regarded as a rectangular area for comparison separately, and is compared with the redundant rectangular area in the other frame of video frame data through the coordinate information.
In one embodiment, a deep learning optimization algorithm may also be used to determine the video inter-frame difference region. By adopting a deep learning optimization algorithm, the difference regions can be found and combined more intelligently, the number of the difference rectangular regions is reduced, and the performance bottleneck is further transferred to the link of copying the difference rectangular regions, so that the video frame data compression efficiency is further improved. Because the continuous copying speed is faster than the jumping copying speed, if the number of the combined difference areas is increased, the number of the discrete difference areas is reduced, the number of the jumping copying times is reduced, the number of the continuous copying times is increased, and simultaneously, the information quantity of the coordinates and the like of the difference areas can be reduced, thereby further increasing the video playing speed and reducing the volume of the video file.
S130, compressing the data in each difference rectangular area one by using an LZ4 algorithm, and packaging the data and corresponding coordinate information and sequentially storing the data and the corresponding coordinate information into the video file.
And the difference rectangular area determined by comparison each time is packed and compressed together with the corresponding coordinate information, and is sequentially stored in a video file according to the sequence of the video frame data, so that the video frame data are sequentially decompressed and rendered for playing according to the sequence of the video frame data when the video is decompressed and played subsequently.
Referring to fig. 3, a flowchart of compressing and saving video frame data according to an embodiment of the present application is provided, in which each frame of video frame data is compared with a previous frame of video frame data to determine a difference rectangular region (except for a first frame of video frame data), and the difference rectangular region corresponding to each frame of video frame data is compressed and saved until the last frame of video frame data is compressed, and the compression and saving of the video file are finished.
On the basis of the foregoing video compression embodiment, an embodiment of the present application further discloses a method for decompressing a video sequence frame, and referring to fig. 4, a flowchart of a method for decompressing a video sequence frame is provided, where the method for decompressing a video sequence frame provided in this embodiment may be executed by a device for decompressing a video sequence frame, the device for decompressing a video sequence frame may be implemented in a software and/or hardware manner, and the device for decompressing a video sequence frame may be formed by two or more physical entities or may be formed by one physical entity. Generally, the device for decompressing frames of a video sequence is an embedded platform.
Referring to fig. 4, the method for decompressing frames of a video sequence includes:
and S140, when the video file is decompressed and played, decompressing the read first frame of video frame data by using an LZ4 algorithm, and rendering the decompressed first frame of video frame data in real time.
S150, decompressing each frame of video frame data read later to extract a difference rectangular area and corresponding coordinate information, wherein the difference rectangular area is determined by comparing front and rear frames of video frame data when the video frame data are compressed.
And S160, acquiring the corresponding previous frame of video frame data in real time, and rendering the current video frame data based on the previous frame of video frame data, the difference rectangular area and the corresponding coordinate information.
When a video file compressed by the above-mentioned compression method for video sequence frames is subjected to video decompression and playing, the LZ4 algorithm is also adopted to perform data decompression. In addition, since the first frame of video frame data is completely compressed, when the first frame of video frame data is decompressed, the first frame of video frame data is completely read and decompressed and rendered in real time. After that, for each frame of read video frame data, data decompression and rendering are carried out on the difference rectangular area determined based on the comparison of the current video frame data and the previous frame of video frame data. And similarly, when the video frame data is rendered, copying the difference rectangular area to the corresponding area of the previous frame of video frame data through the coordinate information and rendering in real time.
Referring to fig. 5, a flow chart of video frame data decompression and rendering is provided, and video frame sequence rendering is performed in the difference rectangular region determined by comparing each frame of video frame data with the previous frame of video frame data and corresponding coordinate information (except for the first frame of video frame data) and corresponding to the difference rectangular region of each frame of video frame data until the last frame of video frame data is decompressed and rendered, and the current video file playing is ended.
It should be noted that the compression algorithm adopted in the embodiment of the present application is the LZ4 algorithm, the code data of the LZ4 algorithm is less than 2000 lines, and the logic code data of the video sequence frame compression method of the embodiment of the present application is also less than 1000 lines of codes, which adds up to 3000 lines of codes. The data size is relatively small, and the embedded video playing method can meet the use requirements of most embedded platforms, so that the problem that the mainstream video playing algorithm codes are bloated is solved. Meanwhile, the lossless compression algorithm of the LZ4 is adopted in the embodiment of the application, so that the video data can be played in a lossless mode, the original video color effect is perfectly restored, and the user experience is optimized. In addition, the embodiment of the application adopts a mode of compressing and storing the rectangular region of the difference between the video frames to remove a large amount of repeated data between the video frames, so that the operation efficiency of video compression is improved. In addition, by adopting the video sequence frame decompression method of the embodiment of the application, the time required for analyzing one frame of picture (video with 800 × 480 resolution) in the development board of RT1052 is 21-22 milliseconds on average, and compared with the traditional video decompression algorithm based on MJPEG, the decompression method of the embodiment of the application improves the decompression efficiency by more than ten times.
In the above, when the video frame data is compressed, each frame of video frame data analyzed is compared with the previous frame of video frame data, the corresponding difference rectangular region is determined, the data in each difference rectangular region is compressed one by using the LZ4 algorithm, and the data and the corresponding coordinate information are packed and sequentially stored in the video file. And when the video file is decompressed and played, decompressing each frame of read video frame data to extract a difference rectangular area and corresponding coordinate information, acquiring corresponding previous frame of video frame data in real time, and rendering the current video frame data based on the previous frame of video frame data, the difference rectangular area and the corresponding coordinate information. By adopting the technical means, the decompression data volume can be reduced and the video decompression efficiency can be improved by compressing and decompressing the difference area between the video frames. And through the LZ4 algorithm, the video file can be decompressed and restored on the embedded platform without loss, and the video decompression playing effect is optimized.
Example two:
on the basis of the foregoing embodiment, fig. 6 is a schematic structural diagram of a device for decompressing frames of a video sequence according to a second embodiment of the present application. Referring to fig. 6, the apparatus for decompressing video sequence frames provided in this embodiment specifically includes: a first decompression module 21, a second decompression module 22 and a rendering module 23.
The first decompression module 21 is configured to decompress data of the read first frame of video frame data by using an LZ4 algorithm when decompressing and playing a video file, and render the decompressed first frame of video frame data in real time;
the second decompression module 22 is configured to decompress each frame of video frame data read later to extract a difference rectangular region and corresponding coordinate information, where the difference rectangular region is determined by comparing two frames of video frame data before and after the video frame data is compressed;
the rendering module 23 is configured to obtain corresponding previous frame of video frame data in real time, and render the current frame of video frame data based on the previous frame of video frame data, the difference rectangular area, and the corresponding coordinate information.
In the above, when the video frame data is compressed, each frame of video frame data analyzed is compared with the previous frame of video frame data, the corresponding difference rectangular region is determined, the data in each difference rectangular region is compressed one by using the LZ4 algorithm, and the data and the corresponding coordinate information are packed and sequentially stored in the video file. And when the video file is decompressed and played, decompressing each frame of read video frame data to extract a difference rectangular area and corresponding coordinate information, acquiring corresponding previous frame of video frame data in real time, and rendering the current video frame data based on the previous frame of video frame data, the difference rectangular area and the corresponding coordinate information. By adopting the technical means, the decompression data volume can be reduced and the video decompression efficiency can be improved by compressing and decompressing the difference area between the video frames. And through the LZ4 algorithm, the video file can be decompressed and restored on the embedded platform without loss, and the video decompression playing effect is optimized.
Specifically, the rendering module 23 includes:
and the copying unit is used for copying the difference rectangular area to a corresponding area of the previous frame of video frame data through the coordinate information and rendering in real time.
The video sequence frame decompression device provided by the second embodiment of the present application can be used for executing the video sequence frame decompression method provided by the first embodiment, and has corresponding functions and beneficial effects.
Example three:
an embodiment of the present application provides an electronic device, and with reference to fig. 7, the electronic device includes: a processor 31, a memory 32, a communication module 33, an input device 34, and an output device 35. The number of processors in the electronic device may be one or more, and the number of memories in the electronic device may be one or more. The processor, memory, communication module, input device, and output device of the electronic device may be connected by a bus or other means.
The memory 32 is a computer readable storage medium, and can be used for storing software programs, computer executable programs, and modules, such as program instructions/modules corresponding to the video sequence frame decompression method described in any embodiment of the present application (for example, the first decompression module, the second decompression module, and the rendering module in the video sequence frame decompression device). The memory can mainly comprise a program storage area and a data storage area, wherein the program storage area can store an operating system and an application program required by at least one function; the storage data area may store data created according to use of the device, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory may further include memory located remotely from the processor, and these remote memories may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The communication module 33 is used for data transmission.
The processor 31 executes various functional applications of the device and data processing by running software programs, instructions and modules stored in the memory, i.e. implements the above-mentioned video sequence frame decompression method.
The input device 34 may be used to receive entered numeric or character information and to generate key signal inputs relating to user settings and function controls of the apparatus. The output device 35 may include a display device such as a display screen.
The electronic device provided above can be used to execute the method for decompressing video sequence frames provided in the first embodiment above, and has corresponding functions and advantages.
Example four:
embodiments of the present application further provide a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for decompressing a frame of a video sequence, the method for decompressing a frame of a video sequence including: when the video file is decompressed and played, decompressing the read first frame of video frame data by using an LZ4 algorithm, and rendering the decompressed first frame of video frame data in real time; decompressing each frame of video frame data read later to extract a difference rectangular area and corresponding coordinate information, wherein the difference rectangular area is determined by comparing front and rear frames of video frame data when the video frame data are compressed; and acquiring corresponding previous frame video frame data in real time, and rendering the current video frame data based on the previous frame video frame data, the difference rectangular area and the corresponding coordinate information.
Storage medium-any of various types of memory devices or storage devices. The term "storage medium" is intended to include: mounting media such as CD-ROM, floppy disk, or tape devices; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, Lanbas (Rambus) RAM, etc.; non-volatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may also include other types of memory or combinations thereof. In addition, the storage medium may be located in a first computer system in which the program is executed, or may be located in a different second computer system connected to the first computer system through a network (such as the internet). The second computer system may provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations, e.g., in different computer systems connected by a network. The storage medium may store program instructions (e.g., embodied as a computer program) that are executable by one or more processors.
Of course, the storage medium provided in the embodiments of the present application contains computer-executable instructions, and the computer-executable instructions are not limited to the method for decompressing video sequence frames as described above, and may also perform related operations in the method for decompressing video sequence frames provided in any embodiments of the present application.
The apparatus for decompressing video sequence frames, the storage medium and the electronic device provided in the foregoing embodiments may execute the method for decompressing video sequence frames provided in any embodiment of the present application, and reference may be made to the method for decompressing video sequence frames provided in any embodiment of the present application without detailed technical details described in the foregoing embodiments.
The foregoing is considered as illustrative of the preferred embodiments of the invention and the technical principles employed. The present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the claims.
Claims (10)
1. A method for compressing frames of a video sequence, comprising:
when video frame data are compressed, compressing the analyzed first frame of video frame data by using an LZ4 algorithm and storing the first frame of video frame data into a video file;
comparing each frame of video frame data analyzed later with the previous frame of video frame data to determine a corresponding difference rectangular area;
and compressing the data in each difference rectangular area one by using an LZ4 algorithm, and packaging the data and corresponding coordinate information and sequentially storing the data and the corresponding coordinate information into the video file.
2. The method of claim 1, wherein comparing each frame of video frame data parsed after the pair with a frame of video frame data of a previous frame to determine a corresponding rectangular region of difference comprises:
cutting each frame of video frame data into rectangular grids with corresponding specifications, wherein the rectangular grids comprise a plurality of rectangular areas;
comparing the rectangular areas of the video frame data of the front frame and the rear frame one by one, determining the corresponding difference rectangular area, and marking the coordinate information of the difference rectangular area.
3. The method according to claim 2, wherein said comparing rectangular regions of two frames of video frame data one by one to determine a corresponding rectangular region of difference comprises:
rectangular areas corresponding to the front frame data and the rear frame data of the video frame are extracted, and corresponding difference rectangular areas are determined through pixel point-by-pixel point comparison.
4. The method of claim 2, wherein the rectangular regions of the two frames of video frame data are compared one by one to determine a corresponding rectangular region of difference, further comprising:
and if the difference of the rectangular areas of the front frame data and the rear frame data is larger than a set threshold value, determining the whole video frame data as a corresponding difference rectangular area.
5. The method of claim 2, wherein the cutting of each frame of video frame data into a rectangular grid of corresponding dimensions, the rectangular grid including a plurality of rectangular regions, comprises:
regions of the video frame data that do not meet the corresponding specification are set as separate rectangular regions.
6. An algorithm for decompressing frames of a video sequence, comprising:
when the video file is decompressed and played, decompressing the read first frame of video frame data by using an LZ4 algorithm, and rendering the decompressed first frame of video frame data in real time;
decompressing each frame of video frame data read later to extract a difference rectangular area and corresponding coordinate information, wherein the difference rectangular area is determined by comparing front and rear frames of video frame data when the video frame data are compressed;
and acquiring corresponding previous frame video frame data in real time, and rendering the current video frame data based on the previous frame video frame data, the difference rectangular area and the corresponding coordinate information.
7. The decompression algorithm for frames of a video sequence according to claim 6, wherein the rendering of the current video frame data based on the previous video frame data, the rectangular difference region and the corresponding coordinate information comprises:
and copying the difference rectangular area to a corresponding area of the previous frame of video frame data through the coordinate information and rendering in real time.
8. An apparatus for decompressing frames of a video sequence, comprising:
the first decompression module is used for decompressing the read first frame of video frame data by using an LZ4 algorithm and rendering the decompressed first frame of video frame data in real time when the video file is decompressed and played;
the second decompression module is used for decompressing each frame of video frame data read later and extracting a difference rectangular area and corresponding coordinate information, and the difference rectangular area is determined by comparing front and rear frames of video frame data when the video frame data are compressed;
and the rendering module is used for acquiring corresponding previous frame video frame data in real time and rendering the current video frame data based on the previous frame video frame data, the difference rectangular area and the corresponding coordinate information.
9. An electronic device, comprising:
a memory and one or more processors;
the memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method of decompressing frames of a video sequence as claimed in any one of claims 6 to 7.
10. A storage medium containing computer-executable instructions for performing the method of decompressing frames of a video sequence according to any one of claims 6 to 7 when executed by a computer processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010184103.3A CN111294600A (en) | 2020-03-17 | 2020-03-17 | Compression method, decompression method and device for video sequence frame |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010184103.3A CN111294600A (en) | 2020-03-17 | 2020-03-17 | Compression method, decompression method and device for video sequence frame |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111294600A true CN111294600A (en) | 2020-06-16 |
Family
ID=71028733
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010184103.3A Pending CN111294600A (en) | 2020-03-17 | 2020-03-17 | Compression method, decompression method and device for video sequence frame |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111294600A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111901600A (en) * | 2020-08-06 | 2020-11-06 | 中标慧安信息技术股份有限公司 | Video compression method with low loss |
CN114222131A (en) * | 2021-12-16 | 2022-03-22 | 北京数码视讯技术有限公司 | Low-latency video coding method and device |
CN114363697A (en) * | 2022-01-06 | 2022-04-15 | 上海哔哩哔哩科技有限公司 | Video file generation and playing method and device |
CN117714691A (en) * | 2024-02-05 | 2024-03-15 | 佳木斯大学 | AR augmented reality piano teaching is with self-adaptation transmission system |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1882084A (en) * | 2005-06-14 | 2006-12-20 | 吕殿伟 | Cartoon compression method for wireless network and wireless hand-held apparatus |
CN101656878A (en) * | 2008-08-19 | 2010-02-24 | 新奥特(北京)视频技术有限公司 | Improved method for interframe compression |
CN105898310A (en) * | 2016-04-26 | 2016-08-24 | 广东中星电子有限公司 | Video encoding method and apparatus |
US20160286220A1 (en) * | 2015-03-25 | 2016-09-29 | Samsung Display Co., Ltd. | Method and apparatus for temporal reference coding with light coding systems for display systems |
CN106231214A (en) * | 2016-08-11 | 2016-12-14 | 复旦大学 | High-speed cmos sensor image based on adjustable macro block approximation lossless compression method |
CN107018352A (en) * | 2016-01-27 | 2017-08-04 | 北京中科晶上科技有限公司 | A kind of method of video image processing, apparatus and system |
CN108540799A (en) * | 2018-05-16 | 2018-09-14 | 重庆堂堂网络科技有限公司 | It is a kind of can be with the compression method of difference between one video file two field pictures of Precise Representation |
CN110517215A (en) * | 2019-08-28 | 2019-11-29 | 咪咕视讯科技有限公司 | Video compression processing method, electronic equipment and storage medium |
-
2020
- 2020-03-17 CN CN202010184103.3A patent/CN111294600A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1882084A (en) * | 2005-06-14 | 2006-12-20 | 吕殿伟 | Cartoon compression method for wireless network and wireless hand-held apparatus |
CN101656878A (en) * | 2008-08-19 | 2010-02-24 | 新奥特(北京)视频技术有限公司 | Improved method for interframe compression |
US20160286220A1 (en) * | 2015-03-25 | 2016-09-29 | Samsung Display Co., Ltd. | Method and apparatus for temporal reference coding with light coding systems for display systems |
CN107018352A (en) * | 2016-01-27 | 2017-08-04 | 北京中科晶上科技有限公司 | A kind of method of video image processing, apparatus and system |
CN105898310A (en) * | 2016-04-26 | 2016-08-24 | 广东中星电子有限公司 | Video encoding method and apparatus |
CN106231214A (en) * | 2016-08-11 | 2016-12-14 | 复旦大学 | High-speed cmos sensor image based on adjustable macro block approximation lossless compression method |
CN108540799A (en) * | 2018-05-16 | 2018-09-14 | 重庆堂堂网络科技有限公司 | It is a kind of can be with the compression method of difference between one video file two field pictures of Precise Representation |
CN110517215A (en) * | 2019-08-28 | 2019-11-29 | 咪咕视讯科技有限公司 | Video compression processing method, electronic equipment and storage medium |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111901600A (en) * | 2020-08-06 | 2020-11-06 | 中标慧安信息技术股份有限公司 | Video compression method with low loss |
CN111901600B (en) * | 2020-08-06 | 2021-06-11 | 中标慧安信息技术股份有限公司 | Video compression method with low loss |
CN114222131A (en) * | 2021-12-16 | 2022-03-22 | 北京数码视讯技术有限公司 | Low-latency video coding method and device |
CN114222131B (en) * | 2021-12-16 | 2023-10-27 | 北京数码视讯技术有限公司 | Low-delay video coding method and device |
CN114363697A (en) * | 2022-01-06 | 2022-04-15 | 上海哔哩哔哩科技有限公司 | Video file generation and playing method and device |
CN114363697B (en) * | 2022-01-06 | 2024-04-26 | 上海哔哩哔哩科技有限公司 | Video file generation and playing method and device |
CN117714691A (en) * | 2024-02-05 | 2024-03-15 | 佳木斯大学 | AR augmented reality piano teaching is with self-adaptation transmission system |
CN117714691B (en) * | 2024-02-05 | 2024-04-12 | 佳木斯大学 | AR augmented reality piano teaching is with self-adaptation transmission system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111294600A (en) | Compression method, decompression method and device for video sequence frame | |
WO2020010997A1 (en) | Video frame extraction method and apparatus, computer readable medium, and electronic device | |
EP3410302B1 (en) | Graphic instruction data processing method, apparatus | |
CN109672893A (en) | A kind of video encoding/decoding method, device, equipment and storage medium | |
US20240292009A1 (en) | Method and apparatus for processing video compression, and medium | |
CN116406504A (en) | Method and apparatus for histogram-based and adaptive tone mapping using multiple frames | |
CN112948151A (en) | Program interface image transmission method, substrate management controller and remote control equipment | |
US7580041B1 (en) | Direct storage of compressed scan converted data | |
WO2024140568A1 (en) | Image processing method and apparatus, electronic device, and readable storage medium | |
CN110858388B (en) | Method and device for enhancing video image quality | |
CN112991412B (en) | Liquid crystal instrument sequence frame animation performance optimization method and liquid crystal instrument | |
TW201842775A (en) | Systems and methods for deferred post-processes in video encoding | |
US20240040147A1 (en) | Data processing method and apparatus, computer device, and storage medium | |
CN115225615B (en) | Illusion engine pixel streaming method and device | |
WO2014167609A1 (en) | Information processing device, control method, program, and recording medium | |
CN108668170B (en) | Image information processing method and device, and storage medium | |
CN108668169B (en) | Image information processing method and device, and storage medium | |
EP3806026A1 (en) | Method and apparatus for enhancing video image quality | |
JP2008521362A (en) | Method, apparatus and system for film grain cache partitioning for film grain simulation | |
CN113223100B (en) | Picture compression and decompression processing method | |
CN116170636A (en) | Live video playing method and device, equipment and medium thereof | |
CN114942854A (en) | Screenshot method of GIF (graphic interchange Format) dynamic image and related equipment | |
CN114598912A (en) | Multimedia file display method and device, storage medium and electronic equipment | |
CN114820878A (en) | Image editing method and device | |
CN109429067B (en) | Dynamic picture compression method and device, computer equipment and storage medium |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200616 |