Screen video encoding method, device, computer equipment and storage medium
By judging the overlap of image blocks in screen video encoding and using existing image feature information to determine the hash value, the problem of high complexity in hash value determination is solved, and the encoding complexity and efficiency improvement is achieved.
Patent Information
- Application Number
- CN202111078908.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-15
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2041-09-15
AI Technical Summary
In the prior art, the hash value determination complexity during screen video encoding is high, resulting in an increase in encoding complexity.
Reduce duplicate calculations by determining whether the sub-blocks of the image block to be encoded in the screen content image coincide with the image block with the stored hash value, and directly determine the hash value using the existing image feature information in the case of overlap.
The hash value determination complexity is reduced, thereby reducing the encoding complexity of screen videos and improving encoding efficiency.
Smart Images

Figure CN115811615B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video coding technology, and in particular to a method, apparatus, computer equipment and storage medium for encoding screen videos. Background Art
[0002] Screen video is a video generated based on the screen content image by capturing the screen content of a computer device. The content of screen video is also in many forms, such as slide presentations and text (Word) documents. At present, screen video is widely used in scenarios such as video conferencing, online education, and remote desktops. In these scenarios, screen video needs to be transmitted and encoded before transmission. In order to improve coding efficiency, the HEVC-SCC (High Efficiency Video Coding-Screen Content Coding) video coding standard came into being. In the process of HEVC-SCC encoding, the screen content image in the screen video can be encoded in combination with IBC (Intra Block Copy) technology.
[0003] In related technologies, when encoding based on IBC technology, it is necessary to first establish a hash table corresponding to the current screen content image to be encoded. The hash table stores the hash value of each image block in the screen content image, and then encodes the screen content image in combination with the established hash table.
[0004] In the above scheme, for each image block, it is necessary to determine the image feature information of the image block, and based on the image feature information, determine the hash value of the image block. It can be seen that the determination complexity of the hash value in this scheme is relatively high, resulting in a high encoding complexity of the screen video. Summary of the Invention
[0005] The embodiments of the present application provide a method, apparatus, computer device, and storage medium for encoding screen videos, which are used to reduce the encoding complexity of screen videos. The technical solution is as follows:
[0006] In one aspect, a method for encoding a screen video is provided, the method comprising:
[0007] Determine a first image block in the screen content image for which a hash value is to be determined;
[0008] determining, based on a plurality of first image sub-blocks included in the first image block, whether a second image sub-block overlaps with any of the first image sub-blocks in a second image block of the screen content image, where the second image block is an image block having a corresponding hash value stored in a hash table, the hash table being used to determine a prediction block for the image block to be encoded during an encoding process;
[0009] When there is a second image subblock in the second image block that overlaps with any of the first image subblocks, acquiring image feature information of at least one first image subblock of the first image block from the image feature information of the second image block;
[0010] Based on the image feature information of the at least one first image sub-block, a hash value of the first image block is determined, the hash value of the first image block is stored in the hash table, and the screen content image is encoded based on the hash table of the screen content image.
[0011] In another aspect, a device for encoding a screen video is provided, the device comprising:
[0012] An image block determination module, configured to determine a first image block in the screen content image for which a hash value is to be determined;
[0013] an information determination module, configured to determine, based on a plurality of first image sub-blocks included in the first image block, whether a second image sub-block in a second image block of the screen content image overlaps with any of the first image sub-blocks, where the second image block is an image block for which a corresponding hash value has been stored in a hash table, the hash table being used to determine a prediction block for the image block to be encoded during an encoding process;
[0014] an information acquisition module, configured to acquire, when there exists a second image subblock in the second image block that overlaps with any of the first image subblocks, image feature information of at least one first image subblock of the first image block from the image feature information of the second image block;
[0015] an image encoding module, configured to determine a hash value of the first image block based on image feature information of the at least one image sub-block, store the hash value of the first image block in the hash table, and encode the screen content image based on the hash table of the screen content image.
[0016] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory is used to store at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the screen video encoding method as in the embodiment of the present application.
[0017] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the screen video encoding method as in the embodiment of the present application.
[0018] In another aspect, a computer program product or computer program is provided, the computer program product or computer program including computer program code stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium and executes the computer program code, causing the computer device to perform the screen video encoding method as described in the embodiments of the present application.
[0019] The beneficial effects of the technical solution provided by the embodiments of the present application are:
[0020] In an embodiment of the present application, in the process of establishing a hash table of the screen content image, for multiple first image sub-blocks contained in the first image block whose hash value is currently to be determined, if there is a second image sub-block that overlaps with the first image sub-block in the second image block for which the hash value has been stored, the image feature information previously calculated for the first image sub-block can be directly used to determine the hash value of the first image block, without the need to repeatedly determine the image feature information of the first image sub-block, thereby reducing the complexity of determining the hash value, and further reducing the encoding complexity of the screen video. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0022] Figure 1 1 is a schematic diagram of an implementation environment of a screen video encoding method provided according to an embodiment of the present application;
[0023] Figure 2 This is a flow chart of a method for encoding screen video according to an embodiment of the present application;
[0024] Figure 3 is a schematic diagram of an overlapping area between image blocks provided according to an embodiment of the present application;
[0025] Figure 4 This is a flow chart of a method for encoding screen video according to an embodiment of the present application;
[0026] Figure 5 1 is a schematic diagram of a method for encoding screen video according to an embodiment of the present application;
[0027] Figure 6 1 is a schematic diagram of a method for encoding screen video according to an embodiment of the present application;
[0028] Figure 7 1 is a schematic diagram of a method for encoding screen video according to an embodiment of the present application;
[0029] Figure 8 1 is a schematic structural diagram of a screen video encoding device provided according to an embodiment of the present application;
[0030] Figure 9 is a schematic structural diagram of a terminal provided according to an embodiment of the present application;
[0031] Figure 10 It is a structural diagram of a server provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0033] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on the quantity and execution order.
[0034] In the present application, the term "at least one" means one or more, and the term "plurality" means two or more.
[0035] The screen video encoding method provided in the embodiment of the present application can be executed by a computer device. Optionally, the computer device is provided as a terminal or a server. In the embodiment of the present application, the method provided in the embodiment of the present application can be implemented by a server or a terminal as the execution subject, or the method provided in the embodiment of the present application can be implemented through interaction between a terminal and a server, which is not limited by the embodiment of the present application.
[0036] The following describes the implementation environment of the screen video encoding method provided by the embodiment of the present application. Figure 1 Schematic diagram of an implementation environment of a screen video encoding method provided in accordance with an embodiment of the present application. Figure 1 , the implementation environment includes a first terminal 101, a server 102 and a second terminal 103.
[0037] Optionally, the first terminal 101 and the second terminal 103 are, but are not limited to, smartphones, tablet computers, laptop computers, desktop computers, smart speakers, or smart watches. Both the first terminal 101 and the second terminal 102 have a target application installed and running. The target application has functions such as video encoding, video decoding, and video playback. For example, the target application can be a video conferencing application, an online education application, a remote desktop application, or any other application that supports the aforementioned functions.
[0038] Optionally, the server 102 is used to provide background services for the target application. The server 102 is an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The server 102 can be directly or indirectly connected to the first terminal 101 and the second terminal 103 respectively through wired or wireless communication, and this application does not limit this. Optionally, taking the interaction between the first terminal 101 and the server 102 as an example, the server 102 can undertake the main computing work, and the first terminal 101 can undertake the secondary computing work; or, the server 102 undertakes the secondary computing work, and the first terminal 101 undertakes the main computing work; or, the server 102 and the first terminal 101 adopt a distributed computing architecture for collaborative computing.
[0039] In an embodiment of the present application, the first terminal 101 can share the screen image with the second terminal 103 in the form of a video, so that the second terminal 103 can display the screen image and play the video. In some embodiments, the first terminal 101 is equivalent to the encoding end, and the second terminal 103 is equivalent to the decoding end. The first terminal 101 captures the screen content image of the local terminal to obtain the screen image, encodes the captured screen content image to obtain a screen video, and the first terminal 101 uploads the screen video to the server 102. The server 102 forwards the screen video to the second terminal 103. The second terminal 103 decodes the screen video and plays the video based on the image obtained by decoding.
[0040] In other embodiments, terminal 101 is encoded with the help of server 102. In this case, server 102 acts as the encoding end, and second terminal 103 acts as the decoding end. First terminal 101 uploads the captured screen content image to server 102. Server 102 encodes the screen content image to obtain a screen video, which is then forwarded to second terminal 103. Second terminal 103 decodes the screen video and plays the video based on the decoded image.
[0041] Those skilled in the art will appreciate that the number of the first and second terminals can be greater or lesser. For example, there can be only one first or second terminal, or there can be dozens, hundreds, or even more of the first or second terminals. The embodiments of this application do not limit the number or device types of the first and second terminals.
[0042] After introducing the implementation environment of the embodiment of the present application, the application scenario of the embodiment of the present application will be introduced in combination with the above-mentioned implementation environment. In the following description, terminal A is the first terminal 101 in the above-mentioned implementation environment, terminal B is the second terminal 103 in the above-mentioned implementation environment, and the server is the server 102 in the above-mentioned implementation environment.
[0043] The screen video encoding method provided in the embodiments of the present application can be applied in video encoding scenarios. For example, in a video conferencing scenario, terminal A and terminal B participate in a video conference. Terminal A captures a screen content image and encodes the screen content image using the screen video encoding method provided in the embodiments of the present application to obtain a screen video. Terminal A forwards the screen video to terminal B via a server, and terminal B plays the video based on the decoded image, thereby enabling users of terminal A and terminal B to conduct a video conference.
[0044] For another example, in an online education scenario, a teacher uses terminal A to provide online education to students in the form of PPT (PowerPoint) or desktop video. Terminal A captures an image of the screen content and encodes the image using the screen video encoding method provided in an embodiment of the present application to obtain a screen video. Terminal A, with the help of a server, forwards the screen video to terminal B used by the student. Terminal B plays the video based on the decoded image, thereby enabling the teacher using terminal A and the student using terminal B to conduct online education.
[0045] For example, taking the remote desktop scenario as an example, terminal A captures the screen content image and encodes the screen content image through the screen video encoding method provided in the embodiment of the present application to obtain a screen video. Terminal A uses the server to forward the screen video to terminal B used by the user. Terminal B plays the video based on the image obtained by decoding, so that the user using terminal B can remotely see the screen image of terminal A and then remotely operate terminal A.
[0046] It should be noted that the above scenarios are only exemplary and do not limit the video encoding scenarios. In addition to being applied to the above scenarios, this application can also be applied to any other video encoding scenarios, such as video calls, video sharing, or video website browsing.
[0047] After introducing the implementation environment and application scenarios of the embodiments of the present application, the encoding method of the screen video provided by the embodiments of the present application is introduced below. Figure 2 This is a flow chart of a method for encoding screen video according to an embodiment of the present application, see Figure 2 , taking the execution subject as the terminal as an example, the method includes:
[0048] 201. The terminal determines a first image block in a screen content image whose hash value is to be determined.
[0049] The screen content image is obtained by capturing the terminal's own screen content. After obtaining the screen content image, the terminal encodes the screen content image. The screen content image includes multiple image blocks. In some embodiments, the terminal refers to an image block for which a hash value has not been determined as a first image block, and an image block for which a hash value has been determined as a second image block. Each image block includes multiple pixels, and each image block has the same size.
[0050] In some embodiments, the terminal determines multiple image blocks in the screen content image in a sliding window manner. Optionally, the terminal slides the window in a left-to-right and top-to-bottom order to obtain multiple image blocks. The step size of each window slide is one pixel. The size of the window determines the size of the image block. The size of the image block can be set as needed and is not limited in this application. For example, the size of the image block is 4×4, 8×8, 16×16, 32×32, or 64×64, etc.
[0051] 202. The terminal determines, based on multiple first image sub-blocks included in the first image block, whether there is a second image sub-block in the second image block of the screen content image that overlaps with any of the first image sub-blocks, where the second image block is an image block for which a corresponding hash value has been stored in a hash table, and the hash table is used to determine a prediction block for the image block to be encoded during the encoding process.
[0052] In an embodiment of the present application, before encoding the screen content image, the terminal first creates a hash table corresponding to the screen content image. The hash table stores hash values of multiple image blocks in the screen content image. The image feature information of each image block is determined based on the multiple pixels included in the image block.
[0053] In an embodiment of the present application, there may be an overlapping area between the first image block and the second image block. When the overlapping area includes the first image sub-block in the first image block, it indicates that there is a second image sub-block in the second image block that overlaps with the first image sub-block.
[0054] For example, see Figure 3 The first image block and the second image block each include four image sub-blocks. There are overlapping image sub-blocks between the first image block and the second image block. The overlapping image sub-block is located in the upper left corner of the first image block. At the same time, the overlapping image sub-block is located in the lower right corner of the second image block.
[0055] 203. When the second image subblock exists in the second image block, the terminal obtains image feature information of at least one first image subblock of the first image block from the image feature information of the second image block.
[0056] In which, when the second image block includes a second image sub-block that overlaps with any first image sub-block, since the image feature information of the second image sub-block has been determined in the process of determining the hash value of the second image block, when determining the hash value of the first image block, the terminal can obtain the image feature information of the first image sub-block that overlaps with the second image sub-block from the stored image feature information of the second image sub-block.
[0057] 204. The terminal determines a hash value of the first image block based on the image feature information of the at least one image sub-block, stores the hash value of the first image block in the hash table, and encodes the screen content image based on the hash table of the screen content image.
[0058] The hash value of each image block is determined based on the image feature information of the multiple image sub-blocks included in the image block. Optionally, in the process of determining the hash value of each image block, the terminal stores the image feature information of each image sub-block after determining the image feature information of the image sub-block, so that it can be reused in the subsequent process of determining the hash values of other image blocks. It can be seen that in this embodiment of the present application, after determining the image feature information of the image sub-blocks included in an image block, the terminal immediately determines the hash value of the image block, thereby improving the efficiency of determining the hash value.
[0059] In some embodiments, after the terminal stores the hash value of each image block in the screen content image in the hash table, it begins to encode the screen content image. It should be noted that the terminal can encode the screen content image only after obtaining multiple frames of screen content images, or the terminal can encode the screen content image when obtaining a single frame of screen content image, and this embodiment of the present application is not limited to this.
[0060] In an embodiment of the present application, in the process of establishing a hash table of the screen content image, for multiple first image sub-blocks contained in the first image block whose hash value is currently to be determined, if there is a second image sub-block that overlaps with the first image sub-block in the second image block for which the hash value has been stored, the image feature information previously calculated for the first image sub-block can be directly used to determine the hash value of the first image block, without the need to repeatedly determine the image feature information of the first image sub-block, thereby reducing the complexity of determining the hash value, and further reducing the encoding complexity of the screen video.
[0061] Figure 4 This is a flow chart of a method for encoding screen video according to an embodiment of the present application, see Figure 4 In the embodiment of the present application, the method of encoding a screen video by a terminal is described as an example, and includes:
[0062] 401. The terminal determines a first image block in a screen content image whose hash value is to be determined.
[0063] In the process of establishing the hash table, a hash value needs to be determined for each image block in the screen content image. Optionally, after the terminal determines an image block in a sliding window manner, it performs the step of calculating the hash value of the image block.
[0064] 402. The terminal determines a label corresponding to each first image sub-block included in the first image block, where the label is used to indicate whether image feature information of the first image sub-block has been stored.
[0065] In an embodiment of the present application, the terminal determines the image feature information of each image sub-block based on the multiple pixels included in the image sub-block and stores the image feature information of the image sub-block. Accordingly, the terminal sets a label for each image sub-block. In some embodiments, the terminal sets a label for the image sub-block for which image feature information has been stored, so that it can subsequently determine whether the image feature information of the image sub-block has been stored based on the label. In other words, the image feature information of the image sub-block with the label set has been stored, while the image feature information of the image sub-block without the label set has not been stored.
[0066] In other embodiments, when dividing the image sub-block, the terminal sets a label for the image sub-block, and the label set at this time indicates that the image feature information of the image sub-block is not stored; after the image feature information of the image sub-block is stored, the label of the image sub-block is updated, and the updated label indicates that the image feature information of the image sub-block has been stored.
[0067] Among them, since the position of each image sub-block in the screen content image is unique, the terminal can use the coordinates as the identifier of the image sub-block to store the label of the image sub-block. Alternatively, the terminal can set a number for each image sub-block and use the number as the identifier of the image sub-block to store the label of the image sub-block. It should be noted that the representation form of the label can be set as needed, and this application does not limit this. For example, the label is 1 or 0, 1 indicates that the image feature information of the image sub-block has been stored, and 0 indicates that the image feature information of the image sub-block has not been stored. In addition, the representation form of the number can also be set as needed, and this application does not limit this. For example, the number is a number in the form of 1, 2, 3 or 4.
[0068] In some embodiments, the terminal stores the correspondence between the coordinates or numbers of the image sub-blocks and the labels of the image sub-blocks in the form of a label array. Accordingly, the implementation method of step 402 includes: the terminal determines the label corresponding to each of the first image sub-blocks from the label array corresponding to the screen content image. The label array is used to store the labels of the image sub-blocks contained in the screen content image. Accordingly, the terminal uses the coordinates of the first image sub-block in the screen content image as an index, and searches the label array for the label corresponding to the coordinates according to the index. Alternatively, the terminal uses the number of the first image sub-block as an index, and searches the label array for the label corresponding to the number according to the index. In an embodiment of the present application, the labels of the image sub-blocks are stored in the form of a label array to record whether the image feature information of the image sub-block has been stored, thereby improving the orderliness of the label storage and facilitating the search of labels.
[0069] 403. When the label matches the target label, the terminal determines that a second image subblock that overlaps with the first image subblock exists in the second image block.
[0070] The second image block is an image block for which a corresponding hash value has been stored in a hash table, and the hash table is used to determine a prediction block for the image block to be encoded during the encoding process. The target label indicates that image feature information of the corresponding image sub-block has been stored. In some embodiments, when the label of the first image sub-block matches the target label, it means that the terminal has determined and stored the image feature information of the first image sub-block in the process of determining the hash value of the second image block, that is, there is a second image sub-block in the second image block that overlaps with the first image sub-block.
[0071] In other embodiments, when the label does not match the target label, the terminal determines that there is no second image subblock in the second image block that overlaps with the first image subblock. The label does not match the target label, indicating that the terminal has not yet determined the image feature information of the first image subblock before determining the hash value of the first image block, that is, there is no second image subblock in the second image block that overlaps with the first image subblock.
[0072] In an embodiment of the present application, since the label corresponding to the image sub-block indicates whether the image feature information of the image sub-block has been stored, by combining whether the label matches the target label, it is determined whether the second image block includes a second image sub-block that overlaps with the first image sub-block, thereby improving the accuracy of the judgment result.
[0073] 404. When the second image subblock exists in the second image block, the terminal obtains image feature information of at least one first image subblock of the first image block from the image feature information of the second image block.
[0074] Among them, for each image sub-block, the terminal stores the coordinates or number of the image sub-block in correspondence with the image feature information of the image sub-block. Optionally, the terminal obtains the image feature information of at least one first image sub-block of the first image block from the image feature information of the second image block. The implementation method includes: the terminal obtains the image feature information corresponding to the coordinates or number of each first image sub-block from the image feature information of the image sub-block of the second image block.
[0075] In some embodiments, for the multiple first image sub-blocks included in the first image block, the terminal sequentially performs the operations of steps 402-404. The order of obtaining the image feature information of the multiple first image sub-blocks can be set as needed, and this application does not limit this. For example, the order can be from left to right or from top to bottom. Alternatively, the terminal simultaneously performs the operations of steps 402-404 for the multiple first image sub-blocks, and this embodiment of the application does not limit this.
[0076] In other embodiments, since hash calculations are usually performed in a certain order, image sub-blocks that are closer to existing image blocks in the hash table are more likely to have stored image feature information than image sub-blocks that are farther away. Based on this, the terminal can first filter out a portion of the first image sub-blocks based on the position. That is, the screen video encoding method provided in the embodiment of the present application also includes the following steps: the terminal selects a target number of first image sub-blocks whose positions meet the conditions from the multiple first image sub-blocks contained in the first image block, and for each of the first image sub-blocks, performs the operations of steps 402 to 404 in sequence.
[0077] The condition is that the first image sub-block is closest to the image block for which the hash value is stored. Optionally, the terminal selects a target number of first image sub-blocks ranked near the top of the distance ranking from the multiple first image sub-blocks of the first image block. The target number can be set as needed and is not limited in this embodiment of the present application. For example, the target number is 2, 3, or 4.
[0078] In an embodiment of the present application, since multiple first image sub-blocks are screened according to the positions of the first image sub-blocks, the terminal can obtain the stored image feature information based on the screened first image sub-blocks, thereby saving operation steps and improving the efficiency of obtaining image feature information.
[0079] 405. The terminal determines a fourth image subblock excluding the third image subblock from the multiple first image subblocks of the first image block, where the third image subblock is an image subblock for which image feature information has been obtained, and the fourth image subblock is an image subblock for which image feature information has not been obtained.
[0080] Wherein, the first image block and the second image block do not completely overlap, then in addition to the image sub-block for which image feature information has been obtained, that is, the third image sub-block, the multiple first image sub-blocks of the first image block also include at least one fourth image sub-block. For example, continue to refer to Figure 3 , the second image subblock located at the lower right corner of the second image block overlaps with the first image subblock located at the upper left corner of the first image block, then the overlapping first image subblock is also the third image subblock, and the fourth image subblock in the first image block is the first image subblock located at the upper right corner, lower left corner, and lower right corner.
[0081] 406. The terminal determines image feature information of the fourth image sub-block based on multiple pixels included in the fourth image sub-block.
[0082] In some embodiments, for each fourth image sub-block, the implementation of step 406 includes: the terminal determines the average pixel value and pixel gradient value of multiple pixels included in the fourth image sub-block to obtain image feature information of the fourth image sub-block.
[0083] The pixel gradient value is the average of the horizontal pixel gradient value in the horizontal direction and the vertical pixel gradient value in the vertical direction. In the embodiment of the present application, since the pixel value of a pixel point can reflect the image characteristics of an image sub-block, the image characteristic information of the image sub-block is determined based on the average pixel value and pixel gradient value of multiple pixels, making the determined image characteristic information more accurate.
[0084] 407. The terminal determines a hash value of the first image block based on the image feature information of the multiple first image sub-blocks.
[0085] Among them, the data type of the hash value of the image block can be set as needed, and the embodiments of the present application do not limit this. For example, the data type of the hash value is integer. In some embodiments, the terminal processes the image feature information of multiple first image sub-blocks, and composes the processed image feature information into the hash value of the first image block. Accordingly, the implementation method of step 406 includes: the terminal uses the data of the first first target number of bits of the average pixel value of each first image sub-block as the first hash value to obtain multiple first hash values; determines the average pixel gradient value of the multiple first image sub-blocks; uses the data of the first second target number of bits of the average pixel gradient value as the second hash value; and according to the position of each first image sub-block in the first image block, composes the hash value of the first image block with the multiple first hash values and the second hash value.
[0086] The first target number of bits and the second target number of bits can be set as needed, and this application does not limit this. For example, if the data length of the average pixel value is 8 bits and the first target number of bits is 3, the terminal takes the first 3 bits of the average pixel value of each first image sub-block as the first hash value. For another example, if the data length of the average pixel gradient value is 16 bits and the second target number of bits is 4, the terminal takes the first 4 bits of the average pixel gradient value as the second hash value.
[0087] For example, the hash value of the first image block is a 16-bit integer data. Figure 5 The size of the first image block is 8×8, that is, the first image block includes 64 pixels. The first image block is divided into four first image sub-blocks of size 4×4, and the four first image sub-blocks are marked with serial numbers 0, 1, 2, and 3 respectively. The average pixel value of the four first image sub-blocks is determined in sequence (data length is 8 bits), see Formula 1, and the first 3 bits of data are taken as the first hash value. The pixel gradient value (grad) of each first image sub-block is determined, and the pixel gradient values of the four first image sub-blocks are averaged to obtain the average pixel gradient value of the four first image sub-blocks. See Formula 2, and the first 4 bits of data are taken as the second hash value. Referring to Formula 3, the average pixel value (a total of 12 bits of data) and the average pixel gradient value (a total of 4 bits of data) of the four first image sub-blocks are combined, that is, multiple first hash values and second hash values are combined to obtain 16 bits of data, which is the hash value (hash) of the first image block.
[0088] Formula 1: avg′ i =(avg i >>5)&0×7,i=0,1,2,3
[0089] Formula 2:
[0090] Formula 3:
[0091] Among them, avg i is the average pixel value of the four first image sub-blocks, avg′ i is the first hash value obtained after taking the first 3 bits of data, >> represents right shift, & represents logical AND, grad i is the pixel gradient value of the first image sub-block, grad is the second hash value obtained by taking the first 4 bits of the average pixel gradient value of the 4 first image sub-blocks, << indicates a left shift, avg″0 is the hash value obtained by shifting the first hash value of the first image sub-block with sequence number 0 left by 13 bits, avg″1 is the hash value obtained by shifting the first hash value of the first image sub-block with sequence number 1 left by 10 bits, avg″2 is the hash value obtained by shifting the first hash value of the first image sub-block with sequence number 2 left by 7 bits, avg″3 is the hash value obtained by shifting the first hash value of the first image sub-block with sequence number 3 left by 4 bits, and hashIdx is the hash value of the first image block.
[0092] In an embodiment of the present application, for the first image sub-block whose image feature information has been determined, its image feature information is directly obtained, and for the first image sub-block whose image feature information has not been determined, its image feature information is determined based on the pixel values of the pixels included therein, thereby realizing the determination of the hash value of the first image block, thereby reducing the complexity of determining the hash value.
[0093] 408. The terminal stores the hash value of the first image block in the hash table.
[0094] In some embodiments, when the overlapping area between the first image block and the second image block does not include the first image sub-block in the first image block, the terminal needs to calculate the image feature information of each first image sub-block in the first image block. Accordingly, the screen video encoding method provided in the embodiment of the present application also includes the following steps: when the terminal does not have a second image sub-block that overlaps with any first image sub-block in the second image block, for multiple first image sub-blocks contained in the first image block, based on multiple pixel points included in each of the first image sub-blocks, determine the image feature information of the first image sub-block.
[0095] The implementation manner in which the terminal determines the image feature information of the first image sub-block based on the multiple pixels included in each first image sub-block is similar to the implementation manner in step 406 and is not repeated here.
[0096] Optionally, after determining the image feature information of each first image sub-block, the terminal stores the image feature information of each first image sub-block. In this embodiment of the present application, by storing the image feature information of each first image sub-block, when subsequently determining the hash value of other image blocks, the image feature information of these first image sub-blocks can be directly obtained, thereby providing data support for determining the hash value.
[0097] In the embodiment of the present application, taking into account the high complexity of the hash value determination process, in the process of determining the hash value based on the image feature information of the image sub-block, there may be overlapping image sub-blocks between each image block and other image blocks, and each time the hash value of an image block is determined, it is necessary to calculate the image feature information of each image sub-block included in the image block, then it is necessary to calculate the image feature information of a large number of repeated image sub-blocks, resulting in computational redundancy. Therefore, by storing the image feature information of the image sub-block that has been determined, it can be reused when the image feature information of the image sub-block is subsequently determined, thereby avoiding repeated calculation operations and saving the complexity of determining the hash value.
[0098] 409. The terminal encodes the screen content image based on the hash table of the screen content image.
[0099] Among them, screen video is usually generated by multiple frames of screen content images. Since there are a large number of repeated textures in screen video, such as the same text appearing multiple times in a frame of screen content image, the intra-frame prediction method provided by IBC technology can efficiently predict the screen content image, thereby improving the encoding quality. Optionally, the implementation method of step 409 includes: the terminal determines, based on the hash table, a prediction block in the screen content image that matches the image block to be encoded, the prediction block is an encoded image block of the screen content image, and the hash value of the image block to be encoded is the same as the hash value of the prediction block; based on the prediction block, the image block to be encoded is encoded.
[0100] In which, the number of image blocks in the hash table that have the same hash value as the image block to be encoded may be one or more. Accordingly, the implementation method of the terminal determining the prediction block that matches the image block to be encoded in the screen content image based on the hash table includes: the terminal determines the hash value of the image block to be encoded, and the hash value is determined based on multiple pixels included in the image block to be encoded; based on the hash value, selects at least one image block with the same hash value from the hash table; and determines a prediction block from the at least one image block, where the image similarity between the prediction block and the image block to be encoded is higher than a similarity threshold.
[0101] Among them, the similarity threshold can be set as needed, and this application does not limit this. The implementation method for the terminal to determine the similarity between the image block to be encoded and the prediction block includes: the terminal uses the residual of the pixel values of the pixels at corresponding positions between the image block to be encoded and the prediction block as the similarity. It should be noted that the implementation method for the terminal to determine the hash value of the image block to be encoded is the same as the implementation method for determining the hash value of the first image block mentioned above, and will not be repeated here.
[0102] It should be noted that, when the number of prediction blocks determined is multiple, the terminal uses the prediction block closest to the image block to be encoded as the final prediction block, and then encodes the image block to be encoded based on the final prediction block. The distance between two image blocks can be represented by BV (Block Vector). For example, see Figure 6 For the current CU (Coding Unit), that is, the image block to be encoded, the terminal searches for the encoded image blocks in the current frame (screen content image) and uses the image block that is most similar to and closest to the current CU as the prediction block of the current CU.
[0103] In the embodiment of the present application, since the prediction block is an image block that has been encoded, the encoding accuracy can be improved by encoding the image block to be encoded in combination with the prediction block.
[0104] For example, see Figure 7 The terminal determines the hash value of each image block in turn, stores the hash value of the image block in a hash table, and obtains the predicted block based on the hash table during encoding. In an embodiment of the present application, a hash search-based method is provided for fast intra-frame search, and the hash value determination complexity of this method is low.
[0105] In an embodiment of the present application, in the process of establishing a hash table of the screen content image, for multiple first image sub-blocks contained in the first image block whose hash value is currently to be determined, if there is a second image sub-block that overlaps with the first image sub-block in the second image block for which the hash value has been stored, the image feature information previously calculated for the first image sub-block can be directly used to determine the hash value of the first image block, without the need to repeatedly determine the image feature information of the first image sub-block, thereby reducing the complexity of determining the hash value, and further reducing the encoding complexity of the screen video.
[0106] Figure 8 Schematic diagram of a screen video encoding device according to an embodiment of the present application. Figure 8 The device includes: an image block determination module 801, an information determination module 802, an information acquisition module 803 and an image encoding module 804.
[0107] An image block determining module 801 is configured to determine a first image block in a screen content image for which a hash value is to be determined;
[0108] An information determination module 802 is configured to determine, based on multiple first image sub-blocks included in the first image block, whether a second image sub-block in a second image block of the screen content image overlaps with any of the first image sub-blocks, where the second image block is an image block for which a corresponding hash value has been stored in a hash table, the hash table being used to determine a prediction block for the image block to be encoded during the encoding process;
[0109] an information acquisition module 803 configured to acquire, when there exists in the second image block a second image subblock that overlaps with any of the first image subblocks, image feature information of at least one first image subblock of the first image block from the image feature information of the second image block;
[0110] The image encoding module 804 is used to determine the hash value of the first image block based on the image feature information of the at least one image sub-block, store the hash value of the first image block in the hash table, and encode the screen content image based on the hash table of the screen content image.
[0111] In one possible implementation, the information determination module 802 includes:
[0112] a label determination unit, configured to determine a label corresponding to each first image sub-block contained in the first image block, the label being used to indicate whether image feature information of the first image sub-block has been stored;
[0113] an information determining unit, configured to determine, when the label matches a target label, that a second image subblock that overlaps with the first image subblock exists in the second image block, and the target label indicates that image feature information of the corresponding image subblock has been stored;
[0114] In a case where the label does not match the target label, it is determined that no second image subblock that overlaps with the first image subblock exists in the second image block.
[0115] In one possible implementation, the label determination unit is configured to determine a label corresponding to each of the first image sub-blocks from a label array corresponding to the screen content image, where the label array is configured to store labels of the image sub-blocks included in the screen content image.
[0116] In one possible implementation, the device further includes:
[0117] a sub-block selection module, configured to select a target number of first image sub-blocks whose positions meet a condition from a plurality of first image sub-blocks included in the first image block;
[0118] The information acquisition module 802 is configured to determine, for each of the first image sub-blocks, in turn whether there is a second image sub-block in the second image block of the screen content image that overlaps with any of the first image sub-blocks, where the condition is that the distance between the first image sub-block and the image block for which the hash value is stored is the shortest.
[0119] In one possible implementation, the hash value determination module 803 includes:
[0120] a sub-block determining unit, configured to determine, from the plurality of first image sub-blocks of the first image block, a fourth image sub-block excluding the third image sub-block, the third image sub-block being the first image sub-block for which image feature information has been acquired, and the fourth image sub-block being the first image sub-block for which image feature information has not been acquired;
[0121] an information determining unit, configured to determine image feature information of the fourth image sub-block based on a plurality of pixels included in the fourth image sub-block;
[0122] The hash value determining unit is configured to determine a hash value of the first image block based on the image feature information of the plurality of first image sub-blocks.
[0123] In one possible implementation, the information determination unit is used to determine the average pixel value and pixel gradient value of the multiple pixel points included in the fourth image sub-block to obtain image feature information of the fourth image sub-block, where the pixel gradient value is the average of the horizontal pixel gradient value in the horizontal direction and the vertical pixel gradient value in the vertical direction.
[0124] In one possible implementation, the device further includes:
[0125] The information determination module is further configured to determine, for multiple first image subblocks included in the first image block, image feature information of the first image subblock based on multiple pixels included in each of the first image subblocks, when there is no second image subblock in the second image block that overlaps with any of the first image subblocks.
[0126] In one possible implementation, the device further includes:
[0127] The information storage module is used to store the image feature information of each first image sub-block.
[0128] In one possible implementation, the image encoding module 804 is used to determine, based on the hash table, a prediction block that matches the image block to be encoded in the screen content image, where the prediction block is an encoded image block of the screen content image, and the hash value of the image block to be encoded is the same as the hash value of the prediction block; and encode the image block to be encoded based on the prediction block.
[0129] In an embodiment of the present application, in the process of establishing a hash table of the screen content image, for multiple first image sub-blocks contained in the first image block whose hash value is currently to be determined, if there is a second image sub-block that overlaps with the first image sub-block in the second image block for which the hash value has been stored, the image feature information previously calculated for the first image sub-block can be directly used to determine the hash value of the first image block, without the need to repeatedly determine the image feature information of the first image sub-block, thereby reducing the complexity of determining the hash value, and further reducing the encoding complexity of the screen video.
[0130] It should be noted that the screen video encoding device provided in the above embodiment only uses the division of the above functional modules as an example to illustrate when encoding the screen content image. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the screen video encoding device provided in the above embodiment and the screen video encoding method embodiment are of the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0131] In some embodiments, the computer device is configured as a terminal, Figure 9 The figure is a schematic diagram of the structure of a terminal 900 according to an embodiment of the present application. The terminal 900 can be a portable mobile terminal, such as a smartphone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer, or a desktop computer. The terminal 900 may also be referred to as a user equipment, a portable terminal, a laptop terminal, a desktop terminal, or other similar names.
[0132] Typically, the terminal 900 includes a processor 901 and a memory 902 .
[0133] The processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0134] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 is used to store at least one computer program, which is used to be executed by the processor 901 to implement the screen video encoding method provided in the method embodiment of the present application.
[0135] In some embodiments, terminal 900 may optionally include a peripheral device interface 903 and at least one peripheral device. The processor 901, memory 902, and peripheral device interface 903 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 903 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907, a positioning assembly 908, and a power supply 909.
[0136] The peripheral device interface 903 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 901 and the memory 902. In some embodiments, the processor 901, the memory 902, and the peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902, and the peripheral device interface 903 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0137] The RF circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 904 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the RF circuit 904 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, and the like. The RF circuit 904 can communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 904 may also include circuits related to Near Field Communication (NFC), which is not limited in this application.
[0138] The display screen 905 is used to display a user interface (UI). This UI may include graphics, text, icons, videos, or any combination thereof. When the display screen 905 is a touch screen, it is also capable of collecting touch signals on or above the surface of the display screen 905. These touch signals can be input as control signals to the processor 901 for processing. In this case, the display screen 905 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 can be a single display screen 905, located on the front panel of the terminal 900. In other embodiments, there can be at least two display screens 905, located on different surfaces of the terminal 900 or in a foldable design. In other embodiments, the display screen 905 can be a flexible display screen, located on a curved or foldable surface of the terminal 900. Furthermore, the display screen 905 can be configured as a non-rectangular irregular shape, i.e., a special-shaped screen. The display screen 905 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0139] The camera assembly 906 is used to capture images or videos. Optionally, the camera assembly 906 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 906 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0140] The audio circuit 907 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals to be input into the processor 901 for processing, or input into the radio frequency circuit 904 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there may be multiple microphones, each located in different parts of the terminal 900. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker may be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 907 may also include a headphone jack.
[0141] Positioning component 908 is used to locate the current geographic location of terminal 900 to implement navigation or LBS (Location Based Service). Positioning component 908 can be a positioning component based on the US GPS (Global Positioning System), China's Beidou system, or Russia's Galileo system.
[0142] Power supply 909 is used to power various components in terminal 900. Power supply 909 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 909 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, while a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0143] In some embodiments, the terminal 900 further includes one or more sensors 910 , including but not limited to: an acceleration sensor 911 , a gyroscope sensor 912 , a pressure sensor 913 , a fingerprint sensor 914 , an optical sensor 915 , and a proximity sensor 916 .
[0144] The accelerometer 911 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by the terminal 900. For example, the accelerometer 911 can be used to detect the components of gravity acceleration along the three coordinate axes. The processor 901 can control the display screen 905 to display the user interface in a landscape or portrait view based on the gravity acceleration signal collected by the accelerometer 911. The accelerometer 911 can also be used to collect game or user motion data.
[0145] The gyroscope sensor 912 can detect the orientation and rotation angle of the terminal 900. It can work with the accelerometer 911 to collect the user's 3D movements on the terminal 900. Based on the data collected by the gyroscope sensor 912, the processor 901 can implement the following functions: motion sensing (for example, changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0146] The pressure sensor 913 can be set on the side frame of the terminal 900 and / or the lower layer of the display screen 905. When the pressure sensor 913 is set on the side frame of the terminal 900, it can detect the user's grip signal of the terminal 900, and the processor 901 performs left and right hand recognition or shortcut operations based on the grip signal collected by the pressure sensor 913. When the pressure sensor 913 is set on the lower layer of the display screen 905, the processor 901 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 905. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0147] The fingerprint sensor 914 is used to collect the user's fingerprint. The processor 901 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 914, or the fingerprint sensor 914 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 901 authorizes the user to perform relevant sensitive operations, such as unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings. The fingerprint sensor 914 can be set on the front, back, or side of the terminal 900. When a physical button or manufacturer logo is provided on the terminal 900, the fingerprint sensor 914 can be integrated with the physical button or manufacturer logo.
[0148] The optical sensor 915 is used to detect ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the display screen 905 based on the ambient light intensity detected by the optical sensor 915. Specifically, when the ambient light intensity is high, the display brightness of the display screen 905 is increased; when the ambient light intensity is low, the display brightness of the display screen 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 based on the ambient light intensity detected by the optical sensor 915.
[0149] Proximity sensor 916, also known as a distance sensor, is typically located on the front panel of terminal 900. Proximity sensor 916 is used to detect the distance between the user and the front of terminal 900. In one embodiment, when proximity sensor 916 detects that the distance between the user and the front of terminal 900 is gradually decreasing, processor 901 controls display screen 905 to switch from the screen-on state to the screen-off state. When proximity sensor 916 detects that the distance between the user and the front of terminal 900 is gradually increasing, processor 901 controls display screen 905 to switch from the screen-off state to the screen-on state.
[0150] Those skilled in the art will understand that Figure 9 The structure shown in the figure does not constitute a limitation on the terminal 900, and the terminal 900 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0151] In other embodiments, the computer device is configured as a server. Figure 10 This is a structural diagram of a server provided in accordance with an embodiment of the present application. The server 1000 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1001 and one or more memories 1002, wherein the memory 1002 stores at least one computer program, and the at least one computer program is loaded and executed by the processor 1001 to implement the screen video encoding method provided by the above-mentioned various method embodiments. Of course, the server 1000 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 1000 may also include other components for implementing device functions, which will not be described in detail here.
[0152] The present application also provides a computer-readable storage medium having at least one computer program stored therein, which is loaded and executed by a processor of a computer device to implement the screen video encoding method provided in each of the above method embodiments. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0153] The present application also provides a computer program product or computer program, which includes computer program code stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium and executes the computer program code, causing the computer device to perform the screen video encoding method provided in each of the above method embodiments.
[0154] In some embodiments, the computer program involved in the embodiments of the present application may be deployed and executed on a computer device, or on multiple computer devices located at one location, or on multiple computer devices distributed at multiple locations and interconnected through a communication network. Multiple computer devices distributed at multiple locations and interconnected through a communication network may constitute a blockchain system.
[0155] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0156] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for encoding screen video, characterized in that: The method comprises: Determine a first image block in the screen content image for which a hash value is to be determined; determining, based on a plurality of first image sub-blocks included in the first image block, whether a second image sub-block overlaps with any of the first image sub-blocks in a second image block of the screen content image, where the second image block is an image block having a corresponding hash value stored in a hash table, the hash table being used to determine a prediction block for the image block to be encoded during an encoding process; When there is a second image subblock in the second image block that overlaps with any of the first image subblocks, acquiring image feature information of at least one first image subblock of the first image block from the image feature information of the second image block; Based on the image feature information of the at least one first image sub-block, a hash value of the first image block is determined, and the hash value of the first image block is stored in the hash table. Based on the hash table, a prediction block that matches the image block to be encoded in the screen content image is determined, where the prediction block is an encoded image block of the screen content image, and the hash value of the image block to be encoded is the same as the hash value of the prediction block; and based on the prediction block, the image block to be encoded is encoded.
2. The method according to claim 1, characterized in that The determining, based on the plurality of first image sub-blocks included in the first image block, whether there is a second image sub-block in the second image block of the screen content image that overlaps with any of the first image sub-blocks includes: determining a label corresponding to each first image sub-block contained in the first image block, where the label is used to indicate whether image feature information of the first image sub-block has been stored; In a case where the label matches the target label, determining that a second image subblock that overlaps with the first image subblock exists in the second image block, and the target label indicates that image feature information of the corresponding image subblock has been stored; In a case where the label does not match the target label, it is determined that no second image subblock that overlaps with the first image subblock exists in the second image block.
3. The method according to claim 2, characterized in that The determining a label corresponding to each of the first image sub-blocks contained in the first image block includes: A label corresponding to each of the first image sub-blocks is determined from a label array corresponding to the screen content image, where the label array is used to store labels of the image sub-blocks included in the screen content image.
4. The method according to claim 1, wherein The method further comprises: A target number of first image sub-blocks whose positions meet a condition are selected from multiple first image sub-blocks included in the first image block, and for each first image sub-block, the step of determining whether there is a second image sub-block in the second image block of the screen content image that overlaps with any of the first image sub-blocks is performed in sequence, where the condition is that the distance between the first image sub-block and the image block for which the hash value is stored is the shortest.
5. The method according to claim 1, characterized in that The determining, based on the image feature information of the at least one first image sub-block, a hash value of the first image block includes: determining, from the plurality of first image sub-blocks of the first image block, a fourth image sub-block excluding the third image sub-block, the third image sub-block being a first image sub-block for which image feature information has been acquired, and the fourth image sub-block being a first image sub-block for which image feature information has not been acquired; determining image feature information of the fourth image sub-block based on a plurality of pixels included in the fourth image sub-block; Based on the image feature information of the plurality of first image sub-blocks, a hash value of the first image block is determined.
6. The method according to claim 5, characterized in that The determining, based on a plurality of pixels included in the fourth image sub-block, image feature information of the fourth image sub-block includes: Determine an average pixel value and a pixel gradient value of the multiple pixel points included in the fourth image sub-block to obtain image feature information of the fourth image sub-block, where the pixel gradient value is an average of a horizontal pixel gradient value in a horizontal direction and a vertical pixel gradient value in a vertical direction.
7. The method according to claim 1, characterized in that The method further comprises: When there is no second image subblock in the second image block that overlaps with any of the first image subblocks, for multiple first image subblocks included in the first image block, image feature information of the first image subblocks is determined based on multiple pixels included in each of the first image subblocks.
8. The method according to claim 7, characterized in that The method further comprises: Image feature information of each of the first image sub-blocks is stored.
9. A screen video encoding device, characterized in that: The device comprises: An image block determination module, configured to determine a first image block in the screen content image for which a hash value is to be determined; an information determination module, configured to determine, based on a plurality of first image sub-blocks included in the first image block, whether a second image sub-block in a second image block of the screen content image overlaps with any of the first image sub-blocks, where the second image block is an image block for which a corresponding hash value has been stored in a hash table, the hash table being used to determine a prediction block for the image block to be encoded during an encoding process; an information acquisition module, configured to acquire, when there exists a second image subblock in the second image block that overlaps with any of the first image subblocks, image feature information of at least one first image subblock of the first image block from the image feature information of the second image block; An image encoding module is configured to determine a hash value of the first image block based on image feature information of the at least one image sub-block, store the hash value of the first image block in the hash table, encode the screen content image based on the hash table of the screen content image, determine a prediction block that matches an image block to be encoded in the screen content image based on the hash table, wherein the prediction block is an encoded image block of the screen content image, and the hash value of the image block to be encoded is the same as the hash value of the prediction block; and encode the image block to be encoded based on the prediction block.
10. The device according to claim 9, characterized in that The information determination module includes: a label determining unit, configured to determine a label corresponding to each first image sub-block contained in the first image block, the label being used to indicate whether image feature information of the first image sub-block has been stored; an information determining unit, configured to determine, when the label matches a target label, that a second image subblock that overlaps with the first image subblock exists in the second image block, and wherein the target label indicates that image feature information of the corresponding image subblock has been stored; In a case where the label does not match the target label, it is determined that no second image subblock that overlaps with the first image subblock exists in the second image block.
11. The device according to claim 10, characterized in that The label determination unit is configured to determine a label corresponding to each of the first image sub-blocks from a label array corresponding to the screen content image, wherein the label array is configured to store labels of the image sub-blocks included in the screen content image.
12. The device according to claim 9, characterized in that The device further comprises: a sub-block selection module, configured to select a target number of first image sub-blocks whose positions meet a condition from a plurality of first image sub-blocks included in the first image block; an information acquisition module configured to determine, for each of the first image sub-blocks, in sequence whether there is a second image sub-block in the second image block of the screen content image that overlaps with any of the first image sub-blocks, where the condition is that the distance between the first image sub-block and the image block for which the hash value is stored is the shortest.
13. The device according to claim 9, characterized in that The hash value determination module includes: a sub-block determining unit, configured to determine, from the plurality of first image sub-blocks of the first image block, a fourth image sub-block excluding the third image sub-block, the third image sub-block being a first image sub-block for which image feature information has been acquired, and the fourth image sub-block being a first image sub-block for which image feature information has not been acquired; an information determining unit, configured to determine image feature information of the fourth image sub-block based on a plurality of pixels included in the fourth image sub-block; A hash value determining unit is configured to determine a hash value of the first image block based on image feature information of the plurality of first image sub-blocks.
14. The device according to claim 13, characterized in that The information determination unit is used to determine the average pixel value and pixel gradient value of the multiple pixel points included in the fourth image sub-block to obtain image feature information of the fourth image sub-block, where the pixel gradient value is the average of the horizontal pixel gradient value in the horizontal direction and the vertical pixel gradient value in the vertical direction.
15. The device according to claim 9, characterized in that The information determination module is further configured to determine, for multiple first image sub-blocks included in the first image block, image feature information of the first image sub-blocks based on multiple pixels included in each of the first image sub-blocks, when there is no second image sub-block in the second image block that overlaps with any of the first image sub-blocks.
16. The device according to claim 15, characterized in that The device further comprises: An information storage module is configured to store image feature information of each of the first image sub-blocks.
17. A computer device, characterized in that: The computer device includes a processor and a memory, the memory is used to store at least one computer program, and the at least one computer program is loaded by the processor and executes the screen video encoding method according to any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store at least one computer program, and the at least one computer program is loaded by a processor of a computer device and executes the screen video encoding method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and system of video coding with intra block copying
US20200099926A1