CN110147330B - Word matrix data caching method, device, equipment and storage medium - Google Patents
Word matrix data caching method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN110147330B CN110147330B CN201910435174.3A CN201910435174A CN110147330B CN 110147330 B CN110147330 B CN 110147330B CN 201910435174 A CN201910435174 A CN 201910435174A CN 110147330 B CN110147330 B CN 110147330B
- Authority
- CN
- China
- Prior art keywords
- target
- index value
- determining
- character code
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
The embodiment of the invention discloses a method, a device, equipment and a storage medium for caching word module data, wherein the method comprises the following steps: acquiring target matrix data corresponding to target characters; taking a target character code corresponding to the target character as an element index value to obtain a target element position corresponding to the target character code in a preset index array; determining a target index value corresponding to the target character code, and storing the target index value to a target element position; and determining a target cache unit according to the target index value, and storing the target word model data into the target cache unit. By the technical scheme of the embodiment of the invention, the memory resources can be fully and reasonably utilized, and the memory space is reduced.
Description
Technical Field
Embodiments of the present invention relate to caching technologies, and in particular, to a method, an apparatus, a device, and a storage medium for caching word module data.
Background
In an embedded system, the word module data corresponding to the characters is generally required to be cached, so that resources of a central processing unit CPU (Central Processing Unit) are saved, and display efficiency is improved.
In the prior art, generally, the Unicode of the ten thousand national codes corresponding to the characters is directly used as an index value of the character matrix data, and the character matrix storage area is a sequence table strictly conforming to the encoding sequence of the Unicode at the moment, so that the Unicode codes of the characters can be directly used for index positioning when the character matrix data are cached and extracted. However, this buffer mode requires a very large memory support, for example, if it is required to support Mongolian characters of 0x18AF, at least 0x18AF word line buffer units are required. For this, a hashing algorithm is also adopted in the prior art to save memory space, specifically: for characters with the word size smaller than or equal to 24, setting an index value corresponding to the character as a Unicode coding value and an AND operation value of 0x7 FF; for characters with a word size greater than 24, the index value corresponding to the character is set as the Unicode code value and the AND operation value of 0x1 FF.
Although the use of the memory space can be properly reduced through the above hash operation, for characters with a word size smaller than or equal to 24, the high 5 bits of the Unicode code are ignored, and for characters with a word size larger than 24, the high 7 bits of the Unicode code are ignored, so that one cache unit may correspond to a plurality of Unicode codes, and thus cache conflicts can exist, and because the actually used Unicode codes are discontinuous, a lot of cache units are blank under the condition that the cache conflicts exist, and the waste of memory resources is caused.
Disclosure of Invention
The embodiment of the invention provides a word module data caching method, device, equipment and storage medium, which are used for solving the problems of cache conflict and memory resource waste in the prior art, fully and reasonably utilizing memory resources and reducing memory space.
In a first aspect, an embodiment of the present invention provides a method for buffering word module data, including:
acquiring target matrix data corresponding to target characters;
taking a target character code corresponding to the target character as an element index value to obtain a target element position corresponding to the target character code in a preset index array;
determining a target index value corresponding to the target character code, and storing the target index value to the target element position;
and determining a target cache unit according to the target index value, and storing the target word model data into the target cache unit.
In a second aspect, an embodiment of the present invention further provides a device for buffering word module data, including:
the target matrix data acquisition module is used for acquiring target matrix data corresponding to the target characters;
the target element position obtaining module is used for taking a target character code corresponding to the target character as an element index value to obtain a target element position corresponding to the target character code in a preset index array;
the target index value storage module is used for determining a target index value corresponding to the target character code and storing the target index value to the target element position;
and the target matrix data storage module is used for determining a target cache unit according to the target index value and storing the target matrix data into the target cache unit.
In a third aspect, an embodiment of the present invention further provides an apparatus, including:
one or more processors;
a memory for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement a method for buffering word template data as provided by any embodiment of the present invention.
In a fourth aspect, embodiments of the present invention further provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for buffering word pattern data as provided in any embodiment of the present invention.
According to the embodiment of the invention, the character codes corresponding to each character are used as element subscript values in advance, and a preset index array is established, so that the index values corresponding to each word model data to be cached are stored by using the preset index array. After target matrix data to be cached are obtained, target character codes corresponding to target characters are used as element subscript values, target element positions corresponding to the target character codes in a preset index array are obtained, target index values corresponding to the target character codes are determined, and the target index values are stored to the target element positions in the preset index array; and determining a target cache unit according to the target index value, and storing the target word model data into the target cache unit. The index value in the preset index array is utilized for index positioning, the number of the cache units can be distributed according to the number of characters actually required, so that the word model data corresponding to each character is ensured to be stored by a corresponding cache unit, the problem of cache conflict is avoided, the cache units are not required to be distributed for actually unnecessary characters, the problem of memory resource waste is avoided, full and reasonable utilization of memory resources is realized, and the memory space is reduced.
Drawings
FIG. 1 is a flowchart of a method for buffering word module data according to an embodiment of the present invention;
FIG. 2 is an example of caching using a default index array according to a first embodiment of the present invention;
FIG. 3 is a flowchart of a method for buffering word module data according to a second embodiment of the present invention;
FIG. 4 is an example of a first level table and a second level table according to a second embodiment of the present invention;
fig. 5 is a schematic structural diagram of a word module data caching device according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a flowchart of a method for buffering matrix data according to a first embodiment of the present invention, where the present embodiment is applicable to a case of buffering matrix data of a character, and in particular, may be used in a scenario of buffering matrix data of a vector character in an embedded system. The method can be performed by a means for buffering the literal data, which means can be implemented in software and/or hardware, integrated in a device with buffering functionality. The method specifically comprises the following steps:
s110, acquiring target matrix data corresponding to the target character.
The target character may refer to a character corresponding to the word module data to be cached. The characters in the present embodiment may refer to, but are not limited to, dot matrix characters or vector characters, wherein the dot matrix characters represent outlines of the characters by using the false and the true of pixel points; vector characters are glyphs that describe characters by mathematical curves, which may contain key points on the glyph's boundaries, derivative information of links, and so on. The target matrix data may refer to matrix data to be cached corresponding to the target character.
Specifically, the present embodiment may determine the target word stock data from the dot matrix word stock file or the vector word stock file. For example, when the target character needs to be displayed on the display interface of the device, the size and type of the target character to be displayed, such as thickening, tilting and other feature parameters, can be specified, and the vector engine can extract corresponding mathematical curve information from the vector word stock file according to the feature parameters, and perform predetermined mathematical operation on the extracted mathematical curve information to render, so as to obtain the target word model data corresponding to the target character. Or the target word model data corresponding to the target character can be directly extracted from the dot matrix word library file.
S120, taking the target character code corresponding to the target character as an element index value, and obtaining the target element position corresponding to the target character code in the preset index array.
The target character code may refer to Unicode code corresponding to the target character, so that each character in different languages can be distinguished by Unicode code, and cross-language and cross-platform text conversion is realized, for example, unicode code range corresponding to cyrillic: 0x0400-0x052F, wherein "0x" represents hexadecimal. The array size of the preset index array can be predetermined according to the number of characters required to be supported by the service. In this embodiment, the character codes may be used as index values of the preset index array, and the element position corresponding to each index value may be used to store the index value corresponding to the corresponding word module data. It should be noted that when the preset index array is established, each element position in the preset index array does not store a valid index value, and the index value is stored in real time in the process of caching the word model data.
Specifically, a target character code corresponding to a target character is acquired, and in a preset index array, an element position corresponding to the target character code serving as a lower index value is determined as a target element position. For example, the target character code is 0x0020, which indicates that the target element position is the element position with the subscript value of 32 in the preset index array.
S130, determining a target index value corresponding to the target character code, and storing the target index value to the target element position.
Wherein the index value may be a numerical value for indexing storage locations that locate the matrix data. The target index value may be a numerical value for indexing a storage location of target matrix data corresponding to the target character encoding. The index value in this embodiment may refer to a two-byte value that is greater than zero. The double bytes may correspond to a maximum of 65535 index values and thus may be used to index the various word modular data required by the service. Correspondingly, the size of the preset index data group is calculated by multiplying the maximum character code actually used by the service by 2. For example, the last character encoding before the business item needs to support east asian characters, i.e. 0x2FFF, the size of the preset index array is: 0x3000 x 2=24576 bytes. It should be noted that, at the beginning, each element in the preset index array is 0, that is, the index value corresponding to any character is not stored in the preset index array.
Specifically, the embodiment may randomly allocate an index value to each character code, or sequentially allocate an index value to each character code based on the storage sequence of the characters, so as to facilitate rapid index positioning. After determining the target index value corresponding to the target character code, the target index value can be stored to the target element position, so that when the lower index value of the preset index array is the target character code, the obtained element is the target index value.
Illustratively, determining the target index value corresponding to the target character encoding in S130 may include: if no index value exists in the current preset index array, determining a target index value corresponding to the target character code as 1; if the index value exists in the current preset index array, acquiring the maximum index value in the current preset index array, adding 1 to the maximum index value, and determining the obtained calculation result as a target index value corresponding to the target character code.
Specifically, the embodiment may determine, in real time, the index value corresponding to each character, that is, the index value may start from 1, and each time one word module data needs to be stored, the corresponding index value is automatically accumulated by 1. In the preset index array, index values corresponding to characters to be supported by all items are larger than 0, and element positions corresponding to other characters which are not used are stored as 0. As shown in fig. 2, an "x" in the preset index Array indicates an index value corresponding to the character code of 0x0020, and may also indicate an x-th stored index value. When there is no index value in the current preset index array, that is, when each element value in the preset index array at the current moment is 0, the target index value may be determined to be 1. When an index value exists in the current preset index array, that is, when a non-0 index value exists at the current moment, the maximum index value can be obtained, and the obtained calculation result is determined to be a target index value by adding 1 to the maximum index value, so that the index value corresponding to each character data to be cached can be rapidly determined.
And S140, determining a target cache unit according to the target index value, and storing the target matrix data into the target cache unit.
The buffer unit may refer to a buffer area for storing word modular data. Each index value corresponds to each cache unit one by one, so that each cache unit can be used for storing corresponding word model data, and the situation of cache conflict caused by the fact that the same cache unit stores a plurality of word model data in the prior art can be avoided.
Specifically, the present embodiment may pre-determine the number of cache units according to the number of characters that the service needs to support, and pre-determine the memory space of each cache unit based on the word size information of the characters. If the font size of the character is 24, that is, the size of the matrix data is 24 dot matrix, the reserved display area is 24×24 pixels, and each pixel needs transparency of 1 byte, the memory space size of each buffer unit is: 24×24=576 bytes. Illustratively, determining the target cache unit from the target index value may include: and determining a target cache unit corresponding to the target index value from the pre-allocated cache units according to the corresponding relation between the pre-stored index value and the cache units. The number of the pre-allocated cache units is equal to the number of the characters, and the memory space of the cache units can be pre-determined according to the word size information of the characters. According to the embodiment, after corresponding cache units are allocated based on characters required to be supported by the service, a corresponding relation between index values corresponding to the characters and the cache units can be established and stored, so that a target cache unit corresponding to a target index value can be determined from all the pre-allocated cache units based on the corresponding relation, target word model data is stored in the target cache unit, and caching of the word model data is realized. As shown in fig. 2, the correspondence between index values and cache units may be an order in which the index values are directly used as the cache units. For example, the first buffer unit is used for storing the matrix data with the index value of 1, namely, the matrix data of the first buffered character, so that each matrix data can be sequentially stored based on the buffer sequence of the character, and the matrix data can be buffered and read quickly.
Illustratively, when storing 24 characters in the prior art, only 2048 characters are cached, and the required cache space is: 24×24×2048= 1179648 bytes. When the 24-number character is stored by using the cache manner provided in the embodiment, the size of the preset index array is as follows: 0x3000×2=24576 bytes, most of the western languages are usually supported by the business project, and the number of actually required characters is 512, i.e. the total memory size of all cache units is: 24×24×512= 294912 bytes, so that the required memory space is altogether: 294912+24576= 319488 bytes. Therefore, the cache manner provided by the embodiment can reduce the memory usage of 1179648-319488= 860160 bytes by only 24 word sizes, and the word model data corresponding to each character is stored without hash collision, so that the memory resource is fully and reasonably utilized, and the memory space is reduced.
According to the technical scheme, the character codes corresponding to the characters are used as element subscript values in advance, and a preset index array is established, so that the index values corresponding to the word model data to be cached are stored by the aid of the preset index array. After target matrix data to be cached are obtained, target character codes corresponding to target characters are used as element subscript values, target element positions corresponding to the target character codes in a preset index array are obtained, target index values corresponding to the target character codes are determined, and the target index values are stored to the target element positions in the preset index array; and determining a target cache unit according to the target index value, and storing the target word model data into the target cache unit. The index value in the preset index array is utilized for index positioning, the number of the cache units can be distributed according to the number of characters actually required, so that the word model data corresponding to each character is ensured to be stored by a corresponding cache unit, the problem of cache conflict is avoided, the cache units are not required to be distributed for actually unnecessary characters, the problem of memory resource waste is avoided, full and reasonable utilization of memory resources is realized, and the memory space is reduced.
Based on the above technical solution, after S140, the method may further include: acquiring character codes to be extracted corresponding to the character model data to be extracted; determining an index value to be extracted corresponding to the character code to be extracted according to the character code to be extracted and a preset index array; and determining a cache unit to be extracted according to the index value to be extracted, and extracting the word model data to be extracted in the cache unit to be extracted.
Specifically, when extracting the matrix data, the embodiment may first determine, as the index value, the index value to be extracted corresponding to the character code to be extracted in the preset index array, and determine, based on the correspondence between the index value and the cache unit, the cache unit to be extracted corresponding to the index value to be extracted, so that the matrix data to be extracted may be extracted from the cache unit to be extracted. In this embodiment, each character actually required can be cached, so that when the character is displayed, the matrix data can be directly and quickly extracted from the cache unit, and the matrix data is not required to be generated by a vector engine, thereby greatly improving the display efficiency.
Example two
Fig. 3 is a flowchart of a method for buffering word model data according to a second embodiment of the present invention, where, based on the foregoing embodiment, each buffer unit is set by using a secondary table structure, and a detailed description is made on a buffering process of the word model data based on the secondary table structure. Wherein the explanation of the same or corresponding terms as those of the above embodiments is not repeated herein.
Referring to fig. 3, the word module data caching method provided in this embodiment includes the following steps:
s210, acquiring target matrix data corresponding to the target character.
S220, taking the target character code corresponding to the target character as an element index value, and obtaining the target element position corresponding to the target character code in the preset index array.
S230, determining a target index value corresponding to the target character code, and storing the target index value to the target element position.
S240, determining a target address pointer and a target sequence number corresponding to the second-level table according to the target index value.
The second level table may refer to a buffer block composed of a predetermined number of buffer units. The second level table in this embodiment may have one or more, and the specific number of the second level tables may be determined according to the number of characters actually required to be displayed. The number of the preset units of the cache units contained in the second-level table can be determined according to service requirements and actual conditions, and the number of the preset units is smaller than the number of characters actually required, so that the buffer area can be allocated and enlarged in real time along with the increase of the characters to be cached, dynamic allocation of the memory is realized, and the situation that the memory is wasted or the normal cache cannot be realized due to improper pre-allocation of the memory is avoided. In this embodiment, each second level table corresponds to an address pointer, so that the second level table can be quickly located. Each buffer unit address in each second-level table corresponds to a second sequence number so as to distinguish different buffer units in the second-level table.
Specifically, the present embodiment may determine the target address pointer and the target sequence number according to the target index value, so that the target second level table may be determined based on the target address pointer, and the target cache unit for caching the target word module data in the target second level table may be determined based on the target sequence number.
Illustratively, S240 may include: dividing the target index value by the number of preset units, determining the obtained quotient as a target address pointer corresponding to the second-level table, and determining the obtained remainder as a target sequence number corresponding to the second-level table, wherein the number of preset units refers to the number of cache units contained in the second-level table. As shown in FIG. 4, each secondary table contains A cache units, namely, the preset unit number is A, and the serial number corresponding to each cache unit is respectively 0 to A-1; each second level table corresponds to an address pointer, e.g., the first level table corresponds to address pointer 0, i.e., index (0- (a-1)). For example, if the target index value is 10 and the preset unit number is 4, the target address pointer corresponding to the second level table is 2 and the target sequence number is 2.
S250, detecting whether a target address pointer is an empty address according to a first-level table; if yes, go to step S260; if not, the process proceeds to step S270.
Wherein the first level table may be used to store an address pointer corresponding to each second level table. Each address pointer in the first level table may correspond to a first sequence number to distinguish between different address pointers, as shown in fig. 4.
Specifically, it is possible to determine whether the target address pointer is an empty address by detecting whether the target address pointer exists in the first level table. If the target address pointer does not exist in the first-level table, it indicates that the target address pointer is a null address, and the operation of step S260 may be performed. If the target address pointer exists in the first-level table, it indicates that the target address pointer is not a null address, and a second-level table corresponding to the target address pointer exists, and at this time, the operation of step S270 may be performed.
S260, a new second-level table is allocated based on the target address pointer, the target address pointer is stored in the first-level table, a cache unit corresponding to the target sequence number in the currently allocated second-level table is determined as a target cache unit, and step S280 is performed.
Specifically, when the target address pointer is a null address, it indicates that all the second level tables allocated before the current moment are full of word-matrix data, at this time, a new second level table needs to be remarked (memory allocation, dynamic memory allocation), the target address pointer is pointed to the currently allocated second level table, and the target address pointer is stored in the first level table, so as to update the content of the first level table. In this embodiment, the currently allocated second level table may be used as the target second level table, and the cache unit corresponding to the target sequence number in the target second level table may be used as the target cache unit.
It should be noted that, in this embodiment, a first-level table and a second-level table with a smaller buffer space may be allocated in advance, then the second-level tables are allocated successively, and each time a second-level table is full of word matrix data, a new second-level table is allocated again, so that the word matrix buffer area may be allocated and enlarged gradually, without allocating a larger word matrix buffer area in advance at a time, further, the memory resource is fully and reasonably utilized, and the memory utilization rate is improved.
S270, determining a cache unit corresponding to the target sequence number in the existing second-level table corresponding to the target address pointer as a target cache unit.
Specifically, when the target address pointer is a non-empty address, it indicates that there is a second-level table pointed to by the target address pointer at present, that is, an existing second-level table, and there is an idle-state cache unit in the existing second-level table at present, where the cache unit corresponding to the target sequence number in the existing second-level table may be directly determined as the target cache unit.
S280, storing the target word module data into a target cache unit.
According to the technical scheme of the embodiment, the buffer units are arranged by using the secondary table structure (the primary table and the secondary table), so that the number of all supporting characters of the project does not need to be calculated accurately in advance, the matrix buffer area is allocated in advance based on the number, the matrix buffer area is allocated at any time, the space of the matrix buffer area is gradually increased by taking the secondary table as a unit, the memory resource is fully and reasonably utilized, and the memory utilization rate is further improved.
Based on the above technical solution, after S280, the method may further include: acquiring character codes to be extracted corresponding to the character model data to be extracted; determining an index value to be extracted corresponding to the character code to be extracted according to the character code to be extracted and a preset index array; and determining a cache unit to be extracted according to the index value to be extracted, and extracting the word model data to be extracted in the cache unit to be extracted.
Specifically, in this embodiment, the to-be-extracted character code corresponding to the to-be-extracted character code may be used as the subscript value first, and whether the to-be-extracted index value corresponding to the to-be-extracted character code exists in the preset index array may be queried, if so, it is indicated that the to-be-extracted character code is already cached in the current cache region, at this time, the to-be-extracted index value may be in the preset unit number, the to-be-extracted address pointer and the to-be-extracted sequence number of the second level table may be obtained, the to-be-extracted second level table may be obtained based on the to-be-extracted address pointer, and the cache unit corresponding to the to-be-extracted sequence number in the to-be-extracted second level table may be used as the to-be-extracted cache unit, so that the character corresponding to the extracted character data may be quickly displayed on the display interface, and the display efficiency may be greatly improved.
The following is an embodiment of a word data caching apparatus according to an embodiment of the present invention, which belongs to the same inventive concept as the word data caching method of the foregoing embodiments, and details of the word data caching apparatus that are not described in detail in the embodiment of the word data caching apparatus may refer to the foregoing embodiment of the word data caching method.
Example III
Fig. 5 is a schematic structural diagram of a device for buffering matrix data according to a third embodiment of the present invention, where the embodiment is applicable to a case of buffering matrix data of characters, the device specifically includes: a target matrix data acquisition module 310, a target element position acquisition module 320, a target index value storage module 330, and a target matrix data storage module 340.
The target matrix data obtaining module 310 is configured to obtain target matrix data corresponding to a target character; the target element position obtaining module 320 is configured to obtain a target element position corresponding to a target character code in a preset index array by using a target character code corresponding to a target character as an element index value; a target index value storage module 330, configured to determine a target index value corresponding to the target character code, and store the target index value to a target element position; the target matrix data storage module 340 is configured to determine a target cache unit according to the target index value, and store the target matrix data into the target cache unit.
Optionally, the target index value storage module 330 includes: a target index value determining unit configured to: if no index value exists in the current preset index array, determining a target index value corresponding to the target character code as 1; if the index value exists in the current preset index array, acquiring the maximum index value in the current preset index array, adding 1 to the maximum index value, and determining the obtained calculation result as a target index value corresponding to the target character code.
Optionally, the target matrix data storage module 340 includes: the target cache unit determining unit is used for: and determining a target cache unit corresponding to the target index value from the pre-allocated cache units according to the corresponding relation between the pre-stored index value and the cache units.
Optionally, the number of the pre-allocated cache units is equal to the number of the characters, and the memory space of the cache units is pre-determined according to the word size information of the characters.
Optionally, the target cache unit determining unit includes:
the target information determining subunit is used for determining a target address pointer and a target sequence number corresponding to the second-level table according to the target index value;
a target address pointer detection subunit, configured to detect whether the target address pointer is an empty address according to the first level table;
the first target cache unit determining subunit is used for distributing a new second-level table based on the target address pointer if yes, storing the target address pointer into the first-level table, and determining the cache unit corresponding to the target sequence number in the currently distributed second-level table as a target cache unit;
and the second target cache unit determining subunit is configured to determine, if not, a cache unit corresponding to the target sequence number in the existing second-level table corresponding to the target address pointer as a target cache unit.
Optionally, the target information determining subunit is specifically configured to: dividing the target index value by the number of preset units, determining the obtained quotient as a target address pointer corresponding to the second-level table, and determining the obtained remainder as a target sequence number corresponding to the second-level table, wherein the number of preset units refers to the number of cache units contained in the second-level table.
Optionally, the apparatus further comprises:
the character code to be extracted acquisition module is used for acquiring character codes to be extracted corresponding to the character matrix data to be extracted after storing the target character matrix data into the target cache unit;
the to-be-extracted index value determining module is used for determining an to-be-extracted index value corresponding to the character code to be extracted according to the character code to be extracted and a preset index array;
and the to-be-extracted matrix data extraction module is used for determining a to-be-extracted cache unit according to the to-be-extracted index value and extracting the to-be-extracted matrix data in the to-be-extracted cache unit.
The word module data caching device provided by the embodiment of the invention can execute the word module data caching method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the word module data caching method.
Example IV
Fig. 6 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention. Referring to fig. 6, the apparatus includes:
one or more processors 410;
a memory 420 for storing one or more programs;
when the one or more programs are executed by the one or more processors 410, the one or more processors 410 are caused to implement a method for buffering word die data as provided in any of the above embodiments, the method comprising:
acquiring target matrix data corresponding to target characters;
taking a target character code corresponding to the target character as an element index value to obtain a target element position corresponding to the target character code in a preset index array;
determining a target index value corresponding to the target character code, and storing the target index value to a target element position;
and determining a target cache unit according to the target index value, and storing the target word model data into the target cache unit.
One processor 410 is illustrated in fig. 6; the processor 410 and memory 420 in the device may be connected by a bus or other means, for example in fig. 6.
The memory 420 is a computer readable storage medium, and may be used to store software programs, computer executable programs, and modules, such as program instructions/modules corresponding to the method for buffering word data in the embodiment of the present invention (e.g., the target word data obtaining module 310, the target element position obtaining module 320, the target index value storing module 330, and the target word data storing module 340 in the word data buffering device). The processor 410 executes various functional applications of the device and data processing, i.e., implements the above-described word-based data caching method, by running software programs, instructions, and modules stored in the memory 420.
The memory 420 mainly includes a memory program area and a memory data area, wherein the memory program area can store an operating system, at least one application program required for functions; the storage data area may store data created according to the use of the device, etc. In addition, memory 420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, memory 420 may further include memory located remotely from processor 410, which may be connected to the device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The apparatus proposed in this embodiment belongs to the same inventive concept as the word-matrix data caching method proposed in the foregoing embodiment, and technical details not described in detail in this embodiment may be found in the foregoing embodiment, and this embodiment has the same beneficial effects of executing the word-matrix data caching method.
Example five
A fifth embodiment provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for buffering word-pattern data as provided in any embodiment of the present invention, the method comprising:
acquiring target matrix data corresponding to target characters;
taking a target character code corresponding to the target character as an element index value to obtain a target element position corresponding to the target character code in a preset index array;
determining a target index value corresponding to the target character code, and storing the target index value to a target element position;
and determining a target cache unit according to the target index value, and storing the target word model data into the target cache unit.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium may be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
It will be appreciated by those of ordinary skill in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be centralized on a single computing device, or distributed over a network of computing devices, or they may alternatively be implemented in program code executable by a computer device, such that they are stored in a memory device and executed by the computing device, or they may be separately fabricated as individual integrated circuit modules, or multiple modules or steps within them may be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.
Claims (9)
1. A method for buffering typeface data, comprising:
acquiring target matrix data corresponding to target characters;
taking a target character code corresponding to the target character as an element index value to obtain a target element position corresponding to the target character code in a preset index array;
determining a target index value corresponding to the target character code, and storing the target index value to the target element position;
determining a target cache unit according to the target index value, and storing the target word model data into the target cache unit;
determining a target index value corresponding to the target character code, including:
if no index value exists in the current preset index array, determining a target index value corresponding to the target character code as 1;
if the index value exists in the current preset index array, acquiring the maximum index value in the current preset index array, adding 1 to the maximum index value, and determining the obtained calculation result as the target index value corresponding to the target character code.
2. The method of claim 1, wherein determining a target cache location from the target index value comprises:
and determining a target cache unit corresponding to the target index value from the pre-allocated cache units according to the corresponding relation between the pre-stored index value and the cache units.
3. The method of claim 2, wherein the number of pre-allocated cache units is equal to the number of characters, and the memory space of the cache units is pre-determined according to the word size information of the characters.
4. The method of claim 1, wherein determining a target cache location from the target index value comprises:
determining a target address pointer and a target sequence number corresponding to the second-level table according to the target index value;
detecting whether the target address pointer is an empty address according to a first-level table;
if yes, a new second-level table is allocated based on the target address pointer, the target address pointer is stored in the first-level table, and a cache unit corresponding to the target sequence number in the second-level table allocated currently is determined to be a target cache unit;
if not, determining the cache unit corresponding to the target sequence number in the existing second-level table corresponding to the target address pointer as a target cache unit.
5. The method of claim 4, wherein determining the target address pointer and the target sequence number corresponding to the second level table based on the target index value comprises:
dividing the target index value by a preset unit number, determining the obtained quotient as a target address pointer corresponding to a second-level table, and determining the obtained remainder as a target sequence number corresponding to the second-level table, wherein the preset unit number is the number of cache units contained in the second-level table.
6. The method of any of claims 1-5, further comprising, after storing the target word stock data in the target cache unit:
acquiring character codes to be extracted corresponding to the character model data to be extracted;
determining an index value to be extracted corresponding to the character code to be extracted according to the character code to be extracted and the preset index array;
and determining a cache unit to be extracted according to the index value to be extracted, and extracting the word model data to be extracted in the cache unit to be extracted.
7. A word module data caching apparatus, comprising:
the target matrix data acquisition module is used for acquiring target matrix data corresponding to the target characters;
the target element position obtaining module is used for taking a target character code corresponding to the target character as an element index value to obtain a target element position corresponding to the target character code in a preset index array;
the target index value storage module is used for determining a target index value corresponding to the target character code and storing the target index value to the target element position;
the target matrix data storage module is used for determining a target cache unit according to the target index value and storing the target matrix data into the target cache unit;
the target index value storage module includes: a target index value determining unit configured to: if no index value exists in the current preset index array, determining a target index value corresponding to the target character code as 1; if the index value exists in the current preset index array, acquiring the maximum index value in the current preset index array, adding 1 to the maximum index value, and determining the obtained calculation result as a target index value corresponding to the target character code.
8. A buffering device for word-mould data, the device comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, causes the one or more processors to implement the method of buffering typeface data as recited in any one of claims 1-6.
9. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a method of buffering word template data according to any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910435174.3A CN110147330B (en) | 2019-05-23 | 2019-05-23 | Word matrix data caching method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910435174.3A CN110147330B (en) | 2019-05-23 | 2019-05-23 | Word matrix data caching method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110147330A CN110147330A (en) | 2019-08-20 |
CN110147330B true CN110147330B (en) | 2023-09-01 |
Family
ID=67592976
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910435174.3A Active CN110147330B (en) | 2019-05-23 | 2019-05-23 | Word matrix data caching method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110147330B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110837575B (en) * | 2019-10-31 | 2023-02-24 | 广州方硅信息技术有限公司 | Method and device for generating transmission characteristic information of video image |
CN112069366B (en) * | 2020-08-28 | 2024-02-09 | 喜大(上海)网络科技有限公司 | Recall determination method, recall determination device, recall determination equipment and storage medium |
CN112949257A (en) * | 2021-02-26 | 2021-06-11 | 深圳市英威腾电气股份有限公司 | Character display method, device, equipment and computer readable storage medium |
CN112988795A (en) * | 2021-02-26 | 2021-06-18 | 开放智能机器(上海)有限公司 | Number retrieval method, system, equipment and storage medium |
CN114035974A (en) * | 2021-10-14 | 2022-02-11 | 杭州隆埠科技有限公司 | Data operation method and device |
CN115687669B (en) * | 2022-10-12 | 2024-06-21 | 广州中望龙腾软件股份有限公司 | Text caching method, terminal and storage medium |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101083770A (en) * | 2002-08-08 | 2007-12-05 | 松下电器产业株式会社 | Method for encoding and decoding moving image |
CN102637422A (en) * | 2012-02-17 | 2012-08-15 | 天地融科技股份有限公司 | Matrix obtaining method, character display device and system and electronic signature tool |
CN104657362A (en) * | 2013-11-18 | 2015-05-27 | 深圳市腾讯计算机系统有限公司 | Method and device for storing and querying data |
CN106294291A (en) * | 2016-07-20 | 2017-01-04 | 中国航空无线电电子研究所 | A kind of TrueType font rendering intent |
CN106484734A (en) * | 2015-09-01 | 2017-03-08 | 天脉聚源(北京)科技有限公司 | A kind of data query caching method and system |
CN106528647A (en) * | 2016-10-15 | 2017-03-22 | 北京语联炉火信息技术有限公司 | Term matching method based on a cedar double-array trie algorithm |
CN107071471A (en) * | 2011-10-28 | 2017-08-18 | 太阳专利托管公司 | Method for encoding images and picture coding device |
CN107291858A (en) * | 2017-06-09 | 2017-10-24 | 成都索贝数码科技股份有限公司 | Data indexing method based on character string suffix |
CN107402817A (en) * | 2017-08-01 | 2017-11-28 | 深圳创维数字技术有限公司 | Save method, apparatus, set top box and the storage medium of internal memory |
CN107622115A (en) * | 2017-09-19 | 2018-01-23 | 武大吉奥信息技术有限公司 | A kind of space querying result cache method towards WFS services |
CN109299719A (en) * | 2018-09-30 | 2019-02-01 | 武汉斗鱼网络科技有限公司 | Barrage method of calibration, device, terminal and storage medium based on Character segmentation |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8099555B2 (en) * | 2009-01-23 | 2012-01-17 | Konica Minolta Laboratory U.S.A., Inc. | Systems and methods for memory management on print devices |
US8266409B2 (en) * | 2009-03-03 | 2012-09-11 | Qualcomm Incorporated | Configurable cache and method to configure same |
-
2019
- 2019-05-23 CN CN201910435174.3A patent/CN110147330B/en active Active
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101083770A (en) * | 2002-08-08 | 2007-12-05 | 松下电器产业株式会社 | Method for encoding and decoding moving image |
CN107071471A (en) * | 2011-10-28 | 2017-08-18 | 太阳专利托管公司 | Method for encoding images and picture coding device |
CN102637422A (en) * | 2012-02-17 | 2012-08-15 | 天地融科技股份有限公司 | Matrix obtaining method, character display device and system and electronic signature tool |
CN104657362A (en) * | 2013-11-18 | 2015-05-27 | 深圳市腾讯计算机系统有限公司 | Method and device for storing and querying data |
CN106484734A (en) * | 2015-09-01 | 2017-03-08 | 天脉聚源(北京)科技有限公司 | A kind of data query caching method and system |
CN106294291A (en) * | 2016-07-20 | 2017-01-04 | 中国航空无线电电子研究所 | A kind of TrueType font rendering intent |
CN106528647A (en) * | 2016-10-15 | 2017-03-22 | 北京语联炉火信息技术有限公司 | Term matching method based on a cedar double-array trie algorithm |
CN107291858A (en) * | 2017-06-09 | 2017-10-24 | 成都索贝数码科技股份有限公司 | Data indexing method based on character string suffix |
CN107402817A (en) * | 2017-08-01 | 2017-11-28 | 深圳创维数字技术有限公司 | Save method, apparatus, set top box and the storage medium of internal memory |
CN107622115A (en) * | 2017-09-19 | 2018-01-23 | 武大吉奥信息技术有限公司 | A kind of space querying result cache method towards WFS services |
CN109299719A (en) * | 2018-09-30 | 2019-02-01 | 武汉斗鱼网络科技有限公司 | Barrage method of calibration, device, terminal and storage medium based on Character segmentation |
Non-Patent Citations (1)
Title |
---|
基于VB实现的的汉字点阵字模的提取方法;范志敏 等;《全国冶金自动化信息网年会论文集》;20040801;421-423 * |
Also Published As
Publication number | Publication date |
---|---|
CN110147330A (en) | 2019-08-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110147330B (en) | Word matrix data caching method, device, equipment and storage medium | |
US9940744B2 (en) | Remote font management | |
WO2015172533A1 (en) | Database query method and server | |
CN108959127B (en) | Address translation method, device and system | |
KR102147356B1 (en) | Cache memory system and operating method for the same | |
CN108984553B (en) | Caching method and device | |
CN111722918A (en) | Service identification code generation method and device, storage medium and electronic equipment | |
CN105468365A (en) | Method for solving tree control node quantity restriction | |
US11822811B2 (en) | Method, electronic device and computer program product for processing data | |
CN105528345B (en) | Terminal, server and character complementing method | |
CN109376125A (en) | A kind of metadata storing method, device, equipment and computer readable storage medium | |
CN101483035B (en) | Method and system for display text on graphical interface | |
CN115964002B (en) | Electric energy meter terminal archive management method, device, equipment and medium | |
US9639566B2 (en) | Method, apparatus and computer program product for improved storage of key-value pairs | |
CN109165712A (en) | Distributed generation method, device and computer storage medium by stages number | |
CN107748649B (en) | Method and device for caching data | |
EP3872642A1 (en) | Caching device, cache, system, method and apparatus for processing data, and medium | |
CN104424163A (en) | Word processing method and system | |
CN116166583B (en) | Data precision conversion method and device, DMA controller and medium | |
WO2024124843A1 (en) | Data processing method and apparatus, and device and readable storage medium | |
CN109144853B (en) | Software defined radio SoC chip debugging system | |
CN111858612A (en) | Data accelerated access method and device based on graph database and storage medium | |
US9258258B2 (en) | Implementing injection of formal numerical message identifiers in cloud stacks | |
CN115277553B (en) | Stream table storage method, device, equipment and computer readable storage medium | |
EP4120060A1 (en) | Method and apparatus of storing data,and method and apparatus of reading data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |