Bullet screen coding method and device, computer equipment and storage medium
The bullet comment encoding method improves compression rates by using a combination of encoding modes and real-time updates, addressing inefficiencies in traditional methods and optimizing resource use.
Patent Information
- Application Number
- CN202310813519.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-03
- Publication Date
- 2025-01-03
AI Technical Summary
Existing bullet comment encoding methods, particularly in scenarios with high repetition, result in low encoding compression rates, leading to wastage of computer storage and computing resources.
A bullet comment encoding method that employs a combination of fusion, index, and normal modes, with a mapping relationship between fusion mode coding information and character information, and updates fusion mode character information based on occurrence frequency, optimizing encoding for improved compression.
Enhances encoding compression rates by efficiently utilizing storage and computing resources, maintaining accuracy, and adapting to changing content through real-time updates and multiple encoding modes.
Smart Images

Figure CN119255019A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of bullet comment processing, and in particular to a bullet comment encoding method, device, computer equipment and storage medium. Background Art
[0002] At present, bullet comments are generally encoded using ASCII (American Standard Code for Information Interchange), in which one Chinese character occupies 16 bits of binary. In scenarios such as generating bullet comments on video platforms, many bullet comments have a high degree of repetition. In this case, the traditional encoding method will waste computer storage and computing resources, and the encoding compression rate is low. Summary of the invention
[0003] In view of this, the embodiments of the present application provide a bullet comment encoding method, apparatus, computer device and storage medium to solve the problem of low encoding compression rate in scenarios with high bullet comment repetition.
[0004] In a first aspect, an embodiment of the present application provides a bullet comment encoding method, including:
[0005] Get the character information to be encoded;
[0006] Determine a coding mode of the character information to be encoded, wherein the coding mode includes a fusion mode, an index mode and a normal mode, wherein the fusion mode includes a preset number of fusion mode coding information, and there is a mapping relationship between the fusion mode coding information and the fusion mode character information;
[0007] Encoding the character information to be encoded according to the encoding mode;
[0008] The fusion mode character information of the fusion mode is updated according to the occurrence frequency of the character information to be encoded in a preset time period.
[0009] In a second aspect, an embodiment of the present application provides a bullet comment encoding device, including:
[0010] An acquisition module is used to obtain character information to be encoded;
[0011] A coding mode determination module, used to determine the coding mode of the character information to be encoded, wherein the coding mode includes a fusion mode, an index mode and a normal mode, wherein the fusion mode includes a preset number of fusion mode coding information, and there is a mapping relationship between the fusion mode coding information and the fusion mode character information;
[0012] An encoding module, used for encoding the character information to be encoded according to the encoding mode;
[0013] An updating module is used to update the fusion mode character information of the fusion mode according to the occurrence frequency of the character information to be encoded in a preset time period.
[0014] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor executes the steps of the barrage encoding method described in the first aspect when executing the computer-readable instructions.
[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer-readable instructions. When the computer-readable instructions are executed by a processor, the steps of the barrage encoding method described in the first aspect are implemented.
[0016] In an embodiment of the present application, first, the character information to be encoded is obtained, and the encoding mode of the character information to be encoded is determined, wherein the encoding mode includes a plurality of encoding modes that provide encoding support for the character information to be encoded, such as a fusion mode, an index mode, and a regular mode. Among them, the fusion mode includes a preset number of fusion mode encoding information, and there is a mapping relationship between the fusion mode encoding information and the fusion mode character information, which can use fewer storage resources to realize barrage encoding; after determining the encoding mode of the character information to be encoded, the character information to be encoded will be encoded according to the encoding mode to improve the compression rate of the barrage encoding, and the fusion mode character information of the fusion mode will be updated according to the frequency of occurrence of the character information to be encoded in a preset time period, thereby realizing the real-time update of the barrage, making it easier to determine repeated barrages as encoding modes with high encoding compression rates such as fusion modes. The present application can effectively improve the encoding compression rate and make better use of computer storage and computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. 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 paying creative labor.
[0018] Figure 1 It is a flow chart of a bullet screen encoding method in an embodiment of the present application;
[0019] Figure 2 is a schematic diagram of a strong fusion mode in an embodiment of the present application;
[0020] Figure 3is a schematic diagram of a weak fusion mode in an embodiment of the present application;
[0021] Figure 4 It is a principle block diagram of a bullet screen encoding device in an embodiment of the present application;
[0022] Figure 5 It is a computer device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0024] It should be clear that the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0025] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0026] It should be understood that the term "and / or" used in this article is only a description of the same field of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0027] It should be understood that, although the terms first, second, third, etc. may be used to describe preset ranges, etc. in the embodiments of the present application, these preset ranges should not be limited to these terms. These terms are only used to distinguish preset ranges from each other. For example, without departing from the scope of the embodiments of the present application, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.
[0028] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0029] Figure 11 is a flowchart of a bullet screen encoding method in an embodiment of the present application. The bullet screen encoding method can be applied to various application scenarios where repeated bullet screens appear, such as video platforms, and can improve the encoding compression rate in this specific application scenario. Figure 1 As shown, the bullet screen encoding method includes the following steps:
[0030] S10: Obtain information of characters to be encoded.
[0031] Among them, the character information to be encoded refers to the character information to be encoded. It can be understood that the content of a barrage can be composed of one or more character information. When the computer processes the barrage, it will first compress and encode the character information corresponding to the barrage and store it. When the character information needs to be displayed, the character information can be displayed by decompressing the corresponding code. In one embodiment, in a barrage scenario such as a video platform, the barrage server of the video platform will first receive the character information to be encoded, compress and decompress the character information to be encoded, and then output it on the barrage module of the video platform.
[0032] S20: Determine a coding mode for the character information to be encoded, wherein the coding mode includes a fusion mode, an index mode and a normal mode, wherein the fusion mode includes a preset number of fusion mode coding information, and there is a mapping relationship between the fusion mode coding information and the fusion mode character information.
[0033] In the present application, different from the traditional coding mode, a variety of different coding modes are set. Among them, these coding modes include fusion mode, index mode and regular mode, etc. The coding compression rate effect of each coding mode is different, among which the coding compression rate of the fusion mode is better, the index mode is second, and the regular mode is similar to or the same as the traditional coding mode. It can be understood that, different from the traditional coding mode, the characters to be encoded in the present application will give priority to the coding mode with high coding compression rate, and combine a variety of different coding modes to achieve coding, and complete the encoding of character information. In one embodiment, before encoding, the coding mode of the character information to be encoded will be determined first. Specifically, the fusion mode includes a preset number of fusion mode coding information, and there is a mapping relationship between the fusion mode coding information and the fusion mode character information. The fusion mode is a limited number of coding modes, and the fusion mode coding information is specifically mapped to the corresponding fusion mode character information. In this way, when encountering a scene where the barrage content is long and the barrage is often repeated, the fusion mode coding information is used to quickly encode the character information to be encoded, without repeatedly encoding one character at a time according to the traditional coding mode, which can greatly improve the coding efficiency. In one embodiment, for example, the fusion mode coding information is numbered 0-15, where each code corresponds to a fusion mode character information. When the fusion mode character information and the character information to be encoded are the same or similar, the content of the barrage can be quickly determined and the encoding compression can be quickly performed.
[0034] S30: Encode the character information to be encoded according to the encoding mode.
[0035] In one embodiment, the encoding of the character information to be encoded will make full use of the multiple encoding modes mentioned above. In an ideal case, the character information to be encoded can only be encoded using the encoding mode with the highest encoding compression rate; in other cases, the character information to be encoded can be encoded using a combination of a fusion mode, an index mode, and a regular mode. It can be understood that when the character information to be encoded satisfies the encoding mode that can adopt a higher encoding compression rate, the encoding mode with the highest encoding compression rate that can be adopted will be used as much as possible, thereby achieving a higher efficiency of barrage encoding efficiency.
[0036] S40: updating the fusion mode character information of the fusion mode according to the occurrence frequency of the character information to be encoded in the preset time period.
[0037] In one embodiment, the fusion mode coding information is fixed, but the fusion mode character information is non-fixed. Such a setting can realize flexible adjustment of character coding and improve the operability of coding character information. For example, the fusion mode coding information 0, 1, 2, 3 originally stores the corresponding fusion mode character information A, B, C, D respectively. After ten minutes, as the content of the video platform changes, the barrage sent by the video viewers changes, and the repetition of the content of the barrage E, F, C in a certain time interval is very high. In the next period of time, the expectation of the appearance of barrage E, F, C is relatively high. The original fusion mode character information is A, B, C, D, which can be changed to E, F, C, D, F, E, C, D, C, B, E, F and other different fusion mode character information. When a user initiates a barrage related to E, F, or C, the barrage server will quickly encode the barrage related to E, F, or C according to the updated fusion mode character information, which greatly improves the encoding compression rate of the barrage and effectively improves the flexibility and accuracy of encoding the character information to be encoded.
[0038] In steps S10-S40, a combination of multiple encoding modes such as fusion mode, index mode and normal mode is used to achieve fast encoding of the encoded character information. Compared with the traditional barrage encoding method, the barrage encoding method of the present application has a significant improvement in the encoding compression rate in scenarios where the barrage content is long and the barrage is often repeated. The encoding mode selection is also progressive, and a better encoding compression rate can still be achieved when the video content changes and multiple types of barrages are sent.
[0039] Furthermore, in step S20, i.e., the step of determining the encoding mode of the character information to be encoded, the following steps are specifically included:
[0040] S21: Searching the fusion mode character information to see whether there is character information matching the character information to be encoded; if so, determining to encode the successfully matched character information to be encoded in the fusion mode.
[0041] In one embodiment, ideally, the barrage content corresponding to the character information to be encoded has completely identical barrage content in the fusion mode character information. In this case, it is only necessary to encode according to the fusion mode encoding information corresponding to the fusion mode character information, which can significantly improve the encoding compression rate. Of course, in this application, as long as there is character information matching the character information to be encoded in the fusion mode character information, the fusion mode encoding information can also be used for encoding, but the fusion mode character information needs to be deleted so that the output barrage content is consistent with the content of the character information to be encoded input by the user.
[0042] S22: If not all the character information to be encoded is encoded in the fusion mode, the unencoded character information to be encoded is retrieved in the index table. If there is index coding information mapped to the unencoded character information to be encoded in the index table, the successfully retrieved unencoded character information to be encoded is determined to be encoded in the index mode, wherein the index table stores the mapping relationship between the index coding information and the index character information.
[0043] Among them, the coding compression rate of the index mode is a coding mode that is higher than the normal mode and lower than the fusion mode. Specifically, the normal mode may adopt a coding length of 16 bits, while the index mode may adopt a coding length of 12 bits or lower, and the fusion mode may adopt a coding length of 4 bits, 6 bits, etc. that is lower than the index mode. The implementation of the index mode is based on an index table, which stores a mapping relationship between an index number and character information, and the character information may be a single character or a combination of multiple characters. It can be understood that by establishing an index table, the character information to be encoded can be quickly encoded, and its coding compression rate will be greatly improved compared to the normal mode.
[0044] S23: If there is still some character information to be encoded that has not been encoded after adopting the fusion mode and the index mode, the remaining character information to be encoded is determined to be encoded in the normal mode.
[0045] In one embodiment, the conventional mode may be a traditional encoding mode. When the above multiple efficient encoding modes are not applicable, the basic conventional mode may be used to encode the character information to be encoded. In this way, the above encoding modes can be combined to ensure the accuracy of encoding compression while maximizing the encoding compression rate.
[0046] In steps S21-S23, the encoding of the encoded character information is achieved by combining the fusion mode, index mode and normal mode. During encoding, matching is performed in the order of fusion mode → index mode → normal mode, and the optimal encoding mode that meets the conditions is preferentially selected. It can be applied to different bullet screen scenarios, and the encoding compression rate is greatly improved while maintaining the accuracy of encoding compression.
[0047] Furthermore, the fusion mode includes a strong fusion mode and a weak fusion mode.
[0048] Among them, the strong fusion mode can be understood as a mode in which the character information to be encoded and the character information content of the fusion mode have a high degree of match, which can also be called the first fusion mode in this application; the weak fusion mode can be understood as a mode in which the character information to be encoded and the character information content of the fusion mode have a low degree of match, which can also be called the second fusion mode in this application.
[0049] Figure 2 Schematic diagram of a strong fusion mode in an embodiment of the present application. Figure 2 As shown, there are 16 fusion mode character information in total, among which, the character information to be encoded "Thank you teacher" and the first fusion mode character "Thank you teacher for your explanation" have 4 characters in common, which can be considered as a strong fusion mode.
[0050] Figure 3 Schematic diagram of a weak fusion mode in an embodiment of the present application. Figure 3 As shown, there are 16 fusion mode character information in total, among which the character information to be encoded "Thank you" and the first fusion mode character "Thank you teacher for your explanation" have only two characters in common, which can be considered as a weak fusion mode.
[0051] Further, in step S21, the step of searching whether there is character information matching the character information to be encoded from the fusion mode character information, and if there is, determining the character information to be encoded that successfully matches in the fusion mode to be encoded specifically includes the following steps:
[0052] S211: If the proportion of successfully matched character information to be encoded exceeds a preset ratio, the fusion mode is a strong fusion mode, and the character information that fails to match in the character information to be encoded is identified, so that the character information that fails to match is encoded using an index mode and / or a regular mode.
[0053] In one embodiment, when the fusion mode is a strong fusion mode, the successfully matched character information can be retained and the character information that failed to match can be identified. In the encoding stage, the successfully matched character information will be encoded according to the fusion mode encoding information, while other unmatched character information will be encoded using other encoding modes.
[0054] S212: If the proportion of successfully matched character information to be encoded does not exceed a preset ratio, the fusion mode is a weak fusion mode, and the weakly fused character information that has been successfully matched in the character information to be encoded is identified, or the weakly fused character information is determined by setting a fusion starting point and a fusion end point to encode the weakly fused character information.
[0055] In one embodiment, considering that the character information successfully matched by the weak fusion mode is scattered among the character information, which is not conducive to the encoding and decoding of the barrage content, if the encoding process is directly performed according to the fusion mode coding information, it will be more complicated and prone to errors. In this application, the weakly fused character information can be determined by setting the fusion starting point and the fusion ending point. The specific method is as follows: assuming that the number of characters in the fusion mode character information is 16, in order to maintain the continuity of the character information connection, the best coherence section in the successfully matched character information can be taken as the saved character information. For example, if the first and last characters of the fusion mode character information are successfully matched, and the middle 4 characters are also successfully matched, the position of the first character of the middle 4 characters can be used as the fusion starting point, and the position of the last character of the middle 4 characters can be used as the fusion ending point. In this way, without destroying the coherence and integrity of the characters, the content that can be encoded using the fusion mode coding information can be mined as much as possible in the weak fusion mode.
[0056] In steps S211-S212, a strong fusion mode and a weak fusion mode are provided to analyze different situations that may occur in actual applications, and better solutions are provided for each case, which can extract available information as much as possible in the strong fusion mode and the weak fusion mode to improve the coding compression rate.
[0057] Furthermore, the amount of fusion mode encoding information is 2 n , where n is a natural number and 2 n Do not exceed the preset quantity value.
[0058] In one embodiment, n is set to a coding length not exceeding the index mode. In practical applications, n can be set to 4, 5, 6, etc. When n is set to 4, the number of fusion mode coding information is 16 codes, and when n is set to 6, the number of fusion mode coding information is 64 codes. Users can set n according to the type of repeated bullet comments, and it is not limited here.
[0059] Furthermore, before step S10, that is, before obtaining the character information to be encoded, the method also includes the following steps: obtaining general scene character information; establishing a mapping relationship between the general scene character information and the index coding information to obtain a general index table; obtaining scene information; determining specific scene character information based on the scene information; establishing a mapping relationship between the specific scene character information and the index coding information to obtain a specific index table.
[0060] In one embodiment, the index table includes a general index table and a specific index table. General scenarios refer to scenarios that are generally summarized and summarized, while specific scenarios are scenarios specially formulated according to specific needs. In this application, the general index table and the specific index table cover most of the possible bullet screen speech scenarios. If the corresponding character information is not found in the fusion mode, most of them can be found in the index table. In addition, the index table itself also classifies various scenarios, which will be more efficient in searching for character information. The establishment of this index table can also improve the encoding compression rate compared to the traditional encoding method.
[0061] Furthermore, in step S40, that is, the step of updating the character information of the fusion mode according to the occurrence frequency of the character information to be encoded in the preset time period, the following steps are specifically included:
[0062] S41: within a preset time period, if the occurrence frequency of the character information to be encoded exceeds a first preset threshold, the fusion mode character information first stored in the fusion mode is obtained.
[0063] S42: Using the character information to be encoded to replace the first stored fusion mode character information, and establishing a mapping relationship with the corresponding fusion mode encoding information.
[0064] In steps S41-S42, the first-in-first-out method is adopted to realize the replacement of the character information to be encoded. According to the continuous changes in time and frequency, the fusion mode character information is also improved with time, which effectively improves the encoding compression rate. In the case of periodic changes in barrage, the encoding can be intelligently optimized, which plays a good transition role.
[0065] Furthermore, the method further comprises the following steps:
[0066] Within the preset time period, if the occurrence frequency of the character information to be encoded exceeds the first preset threshold, and the overlap between the character information to be encoded and the currently stored fusion mode character information exceeds the second preset threshold, the currently stored fusion mode character information is still retained.
[0067] In one embodiment, if the repetition between the character information to be encoded and the character information to be replaced is too high, in the multi-scenario application of the strong fusion mode and the weak fusion mode, the actual meaning of the replacement improvement is not great. At this time, the currently stored fusion mode character information can still be retained. This can also avoid invalid replacement work on the encoded character information, effectively saving system resources.
[0068] In an embodiment of the present application, first, the character information to be encoded is obtained, and the encoding mode of the character information to be encoded is determined, wherein the encoding mode includes a plurality of encoding modes that provide encoding support for the character information to be encoded, such as a fusion mode, an index mode, and a regular mode. Among them, the fusion mode includes a preset number of fusion mode encoding information, and there is a mapping relationship between the fusion mode encoding information and the fusion mode character information, which can use fewer storage resources to realize barrage encoding; after determining the encoding mode of the character information to be encoded, the character information to be encoded will be encoded according to the encoding mode to improve the compression rate of the barrage encoding, and the fusion mode character information of the fusion mode will be updated according to the frequency of occurrence of the character information to be encoded in a preset time period, thereby realizing the real-time update of the barrage, making it easier to determine repeated barrages as encoding modes with high encoding compression rates such as fusion modes. The present application can effectively improve the encoding compression rate and make better use of computer storage and computing resources.
[0069] Furthermore, the present application also combines the fusion mode, the index mode and the regular mode to realize the encoding of the character information to be encoded. When encoding, the matching is carried out in the order of fusion mode → index mode → regular mode, and the optimal encoding mode that meets the conditions is preferentially selected, which can be applicable to different bullet screen scenes, and on the basis of maintaining the accuracy of encoding compression, the encoding compression rate is improved; further, the present application also provides a strong fusion mode and a weak fusion mode to analyze different situations that may occur in actual applications, and provides a better solution for each case, which can extract the available information as much as possible in the strong fusion mode and the weak fusion mode to improve the encoding compression rate; further, the present application also establishes an index table, and the establishment of the index table can also improve the encoding compression rate compared with the traditional encoding method; further, the present application also adopts a first-in-first-out method to realize the replacement of the character information to be encoded. According to the continuous changes in time and frequency, the fusion mode character information also improves with time, which effectively improves the encoding compression rate. In the case of periodic replacement of bullet screens, the encoding can be intelligently optimized, which plays a good transition role; further, the present application can also avoid invalid replacement work for the encoded character information, and effectively save system resources.
[0070] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0071] Figure 4 is a principle block diagram of a bullet screen encoding device in an embodiment of the present application, such as Figure 4 As shown, including:
[0072] The acquisition module 10 is used to acquire character information to be encoded.
[0073] The coding mode determination module 20 is used to determine the coding mode of the character information to be encoded, wherein the coding mode includes a fusion mode, an index mode and a normal mode, wherein the fusion mode includes a preset number of fusion mode coding information, and there is a mapping relationship between the fusion mode coding information and the fusion mode character information.
[0074] The encoding module 30 is used to encode the character information to be encoded according to the encoding mode.
[0075] The updating module 40 is used to update the fusion mode character information of the fusion mode according to the occurrence frequency of the character information to be encoded in a preset time period.
[0076] Furthermore, the coding mode determination module 20 is further specifically configured to:
[0077] It is searched from the fusion mode character information whether there is character information matching the character information to be encoded. If there is, the successfully matched character information to be encoded is determined to be encoded in the fusion mode.
[0078] If not all the character information to be encoded is encoded in the fusion mode, the unencoded character information to be encoded will be retrieved from the index table. If there is index coding information mapped to the unencoded character information to be encoded in the index table, the successfully retrieved unencoded character information to be encoded will be determined to be encoded in the index mode, wherein the index table stores the mapping relationship between the index coding information and the index character information.
[0079] If there is still remaining character information to be encoded that has not been encoded after adopting the fusion mode and the index mode, the remaining character information to be encoded is determined to be encoded in the normal mode.
[0080] Furthermore, the fusion mode includes a strong fusion mode and a weak fusion mode.
[0081] Furthermore, the coding mode determination module 20 is further specifically configured to:
[0082] If the proportion of successfully matched character information to be encoded exceeds a preset ratio, the fusion mode is a strong fusion mode, and the character information that fails to match in the character information to be encoded is identified, so that the character information that fails to match is encoded using an index mode and / or a regular mode.
[0083] If the proportion of successfully matched character information to be encoded does not exceed a preset ratio, the fusion mode is a weak fusion mode, and the weakly fused character information that has been successfully matched in the character information to be encoded is identified, or the weakly fused character information is determined by setting a fusion starting point and a fusion end point to encode the weakly fused character information.
[0084] Furthermore, the index table includes a general index table and a specific index table.
[0085] Furthermore, the bullet screen encoding device is also specifically used for:
[0086] Gets general scene character information.
[0087] A mapping relationship between the general scene character information and the index coding information is established to obtain a general index table.
[0088] Get scene information.
[0089] The scene-specific character information is determined according to the scene information.
[0090] A mapping relationship between scene-specific character information and index coding information is established to obtain a specific index table.
[0091] Furthermore, the updating module 40 is also specifically used for:
[0092] Within a preset time period, if the occurrence frequency of the character information to be encoded exceeds a first preset threshold, the fusion mode character information first stored in the fusion mode is obtained.
[0093] The character information to be encoded is used to replace the fusion mode character information stored first, and a mapping relationship is established with the corresponding fusion mode encoding information.
[0094] Furthermore, the updating module 40 is also specifically used for:
[0095] Within the preset time period, if the occurrence frequency of the character information to be encoded exceeds the first preset threshold, and the overlap between the character information to be encoded and the currently stored fusion mode character information exceeds the second preset threshold, the currently stored fusion mode character information is still retained.
[0096] Furthermore, the amount of fusion mode encoding information is 2 n , where n is a natural number and 2 n Do not exceed the preset quantity value.
[0097] In an embodiment of the present application, first, the character information to be encoded is obtained, and the encoding mode of the character information to be encoded is determined, wherein the encoding mode includes a plurality of encoding modes that provide encoding support for the character information to be encoded, such as a fusion mode, an index mode, and a regular mode. Among them, the fusion mode includes a preset number of fusion mode encoding information, and there is a mapping relationship between the fusion mode encoding information and the fusion mode character information, which can use fewer storage resources to realize barrage encoding; after determining the encoding mode of the character information to be encoded, the character information to be encoded will be encoded according to the encoding mode to improve the compression rate of the barrage encoding, and the fusion mode character information of the fusion mode will be updated according to the frequency of occurrence of the character information to be encoded in a preset time period, thereby realizing the real-time update of the barrage, making it easier to determine repeated barrages as encoding modes with high encoding compression rates such as fusion modes. The present application can effectively improve the encoding compression rate and make better use of computer storage and computing resources.
[0098] Furthermore, the present application also combines the fusion mode, the index mode and the regular mode to realize the encoding of the character information to be encoded. When encoding, the matching is carried out in the order of fusion mode → index mode → regular mode, and the optimal encoding mode that meets the conditions is preferentially selected, which can be applicable to different bullet screen scenes, and on the basis of maintaining the accuracy of encoding compression, the encoding compression rate is improved; further, the present application also provides a strong fusion mode and a weak fusion mode to analyze different situations that may occur in actual applications, and provides a better solution for each case, which can extract the available information as much as possible in the strong fusion mode and the weak fusion mode to improve the encoding compression rate; further, the present application also establishes an index table, and the establishment of the index table can also improve the encoding compression rate compared with the traditional encoding method; further, the present application also adopts a first-in-first-out method to realize the replacement of the character information to be encoded. According to the continuous changes in time and frequency, the fusion mode character information also improves with time, which effectively improves the encoding compression rate. In the case of periodic replacement of bullet screens, the encoding can be intelligently optimized, which plays a good transition role; further, the present application can also avoid invalid replacement work for the encoded character information, and effectively save system resources.
[0099] The present application also provides a computer-readable storage medium, which stores computer-readable instructions. When the computer-readable instructions are executed by a processor, the steps of the barrage encoding method in the above embodiment are implemented.
[0100] Figure 5 This is a computer device according to an embodiment of the present application. Figure 5As shown, the computer device 110 includes a processor 111, a memory 112, and a computer readable instruction 113 stored in the memory 112 and executable on the processor 111. When the processor 111 executes the computer readable instruction 113, each step of the operator processing method of the processor is implemented.
[0101] Exemplarily, the computer readable instructions 113 may be divided into one or more modules / units, one or more modules / units are stored in the memory 112, and are executed by the processor 111 to complete the present application. One or more modules / units may be a series of computer readable instruction segments capable of completing a specific function, and the instruction segments are used to describe the execution process of the computer readable instructions 113 in the computer device 110.
[0102] The computer device 110 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The computer device may include, but is not limited to, a processor 111 and a memory 112. Those skilled in the art will appreciate that Figure 5 This is only an example of the computer device 110 and does not constitute a limitation of the computer device 110. The computer device 110 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.
[0103] According to different implementations, the processor 111 may include one or more types of processors in general and / or special processors such as a central processing unit (CPU), a graphics processing unit (GPU), an artificial intelligence processor, etc. These processors may include, but are not limited to, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc., and their number may be determined according to actual needs. The memory 112 may be an internal storage unit of the computer device 110, such as a hard disk or memory of the computer device 110. The memory 112 may also be an external storage device of the computer device 110, such as a plug-in hard disk equipped on the computer device 110, a smart memory card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 112 may also include both an internal storage unit of the computer device 110 and an external storage device. The memory 112 is used to store computer-readable instructions and other programs and data required by the computer device. The memory 112 can also be used to temporarily store data that has been output or is to be output.
[0104] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0105] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0106] In the embodiments of the present application, the server can be an independent server or 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, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0107] The foregoing may be better understood in light of the following terms:
[0108] Clause A1. A bullet comment encoding method, comprising:
[0109] Get the character information to be encoded;
[0110] Determine a coding mode of the character information to be encoded, wherein the coding mode includes a fusion mode, an index mode and a normal mode, wherein the fusion mode includes a preset number of fusion mode coding information, and there is a mapping relationship between the fusion mode coding information and the fusion mode character information;
[0111] Encoding the character information to be encoded according to the encoding mode;
[0112] The fusion mode character information of the fusion mode is updated according to the occurrence frequency of the character information to be encoded in a preset time period.
[0113] Clause A2. The method according to clause A1, wherein
[0114] Determining the encoding mode of the character information to be encoded includes:
[0115] Searching the fusion mode character information to see whether there is character information matching the character information to be encoded, and if so, determining to encode the successfully matched character information to be encoded in the fusion mode;
[0116] If the character information to be encoded is not all encoded in the fusion mode, the unencoded character information to be encoded is searched in the index table, and if there is index encoding information mapped to the unencoded character information to be encoded in the index table, the unencoded character information to be encoded that is successfully retrieved is determined to be encoded in the index mode, wherein the index table stores a mapping relationship between the index encoding information and the index character information;
[0117] If there is still some character information to be encoded that has not been encoded after adopting the fusion mode and the index mode, the remaining character information to be encoded is determined to be encoded in the conventional mode.
[0118] Clause A3. The method according to clause A2, wherein the fusion mode includes a strong fusion mode and a weak fusion mode, and the searching of the fusion mode character information to see whether there is character information matching the character information to be encoded, and if so, determining to encode the successfully matched character information to be encoded in the fusion mode, comprises:
[0119] If the ratio of the successfully matched character information to be encoded to the character information to be encoded exceeds a preset ratio, the fusion mode is the strong fusion mode, and the character information that fails to match in the character information to be encoded is identified, so as to encode the character information that fails to match by using the index mode and / or the regular mode;
[0120] If the proportion of the successfully matched character information to be encoded does not exceed a preset ratio, the fusion mode is the weak fusion mode, and the weakly fused character information that has been successfully matched in the character information to be encoded is identified, or the weakly fused character information is determined by setting a fusion starting point and a fusion end point to encode the weakly fused character information.
[0121] Clause A4. The method according to clause A2, wherein the index table includes a general index table and a specific index table, and before obtaining the character information to be encoded, the method further includes:
[0122] Get general scene character information;
[0123] Establishing a mapping relationship between the general scene character information and the index coding information to obtain the general index table;
[0124] Get scene information;
[0125] Determining scene-specific character information according to the scene information;
[0126] A mapping relationship between the specific scene character information and the index coding information is established to obtain the specific index table.
[0127] Clause A5. The method according to any one of clauses A1 to A4, wherein the updating of the fusion mode character information of the fusion mode according to the occurrence frequency of the character information to be encoded in a preset time period comprises:
[0128] Within the preset time period, if the occurrence frequency of the character information to be encoded exceeds a first preset threshold, acquiring the fusion mode character information first stored in the fusion mode;
[0129] The character information to be encoded is used to replace the fusion mode character information stored first, and a mapping relationship is established with the corresponding fusion mode encoding information.
[0130] Clause A6. A method according to any one of clauses A5, further comprising:
[0131] Within the preset time period, if the occurrence frequency of the character information to be encoded exceeds a first preset threshold, and the overlap between the character information to be encoded and the currently stored fusion mode character information exceeds a second preset threshold, the currently stored fusion mode character information is still retained.
[0132] Clause A7. A method according to any one of clauses A1-A6, wherein the amount of fusion mode encoding information is 2 n , where n is a natural number, and the 2 n Do not exceed the preset quantity value.
[0133] Clause B1. A bullet comment encoding device, comprising:
[0134] An acquisition module is used to obtain character information to be encoded;
[0135] A coding mode determination module, used to determine the coding mode of the character information to be encoded, wherein the coding mode includes a fusion mode, an index mode and a normal mode, wherein the fusion mode includes a preset number of fusion mode coding information, and there is a mapping relationship between the fusion mode coding information and the fusion mode character information;
[0136] An encoding module, used for encoding the character information to be encoded according to the encoding mode;
[0137] An updating module is used to update the fusion mode character information of the fusion mode according to the occurrence frequency of the character information to be encoded in a preset time period.
[0138] Clause B2. According to the apparatus described in clause B1, the encoding mode determination module is further specifically used for:
[0139] Searching the fusion mode character information to see whether there is character information matching the character information to be encoded, and if so, determining to encode the successfully matched character information to be encoded in the fusion mode;
[0140] If the character information to be encoded is not all encoded in the fusion mode, the unencoded character information to be encoded is searched in the index table, and if there is index encoding information mapped to the unencoded character information to be encoded in the index table, the unencoded character information to be encoded that is successfully retrieved is determined to be encoded in the index mode, wherein the index table stores a mapping relationship between the index encoding information and the index character information;
[0141] If there is still some character information to be encoded that has not been encoded after adopting the fusion mode and the index mode, the remaining character information to be encoded is determined to be encoded in the conventional mode.
[0142] The fusion mode includes a strong fusion mode and a weak fusion mode.
[0143] Clause B3. According to the apparatus described in clause B1, the encoding mode determination module is further specifically used for:
[0144] If the ratio of the successfully matched character information to be encoded to the character information to be encoded exceeds a preset ratio, the fusion mode is the strong fusion mode, and the character information that fails to match in the character information to be encoded is identified, so as to encode the character information that fails to match by using the index mode and / or the regular mode;
[0145] If the proportion of the successfully matched character information to be encoded does not exceed a preset ratio, the fusion mode is the weak fusion mode, and the weakly fused character information that has been successfully matched in the character information to be encoded is identified, or the weakly fused character information is determined by setting a fusion starting point and a fusion end point to encode the weakly fused character information.
[0146] The index table includes a general index table and a specific index table.
[0147] Clause B4. According to the device described in clause B1, the barrage encoding device is also specifically used for:
[0148] Get general scene character information;
[0149] Establishing a mapping relationship between the general scene character information and the index coding information to obtain the general index table;
[0150] Get scene information;
[0151] Determining scene-specific character information according to the scene information;
[0152] A mapping relationship between the specific scene character information and the index coding information is established to obtain the specific index table.
[0153] Clause B5. According to the apparatus described in clause B1, the update module is further specifically used for:
[0154] Within the preset time period, if the occurrence frequency of the character information to be encoded exceeds a first preset threshold, acquiring the fusion mode character information first stored in the fusion mode;
[0155] The character information to be encoded is used to replace the fusion mode character information stored first, and a mapping relationship is established with the corresponding fusion mode encoding information.
[0156] Clause B6. According to the apparatus described in clause B1, the update module is further specifically used for:
[0157] Within the preset time period, if the occurrence frequency of the character information to be encoded exceeds a first preset threshold, and the overlap between the character information to be encoded and the currently stored fusion mode character information exceeds a second preset threshold, the currently stored fusion mode character information is still retained.
[0158] Clause B7. According to the apparatus described in clause B1, the amount of fusion mode encoding information is 2 n , where n is a natural number, and the 2 n Do not exceed the preset quantity value.
[0159] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A bullet comment encoding method, characterized in that: include: Get the character information to be encoded; Determine a coding mode of the character information to be encoded, wherein the coding mode includes a fusion mode, an index mode and a normal mode, wherein the fusion mode includes a preset number of fusion mode coding information, and there is a mapping relationship between the fusion mode coding information and the fusion mode character information; Encoding the character information to be encoded according to the encoding mode; The fusion mode character information of the fusion mode is updated according to the occurrence frequency of the character information to be encoded in a preset time period.
2. The method according to claim 1, characterized in that The step of determining the encoding mode of the character information to be encoded comprises: Searching the fusion mode character information to see whether there is character information matching the character information to be encoded, and if so, determining to encode the successfully matched character information to be encoded in the fusion mode; If the character information to be encoded is not all encoded in the fusion mode, the unencoded character information to be encoded is searched in the index table, and if there is index encoding information mapped to the unencoded character information to be encoded in the index table, the unencoded character information to be encoded that is successfully retrieved is determined to be encoded in the index mode, wherein the index table stores a mapping relationship between the index encoding information and the index character information; If there is still some character information to be encoded that has not been encoded after adopting the fusion mode and the index mode, the remaining character information to be encoded is determined to be encoded in the conventional mode.
3. The method according to claim 2, characterized in that The fusion mode includes a strong fusion mode and a weak fusion mode, and searching the fusion mode character information to see whether there is character information matching the character information to be encoded, and if so, determining to encode the successfully matched character information to be encoded in the fusion mode, including: If the ratio of the successfully matched character information to be encoded to the character information to be encoded exceeds a preset ratio, the fusion mode is the strong fusion mode, and the character information that fails to match in the character information to be encoded is identified, so as to encode the character information that fails to match by using the index mode and / or the regular mode; If the proportion of the successfully matched character information to be encoded does not exceed a preset ratio, the fusion mode is the weak fusion mode, and the weakly fused character information that has been successfully matched in the character information to be encoded is identified, or the weakly fused character information is determined by setting a fusion starting point and a fusion end point to encode the weakly fused character information.
4. The method according to claim 2, characterized in that: The index table includes a general index table and a specific index table. Before obtaining the character information to be encoded, the method further includes: Get general scene character information; Establishing a mapping relationship between the general scene character information and the index coding information to obtain the general index table; Get scene information; Determining scene-specific character information according to the scene information; A mapping relationship between the specific scene character information and the index coding information is established to obtain the specific index table.
5. The method according to any one of claims 1 to 4, characterized in that: The updating of the fusion mode character information of the fusion mode according to the occurrence frequency of the character information to be encoded in a preset time period includes: Within the preset time period, if the occurrence frequency of the character information to be encoded exceeds a first preset threshold, acquiring the fusion mode character information first stored in the fusion mode; The character information to be encoded is used to replace the fusion mode character information stored first, and a mapping relationship is established with the corresponding fusion mode encoding information.
6. The method according to claim 5, characterized in that The method further comprises: Within the preset time period, if the occurrence frequency of the character information to be encoded exceeds a first preset threshold, and the overlap between the character information to be encoded and the currently stored fusion mode character information exceeds a second preset threshold, the currently stored fusion mode character information is still retained.
7. The method according to any one of claims 1 to 6, characterized in that: The number of fusion mode encoding information is 2 n , where n is a natural number, and the 2 n Do not exceed the preset quantity value.
8. A bullet screen encoding device, characterized in that: include: An acquisition module is used to obtain character information to be encoded; A coding mode determination module, used to determine the coding mode of the character information to be encoded, wherein the coding mode includes a fusion mode, an index mode and a normal mode, wherein the fusion mode includes a preset number of fusion mode coding information, and there is a mapping relationship between the fusion mode coding information and the fusion mode character information; An encoding module, used for encoding the character information to be encoded according to the encoding mode; An updating module is used to update the fusion mode character information of the fusion mode according to the occurrence frequency of the character information to be encoded in a preset time period.
9. A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the computer-readable instructions, the steps of the barrage encoding method as described in any one of claims 1-7 are performed.
10. A computer-readable storage medium storing computer-readable instructions, characterized in that: When the computer-readable instructions are executed by a processor, the steps of the barrage encoding method as described in any one of claims 1-7 are implemented.
