Video compression method and device, electronic equipment and storage medium
By updating the entropy coding model of non-first-line video blocks in the video frame and utilizing the tail information of the previous-line video block, the problem of loss prediction in the coding tree unit coding model is solved, achieving more efficient video compression and reducing resource consumption.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-09
- Publication Date
- 2026-03-31
AI Technical Summary
In existing video compression technologies, there is a slight loss in the prediction of the coding model of the coding tree unit, resulting in low video coding performance.
By updating the entropy coding model of the first video block of a non-first-line video block in a video frame, and utilizing the coding information of the last video block of the previous line, the prediction accuracy of the entropy coding model is improved, and the codewords are updated to achieve more accurate compression.
It improves video encoding performance, reduces resource consumption during video transmission, and results in a smaller compressed bitstream data size.
Smart Images

Figure CN116506645B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of multimedia technology, and in particular to a video compression method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the development of multimedia technology, video can be transmitted over networks. Since video generally contains more data than audio or images, transmitting video directly without compression would consume a large amount of resources. Therefore, video compression has become a key research focus in this field.
[0003] In related technologies, WPP (Wavefront Parallel Processing) is commonly used to encode video in order to achieve video compression. WPP technology performs parallel encoding on a per-line coding tree unit (CTU) basis within a single video frame.
[0004] However, in the above technical solution, since the coding tree unit that is not in the first row can only obtain the coding method information of the coding tree unit located to the right of the first coding tree unit in the current row during the encoding process, the prediction of the coding model of each coding tree unit in the current row will be slightly lost, resulting in low video coding performance. Summary of the Invention
[0005] This disclosure provides a video compression method, apparatus, electronic device, and storage medium, which can improve the prediction accuracy of entropy coding models, making the updated codewords more accurate and concise, thereby resulting in a smaller data volume in the compressed video bitstream. This not only improves video coding performance but also reduces resource consumption during video transmission. The technical solution of this disclosure is as follows:
[0006] According to one aspect of the embodiments of this disclosure, a video compression method is provided, comprising:
[0007] Parallel encoding is performed on multiple video blocks within a video frame to obtain the encoding information of each video block in the video frame, with each video block including multiple video blocks.
[0008] For the i-th row video block in the video frame, based on the encoding information of the tail video block in the (i-1)-th row video block, the entropy coding model of the first video block in the i-th row video block is updated, and the i-th row video block is a non-first row video block in the video frame.
[0009] Based on the updated entropy coding model, update the codewords of multiple video blocks in the i-th row of video blocks;
[0010] Based on the positions of multiple video blocks in the video, the codewords of the multiple video blocks are sorted to obtain the compressed bitstream of the video frame.
[0011] According to another aspect of the embodiments of this disclosure, a video compression apparatus is provided, comprising:
[0012] The first encoding unit is configured to perform parallel encoding of multiple video blocks within a video frame in the video to obtain the encoding information of each video block in the video frame, wherein each video block includes multiple video blocks.
[0013] The update unit is configured to perform, for the i-th row of video blocks in the video frame, update the entropy coding model of the first video block in the i-th row of video blocks based on the coding information of the tail video block in the (i-1)-th row of video blocks, wherein the i-th row of video blocks is a non-first row video block in the video frame;
[0014] The second coding unit is configured to perform codeword updates for multiple video blocks in the i-th row video block based on the updated entropy coding model;
[0015] The sorting unit is configured to sort the codewords of the multiple video blocks based on their positions in the video to obtain the compressed bitstream of the video frame.
[0016] In some embodiments, the updating unit is configured to perform the following operations for the i-th row of video blocks in the video frame: obtaining the entropy coding state of the tail video block in the (i-1)-th row of video blocks based on the coding information of the tail video block in the (i-1)-th row of video blocks, wherein the entropy coding state is used to represent the probability of each codeword appearing when encoding to the tail video block in the (i-1)-th row of video blocks; and updating the entropy coding model of the first video block in the i-th row of video blocks based on the entropy coding state.
[0017] In some embodiments, the second encoding unit includes:
[0018] The encoding subunit is configured to execute an updated entropy coding model based on the first video block in the i-th row of video blocks, and re-encode the first video block in the i-th row of video blocks to obtain the codeword of the first video block;
[0019] The determination subunit is configured to execute codewords based on the first video block to determine the entropy coding state of the first video block;
[0020] The encoding subunit is also configured to perform entropy encoding based on the first video block, and update the codewords of other video blocks in the i-th row of the video block.
[0021] In some embodiments, the coding subunit includes:
[0022] The sub-unit is configured to execute encoding information based on the first video block in the i-th row of video blocks to obtain the encoding partitioning mode of the first video block;
[0023] The encoding subunit is configured to re-encode the first video block based on the encoding partitioning mode and using the updated entropy encoding model of the first video block to obtain the codeword of the first video block.
[0024] In some embodiments, the apparatus further includes:
[0025] The acquisition unit is configured to acquire the compression requirements of the video, the compression requirements including the size and quality of the compressed video;
[0026] The determining unit is configured to perform compression requirements based on the video and determine the encoding partitioning pattern of multiple video blocks in the video.
[0027] In some embodiments, the encoding subunit is configured to perform encoding information based on each video block in the video frame, obtain the quantization difference between the tail video block in the (i-1)th row video block and the first video block in the i-th row video block, the quantization difference being used to represent the difference between the quantization parameters used by the two video blocks during parallel encoding; and re-encode the quantization difference based on the encoding partitioning mode and the updated entropy encoding model of the first video block to obtain the codeword corresponding to the quantization parameters of the first video block.
[0028] In some embodiments, the encoding subunit is further configured to perform the following actions for a non-first video block in the i-th row of video blocks: updating the entropy coding model of the video block based on the entropy coding state of the preceding video block; and re-encoding the video block based on the updated entropy coding model to obtain the codeword of the video block.
[0029] According to another aspect of the present disclosure, an electronic device is provided, the electronic device comprising:
[0030] One or more processors;
[0031] Memory used to store the executable program code of the processor;
[0032] The processor is configured to execute the program code to implement the aforementioned video compression method.
[0033] According to another aspect of the present disclosure, a computer-readable storage medium is provided that, when program code in the computer-readable storage medium is executed by a processor of an electronic device, enables the electronic device to perform the video compression method described above.
[0034] According to another aspect of the present disclosure, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the video compression method described above.
[0035] This disclosure provides a video compression method. When multiple lines of video blocks within a video frame are encoded in parallel, the entropy coding model of the first video block in the current line is updated using the coding information of the tail video block of the previous line. Since the coding information of the tail video block in each line is determined by the coding information of all video blocks preceding it during parallel encoding, meaning the coding information of the tail video block reflects the coding information of all video blocks in that line, the updated entropy coding model can more accurately reflect the probability of codewords appearing in the encoded video blocks. This improves the prediction accuracy of the entropy coding model, making the updated codewords more accurate and concise. Consequently, the compressed video stream occupies less data, improving video coding performance and reducing resource consumption during video transmission.
[0036] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0037] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0038] Figure 1 This is a schematic diagram illustrating the implementation environment of a video compression method according to an exemplary embodiment.
[0039] Figure 2 This is a flowchart illustrating a video compression method according to an exemplary embodiment.
[0040] Figure 3 This is a flowchart illustrating another video compression method according to an exemplary embodiment.
[0041] Figure 4 This is a schematic diagram illustrating parallel encoding based on the principle of wavefront parallel processing technology according to an exemplary embodiment.
[0042] Figure 5 This is a schematic diagram illustrating an update of an entropy coding model according to an exemplary embodiment.
[0043] Figure 6 This is a block diagram illustrating a video compression apparatus according to an exemplary embodiment.
[0044] Figure 7 This is a block diagram illustrating another video compression apparatus according to an exemplary embodiment.
[0045] Figure 8 This is a block diagram illustrating a terminal according to an exemplary embodiment.
[0046] Figure 9 This is a block diagram illustrating a server according to an exemplary embodiment. Detailed Implementation
[0047] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0048] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0049] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the videos involved in this disclosure were all obtained with full authorization.
[0050] An electronic device can be provided as a terminal or a server. When provided as a terminal, the operations performed by the video compression method can be implemented by the terminal. When provided as a server, the operations performed by the video compression method can be implemented by the server. Video can be transmitted between the terminal and the server via a wireless network or a wired network. For either the terminal or the server, before transmitting video, the electronic device can execute the video compression method provided in this disclosure embodiment to compress the video to be transmitted. Then, the electronic device can transmit the compressed video to other devices.
[0051] Figure 1 This is a schematic diagram illustrating an implementation environment for a video compression method according to an exemplary embodiment. Taking an electronic device as an example, see [example description missing]. Figure 1 The implementation environment specifically includes: terminal 101 and server 102.
[0052] Terminal 101 is at least one of the following devices: smartphone, smartwatch, desktop computer, laptop, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), and laptop computer. Terminal 101 has an application installed that supports video transmission. This application can be a video application, a communication application, or a conferencing application, etc., and this embodiment of the disclosure is not limited thereto. Users can log in to the application through terminal 101 to access the services provided by the application. Terminal 101 can connect to server 102 via a wireless network or a wired network, and thus can send video to server 102. Before sending the video, terminal 101 can compress the video to be transmitted.
[0053] Terminal 101 generally refers to one of a plurality of terminals; this embodiment uses terminal 101 as an example. Those skilled in the art will understand that the number of terminals can be more or less. For example, there may be several terminals, or dozens or hundreds of terminals, or even more. This disclosure does not limit the number of terminals or the type of device.
[0054] Server 102 can be at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Server 102 can connect to terminal 101 and other terminals via a wireless or wired network, and can receive video sent by terminal 101. Server 102 can transmit the received video to other devices. Server 102 can also transmit video to terminal 101. Before sending the video, server 102 can compress the video to be transmitted. In some embodiments, the number of servers described above may be more or fewer, and this disclosure does not limit this. Of course, server 102 may also include other functional servers to provide more comprehensive and diversified services.
[0055] Figure 2 This is a flowchart illustrating a video compression method according to an exemplary embodiment, see [link to flowchart]. Figure 2 This video compression method, when applied to a terminal, includes the following steps:
[0056] In step 201, the terminal performs parallel encoding on multiple video blocks within a video frame to obtain the encoding information of each video block in the video frame. Each video block includes multiple video blocks.
[0057] In this embodiment of the disclosure, the video includes multiple video frames. For any given video frame, the terminal can divide the video frame into blocks, obtaining multiple video blocks. Each video block includes multiple video blocks. This embodiment of the disclosure does not limit the number or size of video blocks in a video frame. Then, the terminal performs parallel encoding on the multiple video blocks in the video frame. That is, the terminal can encode multiple video blocks in the video frame simultaneously. During the encoding of any video block, the terminal sequentially performs entropy encoding on each video block of that line. By performing entropy encoding on the video blocks, the terminal can obtain the encoding information of the video blocks. The encoding information of the video blocks can reflect the encoding method and encoding parameters used in the encoding process of the video blocks.
[0058] In step 202, for the i-th row of video blocks in the video frame, the terminal updates the entropy coding model of the first video block in the i-th row of video blocks based on the coding information of the tail video block in the (i-1)-th row of video blocks. The i-th row of video blocks is a non-first row video block in the video frame.
[0059] In this embodiment of the disclosure, after encoding all video blocks in a video frame, the terminal can determine the occurrence of each codeword from the start of encoding the first video block in the video frame to the point when that video block is encoded, based on the encoding information of the video blocks. For video blocks that are not in the first row of the video frame, the terminal can update the entropy coding model of the first video block in the non-first row of video blocks according to the encoding information of the last video block in the previous row of video. That is, the terminal updates the probability distribution of the codewords in the entropy coding model of the first video block in the i-th row of video blocks according to the occurrence of each codeword when encoding the last video block in the (i-1)-th row of video blocks. Here, the last video block is the last video block in the (i-1)-th row of video blocks.
[0060] In step 203, the terminal updates the codewords of multiple video blocks in the i-th row of the video block based on the updated entropy coding model.
[0061] In this embodiment of the disclosure, the terminal updates the codewords of multiple video blocks in the i-th row sequentially based on the updated entropy coding model of the first video block in the i-th row. During the codeword update process, the terminal re-encodes each video block in the i-th row based on the updated entropy coding model of the first video block and the coding information of each video block in the i-th row, to obtain the updated codewords of each video block.
[0062] In step 204, the terminal sorts the codewords of multiple video blocks based on their positions in the video frame to obtain the compressed bitstream of the video frame.
[0063] In this embodiment, the terminal, based on the positions of multiple video blocks within a video frame, can sort the codewords of these video blocks from left to right and from top to bottom to obtain a compressed video stream. The terminal then compresses each video frame separately according to the methods described in steps 201 to 204. The terminal can then transmit the compressed video stream to other electronic devices to achieve the purpose of video transmission.
[0064] This disclosure provides a video compression method. When multiple lines of video blocks within a video frame are encoded in parallel, the entropy coding model of the first video block in the current line is updated using the coding information of the tail video block of the previous line. Since the coding information of the tail video block in each line is determined by the coding information of all video blocks preceding it during parallel encoding, meaning the coding information of the tail video block reflects the coding information of all video blocks in that line, the updated entropy coding model can more accurately reflect the probability of codewords appearing in the encoded video blocks. This improves the prediction accuracy of the entropy coding model, making the updated codewords more accurate and concise. Consequently, the compressed video stream occupies less data, improving video coding performance and reducing resource consumption during video transmission.
[0065] In some embodiments, for the i-th row of video blocks in a video frame, the entropy coding model of the first video block in the i-th row of video blocks is updated based on the coding information of the tail video blocks in the (i-1)-th row of video blocks, including:
[0066] For the i-th row of video blocks in a video frame, based on the encoding information of the tail video blocks in the (i-1)-th row of video blocks, the entropy encoding state of the tail video blocks in the (i-1)-th row of video blocks is obtained. The entropy encoding state is used to represent the probability of each codeword appearing when encoding the tail video blocks in the (i-1)-th row of video blocks.
[0067] Based on the entropy coding state, update the entropy coding model of the first video block in the i-th row of video blocks.
[0068] The solution provided in this disclosure determines the entropy coding state of the tail video block in the previous video block by using the coding information of the tail video block in the previous video block. Since the entropy coding state of the tail video block in the previous video block can reflect the probability of each codeword encoded from the start of encoding to the tail video block, the entropy coding model updated based on the entropy coding state can more accurately reflect the probability of codewords appearing in the encoded video block, thereby improving the prediction accuracy of the entropy coding model and thus improving the video coding performance.
[0069] In some embodiments, based on the updated entropy coding model, the codewords of multiple video blocks in the i-th row video block are updated, including:
[0070] Based on the updated entropy coding model of the first video block in the i-th row of video blocks, the first video block in the i-th row of video blocks is re-encoded to obtain the codeword of the first video block;
[0071] Based on the codewords of the first video block, determine the entropy coding state of the first video block;
[0072] Based on the entropy coding state of the first video block, update the codewords of other video blocks in the i-th row of the video block.
[0073] The solution provided in this embodiment improves the prediction accuracy of the entropy coding model because the updated entropy coding model can more accurately reflect the probability of codewords appearing in the encoded video blocks. Based on the updated entropy coding model, the first video block of the current row is re-encoded, making the updated codewords more accurate and concise. Furthermore, the entropy coding state of the first video block is determined by the updated codewords, and the codewords of subsequent video blocks are updated, making the codewords of other video blocks more accurate and concise. As a result, the compressed video bitstream occupies less data, which not only improves video coding performance but also reduces resource consumption during video transmission.
[0074] In some embodiments, based on the updated entropy coding model of the first video block in the i-th row of video blocks, the first video block in the i-th row of video blocks is re-encoded to obtain the codeword of the first video block, including:
[0075] Based on the encoding information of the first video block in the i-th row of video blocks, obtain the encoding partitioning mode of the first video block;
[0076] Based on the encoding partitioning mode, the updated entropy encoding model of the first video block is used to re-encode the first video block to obtain the codeword of the first video block.
[0077] The solution provided in this embodiment of the present disclosure, since each video block in the video frame has been divided according to its own encoding partitioning method during the parallel encoding process, can directly obtain the encoding partitioning method from the encoding information obtained in the parallel encoding process during the update of the codewords of each video block. There is no need to re-plan the encoding partitioning method of each video block. By updating the codewords of the video block through the determined encoding partitioning method and the updated entropy encoding model, the efficiency of updating the codewords can be improved, and the updated codewords can be made more accurate and concise. As a result, the compressed bitstream of the video occupies a smaller amount of data, which not only improves the video encoding performance, but also reduces the resource consumption during the video transmission process.
[0078] In some embodiments, the process of determining the encoding partitioning pattern of multiple video blocks in a video includes:
[0079] Obtain the video compression requirements, including the size and quality of the compressed video.
[0080] Based on the compression requirements of the video, the encoding partitioning mode of multiple video blocks in the video is determined.
[0081] The solution provided in this disclosure determines the encoding partitioning mode of each video block in a video frame based on the video size and video quality indicated in the video compression requirements, so that the compressed video can meet the compression requirements.
[0082] In some embodiments, based on the encoding partitioning mode, the updated entropy coding model of the first video block is used to re-encode the first video block to obtain the codeword of the first video block, including:
[0083] Based on the encoding information of each video block in the video frame, the quantization difference between the last video block in the (i-1)th row and the first video block in the i-th row is obtained. The quantization difference is used to represent the difference between the quantization parameters used by the two video blocks during the parallel encoding process.
[0084] Based on the encoding partitioning mode and the entropy coding model updated after the first video block, the quantization difference is re-encoded to obtain the codewords corresponding to the quantization parameters of the first video block.
[0085] The solution provided in this embodiment, during the process of updating the codeword of the first video block in the current row, encodes the quantization difference between the first video block and the tail video block in the previous row through the encoding partitioning mode in the encoding information and the updated entropy encoding model. Since the quantization difference is generally smaller than the quantization parameter used by the video block, the codeword corresponding to the quantization parameter of the first video block after encoding is more concise, resulting in a smaller data volume in the compressed video bitstream. This not only improves video encoding performance but also reduces resource consumption during video transmission.
[0086] In some embodiments, based on the entropy coding state of the first video block, updating the codewords of other video blocks in the i-th row of the video block includes:
[0087] For a non-first video block in the i-th row of video blocks, update the entropy coding model of the video block based on the entropy coding state of the previous video block.
[0088] Based on the updated entropy coding model of video blocks, the video blocks are re-encoded to obtain the codewords of the video blocks.
[0089] The solution provided in this disclosure updates the codewords of any non-first video block within a non-first-line video block by using the entropy coding state of the preceding video block to update the entropy coding model of the video block. Since the entropy coding state of the preceding video block reflects the probability of each codeword encoded from the start of encoding to that preceding video block, the updated entropy coding model can more accurately reflect the probability of codewords appearing in the encoded video block, improving the prediction accuracy of the entropy coding model. Based on the updated entropy coding model, the video block is re-encoded, making the updated codewords more accurate and concise. As a result, the compressed video bitstream occupies less data, which not only improves video coding performance but also reduces resource consumption during video transmission.
[0090] The above Figure 2 The diagram shown is merely the basic process of this disclosure. The following section will further elaborate on the solution provided in this disclosure based on a specific implementation method. Figure 3 This is a flowchart illustrating another video compression method according to an exemplary embodiment. Taking an electronic device as an example, see [link to example]. Figure 3 The video compression method includes:
[0091] In step 301, the terminal performs parallel encoding on multiple video blocks within a video frame to obtain the encoding information of each video block in the video frame. Each video block includes multiple video blocks.
[0092] In this embodiment, the video block in a video frame can be a coding tree unit, and this embodiment is not limited thereto. For any video frame in the video, the video frame includes multiple lines of video blocks. The terminal encodes the multiple lines of video blocks in parallel. That is, the terminal can perform multi-threaded processing according to the raster scan order. Each thread processes one line of video blocks from left to right. For the encoding of any video block in a video frame, the terminal can use an entropy coding algorithm, and this embodiment is not limited thereto. The entropy coding algorithm can be Shannon coding, Huffman coding, or arithmetic coding, etc., and this embodiment is not limited thereto.
[0093] In some embodiments, during parallel encoding, the terminal can perform parallel encoding based on the principles of wavefront parallel processing technology. Optionally, the terminal can directly employ wavefront parallel processing technology to perform parallel encoding on multiple video blocks within a video frame. Alternatively, the terminal can only employ the parallel method within wavefront parallel processing technology while disabling the related semantics. This related semantics can be the offset (entry_point_offset) of the codeword of the first video block in each line of video blocks. That is, the terminal uses the parallel method in wavefront parallel processing technology to perform parallel encoding on multiple video blocks within a video frame, but does not record the offset of the codeword of the first video block in each line of video blocks. Therefore, it is unnecessary to encode the offset of each line, which not only improves video compression efficiency but also saves the codewords occupied by the offset, resulting in a smaller data volume in the compressed video stream and reducing resource consumption during video transmission. This disclosure does not limit the specific encoding method used in the parallel encoding process.
[0094] Figure 4 This is a schematic diagram illustrating parallel encoding based on the principle of wavefront parallel processing technology, according to an exemplary embodiment. See also... Figure 4 Let's take encoding the i-th row of video blocks in a video frame as an example. During parallel encoding, for any video block in the video frame, the terminal can entropy encode the video block using an entropy encoding model. When encoding the first video block A in the i-th row, the terminal obtains the entropy encoding state of video block B located at the upper right corner of video block A and initializes the entropy encoding model of video block A. The initialization process involves setting the probability distribution of each codeword in the entropy encoding model of video block A to the probabilities of each codeword indicated by the entropy encoding state of the upper right video block B. Then, the terminal encodes the first video block A using the initialized entropy encoding model. Then, when encoding non-first video blocks in the i-th row, the terminal initializes the entropy encoding model of that video block using the entropy encoding state of the previous video block. Then, the terminal encodes non-first video blocks using the initialized entropy encoding model. Through the above process, the terminal encodes each video block in the i-th row sequentially. Before starting encoding, the terminal can initialize the entropy encoding model. This initialization process refers to setting the probability of each codeword in the entropy coding state of the entropy coding model to 0.
[0095] During the encoding of video blocks in a video frame, the terminal can perform operations such as prediction, transformation, quantization, and encoding on the video blocks according to the compression requirements of the video. The compression requirements can be compression rate, compression size, or compression quality, etc., and this embodiment does not limit these requirements. During the prediction of video blocks, the terminal can use inter-frame prediction or intra-frame prediction methods, and this embodiment does not limit these methods. Different prediction methods have different prediction parameters. Then, the terminal can calculate the residual between the predicted information and the actual information of the video block. Then, the terminal transforms the residual between the predicted information and the actual information so that even if some pixel information is discarded, the quality of the video block can still be maintained. The transformation method can be discrete cosine transform, and this embodiment does not limit this method. Then, the terminal quantizes the transformed video data based on the quantization parameters. Then, the terminal can use entropy coding for encoding to compress the video data. After parallel encoding is completed, the terminal can obtain various information such as the encoding partitioning mode, quantization parameters, transformation parameters, and prediction parameters of each video block according to the above encoding process, and this embodiment does not limit this information.
[0096] In step 302, for the i-th row of video blocks in the video frame, the terminal updates the entropy coding model of the first video block in the i-th row of video blocks based on the coding information of the tail video block in the (i-1)-th row of video blocks. The i-th row of video blocks is a non-first row video block in the video frame.
[0097] In this embodiment of the disclosure, the encoding information of the video block may include codewords obtained during the parallel encoding process. After parallel encoding of all video blocks in a video frame, the terminal can determine the occurrence of each codeword from the start of encoding the first video block in the video frame to the encoding of that video block based on the encoding information of the video blocks. For video blocks that are not in the first row of the video frame, the terminal can update the probability distribution of codewords in the entropy encoding model of the first video block in the non-first row of the video block based on the encoding information of the last video block in the previous row of the video. Accordingly, the process of the terminal updating the entropy encoding model of the first video block in the non-first row of the video block is as follows: For the i-th row of the video block in the video frame, the terminal obtains the entropy encoding state of the last video block in the (i-1)-th row of the video block based on the encoding information of the last video block in the (i-1)-th row of the video block. Then, the terminal updates the entropy encoding model of the first video block in the i-th row of the video block based on the entropy encoding state. Wherein, the entropy encoding state is used to represent the probability of each codeword occurring when encoding the last video block in the (i-1)-th row of the video block. The solution provided in this disclosure determines the entropy coding state of the tail video block in the previous video block by using the coding information of the tail video block in the previous video block. Since the entropy coding state of the tail video block in the previous video block can reflect the probability of each codeword encoded from the start of encoding to the tail video block, the entropy coding model updated based on the entropy coding state can more accurately reflect the probability of codewords appearing in the encoded video block, thereby improving the prediction accuracy of the entropy coding model and thus improving the video coding performance.
[0098] For example, Figure 5 This is a schematic diagram illustrating an update of an entropy coding model according to an exemplary embodiment. See also: Figure 5 Let's take the entropy coding model of the first video block in the i-th row of a video frame as an example. The terminal obtains the coding information of the tail video block C in the (i-1)-th row of the video block. Based on the coding information of the tail video block C, the terminal determines the entropy coding state of the tail video block C. That is, the terminal determines the probability of each codeword appearing when encoding the tail video block C. Then, the terminal sets the probability distribution of each codeword in the entropy coding model of video block A to the probability of each codeword indicated by the entropy coding state of the tail video block C.
[0099] It should be noted that since the entropy coding model of each video block in the first row of a video frame is updated by the entropy coding state of the previous encoded video block, the entropy coding model of each video block can reflect the probability of codewords appearing in the encoded video block, and there is no need to update the upper coding model of the first row of video blocks.
[0100] In step 303, the terminal re-encodes the first video block in the i-th row of video blocks based on the updated entropy coding model of the first video block in the i-th row of video blocks to obtain the codeword of the first video block.
[0101] In this embodiment of the disclosure, after updating the entropy coding model of the first video block in the i-th row of video blocks, the terminal re-encodes the first video block using the updated entropy coding model to update the codewords of the first video block. The solution provided by this embodiment of the disclosure improves the prediction accuracy of the entropy coding model because the updated entropy coding model can more accurately reflect the probability of codeword occurrence in the encoded video block. Based on the updated entropy coding model, re-encoding the first video block of the current row makes the updated codewords more accurate and concise, resulting in a smaller data volume in the compressed video stream. This not only improves video coding performance but also reduces resource consumption during video transmission.
[0102] In some embodiments, since the coding information such as the coding partitioning mode, quantization parameters, transform parameters, and prediction parameters of each video block are determined during parallel coding, the terminal can re-encode the codewords of the video block using at least one of the aforementioned determined coding information during the update of the video block's codewords, without needing to reconfigure. Optionally, the terminal can re-encode the video block based on the coding partitioning mode in the video block's coding information. Accordingly, the terminal obtains the coding partitioning mode of the first video block based on the coding information of the first video block in the i-th row of video blocks. Then, based on the coding partitioning mode, the terminal re-encodes the first video block using the updated entropy coding model of the first video block to obtain the codewords of the first video block. The solution provided in this embodiment of the present disclosure, since each video block in the video frame has been divided according to its own encoding partitioning method during the parallel encoding process, can directly obtain the encoding partitioning method from the encoding information obtained in the parallel encoding process during the update of the codewords of each video block. There is no need to re-plan the encoding partitioning method of each video block. By updating the codewords of the video block through the determined encoding partitioning method and the updated entropy encoding model, the efficiency of updating the codewords can be improved, and the updated codewords can be made more accurate and concise. As a result, the compressed bitstream of the video occupies a smaller amount of data, which not only improves the video encoding performance, but also reduces the resource consumption during the video transmission process.
[0103] The aforementioned encoding partitioning mode can be determined based on the video compression requirements. Accordingly, the process by which the terminal determines the encoding partitioning mode of a video block is as follows: the terminal obtains the video compression requirements, which include the compressed video size and video quality. Then, based on the video compression requirements, the terminal determines the encoding partitioning mode of multiple video blocks in the video. The solution provided in this disclosure determines the encoding partitioning mode of each video block in a video frame by using the video size and video quality indicated in the video compression requirements, ensuring that the compressed video meets the compression requirements.
[0104] In some embodiments, during the re-encoding of any video block in a video frame, the terminal can encode the encoding information such as the encoding partitioning mode, quantization parameters, transform parameters, and prediction parameters of each video block, so that the decoding end can obtain the encoding information and decompress the compressed video based on the encoding information. Optionally, the terminal can encode the quantization parameters of the video block. Accordingly, the process of the terminal re-encoding the first video block based on the encoding partitioning mode and using the updated entropy encoding model of the first video block to obtain the codeword of the first video block includes: the terminal obtaining the quantization difference between the tail video block in the (i-1)th row of video blocks and the first video block in the i-th row of video blocks based on the encoding information of each video block in the video frame. Then, the terminal re-encodes the quantization difference based on the encoding partitioning mode and the updated entropy encoding model of the first video block to obtain the codeword corresponding to the quantization parameters of the first video block. The quantization difference is used to represent the difference between the quantization parameters used by two video blocks during parallel encoding. The solution provided in this embodiment, during the process of updating the codeword of the first video block in the current row, encodes the quantization difference between the first video block and the tail video block in the previous row through the encoding partitioning mode in the encoding information and the updated entropy encoding model. Since the quantization difference is generally smaller than the quantization parameter used by the video block, the codeword corresponding to the quantization parameter of the first video block after encoding is more concise, resulting in a smaller data volume in the compressed video bitstream. This not only improves video encoding performance but also reduces resource consumption during video transmission.
[0105] In step 304, the terminal determines the entropy coding state of the first video block based on the codewords of the first video block. The entropy coding state is used to represent the probability of each codeword appearing when encoding the first video block.
[0106] In this embodiment, after encoding the first video block, the terminal can obtain the codewords of the first video block and the codewords of all video blocks preceding it. Then, the terminal determines the entropy encoding state of the first video block based on the occurrence of each codeword when encoding the first video block. Here, all video blocks preceding the first video block in the i-th row refer to all video blocks from the first row to the (i-1)-th row. The scheme provided in this embodiment determines the entropy encoding state of the first video block using updated codewords, which facilitates updating the codewords of subsequent video blocks, making the codewords of other video blocks more accurate and concise. This results in a smaller data volume in the compressed video stream, improving video encoding performance and reducing resource consumption during video transmission.
[0107] In step 305, the terminal updates the codewords of other video blocks in the i-th row of video blocks based on the entropy coding state of the first video block.
[0108] In this embodiment, the terminal updates the entropy coding model of the second video block in the i-th row of video blocks based on the entropy coding state of the first video block in the i-th row. Then, the terminal re-encodes the second video block in the i-th row using the entropy coding model of the second video block. Next, the terminal determines the entropy coding state of the second video block based on its codewords. Then, the terminal updates the entropy coding model of the third video block in the i-th row using the entropy coding state of the second video block. Then, the terminal re-encodes the third video block in the i-th row using the entropy coding model of the third video block to obtain the third video block. This process continues until the terminal has completed encoding the last video block in the i-th row of video blocks. Correspondingly, the process of the terminal updating the codewords of other video blocks in the i-th row of video blocks includes: for non-first video blocks in the i-th row of video blocks, the terminal updates the entropy coding model of the video block based on the entropy coding state of the preceding video block. Then, the terminal re-encodes the video block based on the updated entropy coding model to obtain the codewords of the video block. The solution provided in this disclosure updates the codewords of any non-first video block within a non-first-line video block by using the entropy coding state of the preceding video block to update the entropy coding model of the video block. Since the entropy coding state of the preceding video block reflects the probability of each codeword encoded from the start of encoding to that preceding video block, the updated entropy coding model can more accurately reflect the probability of codewords appearing in the encoded video block, improving the prediction accuracy of the entropy coding model. Based on the updated entropy coding model, the video block is re-encoded, making the updated codewords more accurate and concise. As a result, the compressed video bitstream occupies less data, which not only improves video coding performance but also reduces resource consumption during video transmission.
[0109] In step 306, the terminal sorts the codewords of multiple video blocks based on their positions in the video frame to obtain the compressed bitstream of the video frame.
[0110] In this embodiment of the disclosure, the sorting method among the codewords of multiple video blocks is not limited. Optionally, the terminal can sort the codewords of multiple video blocks in a video frame from left to right and from top to bottom according to their positions, thereby obtaining the compressed bitstream of the video frame. The terminal uses the video compression method described in steps 301 to 306 above to compress each video frame separately to achieve the purpose of video compression.
[0111] This disclosure provides a video compression method. When multiple lines of video blocks within a video frame are encoded in parallel, the entropy coding model of the first video block in the current line is updated using the coding information of the last video block of the previous line. Since the coding information of the last video block of each line is determined by the coding information of all video blocks preceding it during parallel encoding, meaning the coding information of the last video block of each line reflects the coding information of all video blocks in that line, the updated entropy coding model can more accurately reflect the probability of codewords appearing in the encoded video blocks. This improves the prediction accuracy of the entropy coding model, making the updated codewords more accurate and concise. Consequently, the compressed video stream occupies less data, improving video coding performance and reducing resource consumption during video transmission.
[0112] All of the above-mentioned optional technical solutions can be combined in any way to form optional embodiments of this disclosure, and will not be described in detail here.
[0113] Figure 6 This is a block diagram illustrating a video compression apparatus according to an exemplary embodiment. See also Figure 6 The video compression device includes: a first encoding unit 601, an update unit 602, a second encoding unit 603, and a sorting unit 604.
[0114] The first encoding unit 601 is configured to perform parallel encoding of multiple video blocks within a video frame in the video to obtain the encoding information of each video block in the video frame, wherein each video block includes multiple video blocks.
[0115] The update unit 602 is configured to perform the following operation: for the i-th video block in the video frame, based on the encoding information of the tail video block in the (i-1)-th video block, update the entropy coding model of the first video block in the i-th video block, where the i-th video block is a non-first video block in the video frame.
[0116] The second coding unit 603 is configured to perform codeword updates for multiple video blocks in the i-th row video block based on the updated entropy coding model;
[0117] The sorting unit 604 is configured to sort the codewords of multiple video blocks based on their positions in the video to obtain a compressed bitstream of the video frames.
[0118] This disclosure provides a video compression apparatus that, when performing parallel encoding on multiple lines of video blocks within a video frame, updates the entropy encoding model of the first video block in the current line using the encoding information of the tail video block of the previous line. Since the encoding information of the tail video block in each line is determined by the encoding information of all video blocks preceding it during parallel encoding, meaning the encoding information of the tail video block reflects the encoding information of all video blocks in that line, the updated entropy encoding model can more accurately reflect the probability of codewords appearing in the encoded video blocks. This improves the prediction accuracy of the entropy encoding model, making the updated codewords more accurate and concise. Consequently, the compressed video stream occupies less data, improving video encoding performance and reducing resource consumption during video transmission.
[0119] In some embodiments, Figure 7 This is a block diagram illustrating another video compression apparatus according to an exemplary embodiment, see [link to example diagram]. Figure 7 The update unit 602 is configured to perform the following operations for the i-th row of video blocks in a video frame: based on the encoding information of the tail video block in the (i-1)-th row of video blocks, obtain the entropy coding state of the tail video block in the (i-1)-th row of video blocks. The entropy coding state is used to represent the probability of each codeword appearing when encoding the tail video block in the (i-1)-th row of video blocks. Based on the entropy coding state, update the entropy coding model of the first video block in the i-th row of video blocks.
[0120] In some embodiments, see also Figure 7 The second coding unit 603 includes:
[0121] The encoding subunit 6031 is configured to execute the updated entropy coding model based on the first video block in the i-th row of video blocks, and re-encode the first video block in the i-th row of video blocks to obtain the codeword of the first video block;
[0122] Subunit 6032 is configured to execute codewords based on the first video block to determine the entropy coding state of the first video block;
[0123] The coding subunit 6031 is also configured to perform entropy coding state based on the first video block, updating the codewords of other video blocks in the i-th row of video blocks.
[0124] In some embodiments, see also Figure 7 The coding subunit 6031 includes:
[0125] Sub-unit 60311 is configured to execute encoding information based on the first video block in the i-th row of video blocks, and obtain the encoding partitioning mode of the first video block;
[0126] Encoding subunit 60312 is configured to perform re-encoding of the first video block based on the encoding partitioning mode and using the updated entropy coding model of the first video block to obtain the codeword of the first video block.
[0127] In some embodiments, see also Figure 7 The video compression device also includes:
[0128] The acquisition unit 605 is configured to execute the compression requirements of the acquired video, including the size and quality of the compressed video.
[0129] The determination unit 606 is configured to perform video-based compression requirements and determine the encoding partitioning mode of multiple video blocks in the video.
[0130] In some embodiments, see also Figure 7 The encoding subunit 60312 is configured to perform encoding information based on each video block in the video frame, obtain the quantization difference between the last video block in the (i-1)th row of video blocks and the first video block in the i-th row of video blocks. The quantization difference is used to represent the difference between the quantization parameters used by the two video blocks during parallel encoding. Based on the encoding partitioning mode and the entropy encoding model updated for the first video block, the quantization difference is re-encoded to obtain the codeword corresponding to the quantization parameters of the first video block.
[0131] In some embodiments, see also Figure 7 The encoding subunit 6031 is also configured to perform the following operations for a non-first video block in the i-th row: update the entropy coding model of the video block based on the entropy coding state of the previous video block; and re-encode the video block based on the updated entropy coding model to obtain the codeword of the video block.
[0132] It should be noted that the video compression device provided in the above embodiments is only illustrated by the division of the above functional units when compressing video. In practical applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the electronic device can be divided into different functional units to complete all or part of the functions described above. In addition, the video compression device and the video compression method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0133] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0134] When an electronic device is provided as a terminal, Figure 8 This is a block diagram illustrating a terminal 800 according to an exemplary embodiment. The terminal... Figure 8 A structural block diagram of a terminal 800 provided in an exemplary embodiment of this disclosure is shown. The terminal 800 may be a smartphone, tablet computer, MP3 player, MP4 player, laptop computer, or desktop computer. The terminal 800 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other names.
[0135] Typically, terminal 800 includes a processor 801 and a memory 802.
[0136] Processor 801 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 801 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 801 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 801 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 801 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0137] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 802 are used to store at least one program code, which is executed by the processor 801 to implement the video compression method provided in the method embodiments of this disclosure.
[0138] In some embodiments, the terminal 800 may also optionally include a peripheral device interface 803 and at least one peripheral device. The processor 801, memory 802, and peripheral device interface 803 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 803 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of the following: a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807, a positioning assembly 808, and a power supply 809.
[0139] Peripheral device interface 803 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 801 and memory 802. In some embodiments, processor 801, memory 802 and peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 801, memory 802 and peripheral device interface 803 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0140] The radio frequency (RF) circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 804 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 804 can communicate with other terminals through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 804 may also include circuitry related to NFC (Near Field Communication), which is not limited in this disclosure.
[0141] Display screen 805 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 805 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 801 for processing. In this case, display screen 805 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 805, which serves as the front panel of terminal 800; in other embodiments, there may be at least two display screens, respectively disposed on different surfaces of terminal 800 or in a folded design; in still other embodiments, display screen 805 may be a flexible display screen, disposed on a curved or folded surface of terminal 800. Furthermore, display screen 805 may be configured as a non-rectangular irregular shape, i.e., a non-rectangular screen. Display screen 805 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
[0142] The camera assembly 806 is used to acquire images or videos. Optionally, the camera assembly 806 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 806 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm-light flash and a cool-light flash, which can be used for light compensation at different color temperatures.
[0143] The audio circuit 807 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 801 for processing, or input to the radio frequency circuit 804 to achieve voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each located at a different part of the terminal 800. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert the electrical signals from the processor 801 or the radio frequency circuit 804 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 807 may also include a headphone jack.
[0144] The positioning component 808 is used to determine the current geographic location of the terminal 800 in order to enable navigation or LBS (Location Based Service). The positioning component 808 can be a positioning component based on the US GPS (Global Positioning System), China's BeiDou system, Russia's Granas system, or the European Union's Galileo system.
[0145] Power supply 809 is used to supply power to the various components in terminal 800. Power supply 809 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 809 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0146] In some embodiments, the terminal 800 further includes one or more sensors 810. The one or more sensors 810 include, but are not limited to: an accelerometer 811, a gyroscope 812, a pressure sensor 813, a fingerprint sensor 814, an optical sensor 815, and a proximity sensor 816.
[0147] Accelerometer 811 can detect the magnitude of acceleration on the three coordinate axes of a coordinate system established by terminal 800. For example, accelerometer 811 can be used to detect the components of gravitational acceleration on the three coordinate axes. Processor 801 can control display screen 805 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 811. Accelerometer 811 can also be used for games or for acquiring user motion data.
[0148] The gyroscope sensor 812 can detect the orientation and rotation angle of the terminal 800. The gyroscope sensor 812, in conjunction with the accelerometer sensor 811, can collect 3D motion data from the user on the terminal 800. Based on the data collected by the gyroscope sensor 812, the processor 801 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.
[0149] The pressure sensor 813 can be disposed on the side bezel of the terminal 800 and / or on the lower layer of the display screen 805. When the pressure sensor 813 is disposed on the side bezel of the terminal 800, it can detect the user's grip signal on the terminal 800, and the processor 801 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 813. When the pressure sensor 813 is disposed on the lower layer of the display screen 805, the processor 801 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 805. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0150] The fingerprint sensor 814 is used to collect the user's fingerprint. The processor 801 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 814, or the fingerprint sensor 814 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as trusted, the processor 801 authorizes the user to perform relevant sensitive operations, including unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings. The fingerprint sensor 814 can be located on the front, back, or side of the terminal 800. When the terminal 800 has physical buttons or a manufacturer's logo, the fingerprint sensor 814 can be integrated with the physical buttons or manufacturer's logo.
[0151] An optical sensor 815 is used to collect ambient light intensity. In one embodiment, the processor 801 can control the display brightness of the display screen 805 based on the ambient light intensity collected by the optical sensor 815. Specifically, when the ambient light intensity is high, the display brightness of the display screen 805 is increased; when the ambient light intensity is low, the display brightness of the display screen 805 is decreased. In another embodiment, the processor 801 can also dynamically adjust the shooting parameters of the camera assembly 806 based on the ambient light intensity collected by the optical sensor 815.
[0152] The proximity sensor 816, also known as a distance sensor, is typically located on the front panel of the terminal 800. The proximity sensor 816 is used to detect the distance between the user and the front of the terminal 800. In one embodiment, when the proximity sensor 816 detects that the distance between the user and the front of the terminal 800 is gradually decreasing, the processor 801 controls the display screen 805 to switch from a screen-on state to a screen-off state; when the proximity sensor 816 detects that the distance between the user and the front of the terminal 800 is gradually increasing, the processor 801 controls the display screen 805 to switch from a screen-off state to a screen-on state.
[0153] Those skilled in the art will understand that Figure 8 The structure shown does not constitute a limitation on terminal 800 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0154] When electronic devices are provided as servers, Figure 9 This is a block diagram illustrating a server 900 according to an exemplary embodiment. The server 900 can vary significantly due to differences in configuration or performance. It may include one or more Central Processing Units (CPUs) 901 and one or more memories 902. The memories 902 store at least one line of program code, which is loaded and executed by the processor 901 to implement the video compression methods provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server 900 may also include other components for implementing device functions, which will not be elaborated upon here.
[0155] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 802 or memory 902 including instructions, which can be executed by the processor 801 of the terminal 800 or the processor 901 of the server 900 to complete the video compression method described above. Optionally, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0156] A computer program product includes a computer program / instructions that, when executed by a processor, implement the aforementioned video compression method.
[0157] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0158] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method of video compression, characterized by, The method comprises: using wavefront parallel processing technology, parallel encoding multiple video blocks in a video frame in a video to obtain encoding information of each video block in the video frame, each video block in each row of video blocks comprises multiple video blocks, and the encoding information of each video block comprises code words obtained in the parallel encoding process; for the i-th row of video blocks in the video frame, based on the encoding information of the tail video block in the i-1-th row of video blocks, obtaining an entropy encoding state of the tail video block in the i-1-th row of video blocks, the entropy encoding state is used to represent the probability of each code word appearing when encoding the tail video block in the i-1-th row of video blocks; based on the entropy encoding state, updating an entropy encoding model of the first video block in the i-th row of video blocks, the i-th row of video blocks is a non-first row of video blocks in the video frame; based on the updated entropy encoding model, updating the code words of the multiple video blocks in the i-th row of video blocks; based on the positions of the multiple video blocks in the video frame, sorting the code words of the multiple video blocks to obtain a compressed code stream of the video frame.
2. The video compression method of claim 1, wherein, The method comprises: based on the updated entropy encoding model of the first video block in the i-th row of video blocks, re-encoding the first video block in the i-th row of video blocks to obtain the code words of the first video block; based on the code words of the first video block, determining the entropy encoding state of the first video block; based on the entropy encoding state of the first video block, updating the code words of the other video blocks in the i-th row of video blocks.
3. The video compression method of claim 2, wherein, The method comprises: based on the encoding information of the first video block in the i-th row of video blocks, obtaining the encoding partition mode of the first video block; based on the encoding partition mode, using the updated entropy encoding model of the first video block to re-encode the first video block to obtain the code words of the first video block.
4. The video compression method of claim 3, wherein, The method comprises: obtaining the compression requirement of the video, the compression requirement comprising the size and quality of the compressed video; based on the compression requirement of the video, determining the encoding partition mode of the multiple video blocks in the video.
5. The video compression method of claim 3, wherein, The method comprises: based on the encoding information of each video block in the video frame, obtaining a quantization difference value between the tail video block in the i-1-th row of video blocks and the first video block in the i-th row of video blocks, the quantization difference value is used to represent the difference between the quantization parameters used by the two video blocks in the parallel encoding process; based on the encoding partition mode and the updated entropy encoding model of the first video block, re-encoding the quantization difference value to obtain the code word corresponding to the quantization parameter of the first video block.
6. The video compression method of claim 2, wherein, The updating the codewords of the other video blocks in the i-th row of video blocks based on the entropy coding state of the first video block comprises: For a non-first video block in the i-th row of video blocks, updating an entropy coding model of the video block based on an entropy coding state of a previous video block of the video block; Re-encoding the video block based on the updated entropy coding model of the video block to obtain a codeword of the video block.
7. A video compression apparatus characterized by comprising: The apparatus comprises: A first encoding unit configured to perform parallel encoding of multiple rows of video blocks in a video frame in a video using a wavefront parallel processing technique to obtain encoding information of each video block in the video frame, each row of video blocks comprising multiple video blocks, and each video block's encoding information comprising a codeword obtained in the parallel encoding process; An updating unit configured to perform, for an i-th row of video blocks in the video frame, obtaining an entropy coding state of a tail video block in an (i-1)-th row of video blocks based on the encoding information of the tail video block in the (i-1)-th row of video blocks, the entropy coding state being used to represent a probability of occurrence of each codeword when encoding the tail video block in the (i-1)-th row of video blocks; and updating an entropy coding model of a first video block in the i-th row of video blocks based on the entropy coding state, the i-th row of video blocks being a non-first row of video blocks in the video frame; A second encoding unit configured to perform updating codewords of multiple video blocks in the i-th row of video blocks based on the updated entropy coding model; An ordering unit configured to perform ordering the codewords of the multiple video blocks in the video based on positions of the multiple video blocks in the video to obtain a compressed bitstream of the video frame.
8. An electronic device, comprising: The electronic device comprises: One or more processors; A memory for storing program codes executable by the processors; The processors are configured to execute the program codes to implement the method for video compression according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processors of the electronic device, the electronic device is enabled to perform the method for video compression according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and apparatus for entropy-encoding capable of parallel processing, and method and apparatus for entropy-decoding capable of parallel processing
US20140355690A1