CN111143240A - Image storage method, system and terminal equipment - Google Patents
Image storage method, system and terminal equipment Download PDFInfo
- Publication number
- CN111143240A CN111143240A CN201911416252.1A CN201911416252A CN111143240A CN 111143240 A CN111143240 A CN 111143240A CN 201911416252 A CN201911416252 A CN 201911416252A CN 111143240 A CN111143240 A CN 111143240A
- Authority
- CN
- China
- Prior art keywords
- stored
- image
- size
- address
- 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.)
- Granted
Links
Images
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/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
- G06F12/0238—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
- G06F12/0246—Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0608—Saving storage space on storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0629—Configuration or reconfiguration of storage systems
- G06F3/0635—Configuration or reconfiguration of storage systems by changing the path, e.g. traffic rerouting, path reconfiguration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Computer Networks & Wireless Communication (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention is suitable for the technical field of data storage, and discloses an image storage method, an image storage system and terminal equipment, wherein the image storage method comprises the following steps: acquiring the size of an image to be stored, calculating the number of sectors to be erased according to the size of the image to be stored and the size of the sectors acquired in advance, and erasing the sectors from an address to be stored according to the number of the sectors; writing the size of the image to be stored into the address to be stored, and updating the address to be stored; acquiring data of an image to be stored, writing the data of the image to be stored into the updated address to be stored, and obtaining a new address to be stored after the data of the image to be stored is written; and if the next image to be stored exists, taking the next image to be stored as a new image to be stored, and continuing to execute the step of obtaining the size of the image to be stored. The invention can realize continuous storage of images, reduce the waste of storage space, increase the identification area before each image data is stored, and segment each image for convenient reading.
Description
Technical Field
The invention belongs to the technical field of data storage, and particularly relates to an image storage method, an image storage system and terminal equipment.
Background
The internal storage space of the chip based on the ARM-Cortex M4 kernel is not enough to store overlarge images, and is usually solved by externally extending Flash. In general, a Nor Flash chip is used as an external memory chip.
Since the Nor Flash chip has the characteristic of erasing according to the sector, the Nor Flash chip usually stores the image directly by taking the sector as a unit, but because the size of the image is different and the size of the sector is generally larger, the storage method easily causes the waste of the storage space.
Disclosure of Invention
In view of this, embodiments of the present invention provide an image storage method, an image storage system, and a terminal device, so as to solve the problem in the prior art that the storage method is prone to waste of storage space due to different image sizes and generally larger sector sizes.
A first aspect of an embodiment of the present invention provides an image storage method, including:
acquiring the size of an image to be stored, calculating the number of sectors to be erased according to the size of the image to be stored and the size of the sectors acquired in advance, and erasing the sectors from an address to be stored according to the number of the sectors;
writing the size of the image to be stored into the address to be stored, and updating the address to be stored;
acquiring data of an image to be stored, writing the data of the image to be stored into the updated address to be stored, and obtaining a new address to be stored after the data of the image to be stored is written;
and if the next image to be stored exists, taking the next image to be stored as a new image to be stored, and continuing to execute the step of obtaining the size of the image to be stored.
A second aspect of an embodiment of the present invention provides an image storage system, including:
the sector erasing module is used for acquiring the size of the image to be stored, calculating the number of sectors to be erased according to the size of the image to be stored and the size of the sectors acquired in advance, and erasing the sectors from the address to be stored according to the number of the sectors;
the image size writing module is used for writing the size of the image to be stored into the address to be stored and updating the address to be stored;
the image data writing module is used for acquiring the data of the image to be stored, writing the data of the image to be stored into the updated address to be stored, and obtaining a new address to be stored after the data of the image to be stored is written;
and the image continuous storage module is used for taking the next image to be stored as a new image to be stored and continuously executing the step of obtaining the size of the image to be stored if the next image to be stored exists.
A third aspect of embodiments of the present invention provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the image storage method according to the first aspect when executing the computer program.
A fourth aspect of embodiments of the present invention provides a computer-readable storage medium, in which a computer program is stored, which, when executed by one or more processors, implements the steps of the image storage method according to the first aspect.
Compared with the prior art, the embodiment of the invention has the following beneficial effects: the method comprises the steps of firstly obtaining the size of an image to be stored, calculating the number of sectors needing to be erased according to the size of the image to be stored and the size of the sectors obtained in advance, erasing the sectors from an address to be stored according to the number of the sectors, then writing the size of the image to be stored into the address to be stored, updating the address to be stored, then obtaining the data of the image to be stored, writing the data of the image to be stored into the updated address to be stored, obtaining a new address to be stored after the data of the image to be stored is written, and finally taking the next image to be stored as the new image to be stored if the next image to be stored exists and continuously executing the step of obtaining the size of the image to be stored. The embodiment of the invention can realize continuous storage of the images, reduce the waste of storage space, and increase the identification area before each image data is stored by storing the size of the image before each image data, so that each image is divided, and the reading is convenient.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic flow chart illustrating an implementation of an image storage method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of an implementation of an image storage method according to another embodiment of the present invention;
FIG. 3 is a schematic block diagram of an image storage system provided by an embodiment of the present invention;
fig. 4 is a schematic block diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Fig. 1 is a schematic flow chart of an implementation of an image storage method according to an embodiment of the present invention, and for convenience of description, only a part related to the embodiment of the present invention is shown. The execution main body of the embodiment of the invention can be terminal equipment. As shown in fig. 1, the method may include the steps of:
s101: the size of the image to be stored is obtained, the number of sectors needing to be erased is calculated according to the size of the image to be stored and the size of the sectors obtained in advance, and the sectors are erased from the address to be stored according to the number of the sectors.
In the embodiment of the present invention, the number of the images to be stored may be one or more, and if there are a plurality of images to be stored, the images may be sequentially stored in sequence.
Dividing the size of the image to be stored by the size of the sector to obtain the number of sectors needing to be erased, and erasing the sector from the address to be stored, wherein the number of the erased sectors is the number of the sectors needing to be erased. The address to be stored is the current storage address, that is, the storage space before the address to be stored stores data. The size of each sector is fixed, for example the size of each sector may be 128 KB.
Optionally, if the remaining storable space of the sector to which the address to be stored belongs can store the size of the image to be stored and the data of the image to be stored, that is, the sum of the first preset size and the size of the image to be stored is less than or equal to the size of the remaining storable space of the sector to which the address to be stored belongs, the sector does not need to be erased, and the step S102 is directly performed. The first storage space with the preset size is a storage space with a preset size for storing the size of the image to be stored.
If the sector to which the address to be stored belongs is erased, erasing is started from the next sector of the sector, and the number of the erased sectors is the number of the sectors needing to be erased. If the value obtained by dividing the size of the image to be stored by the size of the sector is a decimal, rounding up the decimal to obtain the number of the sectors needing to be erased.
S102: and writing the size of the image to be stored into the address to be stored, and updating the address to be stored.
In the embodiment of the invention, before the data of the image to be stored is stored, the size of the image to be stored is written into the address to be stored, and the address to be stored is updated. The area for storing the size of the image to be stored is an identification area of the image to be stored, and may also be referred to as an index area of the image to be stored, and the identification area of each image may be used to segment the continuously stored image, and may also be used to know the size of the image, so as to facilitate reading.
Specifically, the address to be stored is updated by shifting the address to be stored backward by a first preset size, so as to obtain an updated address to be stored. The first preset size is a preset space for storing the size of the image to be stored, and may be set according to actual requirements, for example, may be set to 4 bytes.
S103: and acquiring data of the image to be stored, writing the data of the image to be stored into the updated address to be stored, and obtaining a new address to be stored after the data of the image to be stored is written.
In the embodiment of the invention, the data of the image to be stored is acquired, and the data of the image to be stored is written in from the updated address to be stored. And after the data of the image to be stored is written, a new address to be stored can be obtained. The new address to be stored is obtained by shifting the updated address to be stored backward, and the backward shifted address is the size of the image to be stored.
S104: and if the next image to be stored exists, taking the next image to be stored as a new image to be stored, and continuing to execute the step of obtaining the size of the image to be stored.
When the number of the images to be stored is greater than one, that is, there is a next image to be stored, at this time, the next image to be stored is used as a new image to be stored, and the step S101 is returned to execute in a loop according to the new address to be stored until all the images to be stored are stored.
And if the number of the images to be stored is one, finishing the image storage.
As can be seen from the above description, in the embodiment of the present invention, the size of the image to be stored is written into the address to be stored, the address to be stored is updated, the data of the image to be stored is written into the updated address to be stored, and after the data of the image to be stored is written into the address to be stored, a new address to be stored is obtained, if there is a next image to be stored, the next image to be stored is used as a new image to be stored, and the step of obtaining the size of the image to be stored is continuously performed, so that continuous storage of the image can be realized, waste of storage space is reduced, and storage performance is improved; by storing the size of the image before each image data, it is possible to increase the identification area before each image data is stored, to segment the respective images from each other, while the identification area indicates the size of each image, to facilitate reading.
Fig. 2 is a schematic flow chart of an implementation of an image storage method according to an embodiment of the present invention, and for convenience of description, only a part related to the embodiment of the present invention is shown. As shown in fig. 2, after "acquiring the data of the image to be stored and writing the data of the image to be stored into the updated address to be stored" in step S103, the method may further include the following steps:
s201: and calculating a first check code according to the data of the image to be stored.
In the embodiment of the present invention, the first check code may be calculated by using an existing method according to the data of the image to be stored. The first Check code may be a Cyclic Redundancy Check (CRC).
S202: and after the data of the image to be stored is written, reading the written data of the image to be stored from the updated address to be stored, and calculating a second check code according to the read written data.
After the data of the image to be stored is completely written, reading the written data of the image to be stored from the address of the data of the image to be stored, namely the updated address to be stored, and calculating a second check code according to the read data of the image to be stored. The method for calculating the second check code is the same as the method for calculating the first check code, and the second check code may be a CRC check code.
S203: and if the first check code is the same as the second check code, continuing to execute the step of obtaining a new address to be stored after the data of the image to be stored is written.
In the embodiment of the invention, whether the written data of the image to be stored is correct and complete can be judged by comparing whether the first check code and the second check code are the same.
If the first check code is the same as the second check code, which indicates that the written data of the image to be stored is correct and complete, the step of "obtaining a new address to be stored" after the data of the image to be stored is written "in step S103 may be continuously performed. The next image to be stored may continue to be stored.
S204: and if the first check code is different from the second check code, prompting image storage failure information and quitting the image storage process.
And if the first check code and the second check code are different, which indicates that the written data of the image to be stored may be wrong or incomplete, directly prompting the user of image storage failure information, and exiting the image storage process.
As can be seen from the above description, in the embodiment of the present invention, by calculating the first check code according to the data of the image to be stored before writing, calculating the second check code according to the read data of the image to be stored after writing, and comparing whether the first check code and the second check code are the same, it can be determined whether the written data of the image to be stored is correct and complete.
In an embodiment of the present invention, after "acquiring the size of the image to be stored" in the step S101, the method may further include the steps of:
and calculating a third check code according to the size of the image to be stored.
In an embodiment of the present invention, the "writing the size of the image to be stored in the address to be stored" in the step S102 may include:
and writing the size of the image to be stored and the third check code into the address to be stored.
In the embodiment of the present invention, the third check code may be a CRC check code. The CRC operation may be performed according to the size of the image to be stored, and the third check code may be obtained. Other existing methods can also be used to calculate the third check code according to the size of the image to be stored. The third check code is used for confirming the validity of the address.
The size of the image to be stored and the third check code can be written into the address to be stored together, and then the address to be stored is updated. Specifically, starting from the address to be stored, writing the size of the image to be stored and a third check code into a storage space with a second preset size; and updating the address to be stored according to the address to be stored and the second preset size. The second preset size may be set according to actual requirements, for example, the second preset size may be set to 6 bytes, the size of the image to be stored may be 4 bytes, and the third check code may be stored in 2 bytes. And the address to be stored is shifted backwards by the address with the second preset size to obtain an updated address to be stored.
In an embodiment of the present invention, the step S102 may include the following steps:
writing the size of the image to be stored into a first preset size of storage space from the address to be stored;
and updating the address to be stored according to the address to be stored and the first preset size.
In the embodiment of the invention, the size of the image to be stored is written into the storage space with the first preset size. And the address to be stored is shifted backwards by the first preset size to obtain an updated address to be stored.
When the images need to be read, the storage addresses and the image sizes of all the images in NorFlash can be obtained only by searching from the NorFlash image initial addresses one by one according to the sequence of the stored structure array (the identification area and the image data area). And applying for a memory buffer area according to the storage address and the image size, and reading the image from NorFlash according to the storage address and the image size so as to display the image.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Fig. 3 is a schematic block diagram of an image storage system according to an embodiment of the present invention, and only a part related to the embodiment of the present invention is shown for convenience of explanation.
In an embodiment of the present invention, the image storage system 30 may include a sector erase module 301, an image size write module 302, an image data write module 303, and an image continuation storage module 304.
The sector erasing module 301 is configured to obtain the size of an image to be stored, calculate the number of sectors to be erased according to the size of the image to be stored and the size of a sector obtained in advance, and erase the sector from an address to be stored according to the number of sectors;
an image size writing module 302, configured to write the size of the image to be stored into the address to be stored, and update the address to be stored;
the image data writing module 303 is configured to acquire data of an image to be stored, write the data of the image to be stored into the updated address to be stored, and obtain a new address to be stored after the data of the image to be stored is written;
and an image continuing storage module 304, configured to, if there is a next image to be stored, take the next image to be stored as a new image to be stored, and continue to perform the step of obtaining the size of the image to be stored.
Optionally, the image storage system 30 may further include a first check code calculation module, a second check code calculation module, a first processing module, and a second processing module.
The first check code calculating module is used for calculating a first check code according to the data of the image to be stored;
the second check code calculation module is used for reading the written data of the image to be stored from the updated address to be stored after the data of the image to be stored is written, and calculating a second check code according to the read written data;
the first processing module is used for continuing to execute the steps and obtaining a new address to be stored after the data of the image to be stored is written into the image to be stored if the first check code is the same as the second check code;
and the second processing module is used for prompting the image storage failure information and quitting the image storage process if the first check code is different from the second check code.
Optionally, the image storage system 30 may further include a third check code calculation module.
And the third check code calculating module is used for calculating a third check code according to the size of the image to be stored.
Optionally, the image size writing module 302 is further configured to:
and writing the size of the image to be stored and the third check code into the address to be stored.
Optionally, the image size writing module 302 is specifically configured to:
writing the size of the image to be stored into a first preset size of storage space from the address to be stored;
and updating the address to be stored according to the address to be stored and the first preset size.
It will be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional units and modules is merely used as an example, and in practical applications, the foregoing function distribution may be performed by different functional units and modules as needed, that is, the internal structure of the image storage system is divided into different functional units or modules to perform all or part of the above-described functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the above-mentioned apparatus may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Fig. 4 is a schematic block diagram of a terminal device according to an embodiment of the present invention. As shown in fig. 4, the terminal device 40 of this embodiment includes: one or more processors 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processors 401. The processor 401, when executing the computer program 403, implements the steps in the various image storage method embodiments described above, such as steps S101 to S104 shown in fig. 1. Alternatively, the processor 401, when executing the computer program 403, implements the functions of the modules/units in the above-described image storage system embodiment, such as the functions of the modules 301 to 304 shown in fig. 3.
Illustratively, the computer program 403 may be partitioned into one or more modules/units that are stored in the memory 402 and executed by the processor 401 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used for describing the execution process of the computer program 403 in the terminal device 40. For example, the computer program 403 may be divided into a sector erasing module, an image size writing module, an image data writing module, and an image continuation storage module, and each module has the following specific functions:
the sector erasing module is used for acquiring the size of the image to be stored, calculating the number of sectors to be erased according to the size of the image to be stored and the size of the sectors acquired in advance, and erasing the sectors from the address to be stored according to the number of the sectors;
the image size writing module is used for writing the size of the image to be stored into the address to be stored and updating the address to be stored;
the image data writing module is used for acquiring the data of the image to be stored, writing the data of the image to be stored into the updated address to be stored, and obtaining a new address to be stored after the data of the image to be stored is written;
and the image continuous storage module is used for taking the next image to be stored as a new image to be stored and continuously executing the step of obtaining the size of the image to be stored if the next image to be stored exists.
Other modules or units can refer to the description of the embodiment shown in fig. 3, and are not described again here.
The terminal device 40 may be a computing device such as a desktop computer, a notebook, a palm computer, and a cloud server. The terminal device 40 includes, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that fig. 4 is only one example of a terminal device 40, and does not constitute a limitation to the terminal device 40, and may include more or less components than those shown, or combine some components, or different components, for example, the terminal device 40 may further include an input device, an output device, a network access device, a bus, etc.
The Processor 401 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 402 may be an internal storage unit of the terminal device 40, such as a hard disk or a memory of the terminal device 40. The memory 402 may also be an external storage device of the terminal device 40, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 40. Further, the memory 402 may also include both an internal storage unit of the terminal device 40 and an external storage device. The memory 402 is used for storing the computer program 403 and other programs and data required by the terminal device 40. The memory 402 may also be used to temporarily store data that has been output or is to be output.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed image storage system and method may be implemented in other ways. For example, the above-described embodiments of the image storage system are merely illustrative, and for example, the division of the modules or units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media which may not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.
Claims (10)
1. An image storage method, comprising:
acquiring the size of an image to be stored, calculating the number of sectors to be erased according to the size of the image to be stored and the size of a sector acquired in advance, and erasing the sector from an address to be stored according to the number of the sectors;
writing the size of the image to be stored into the address to be stored, and updating the address to be stored;
acquiring data of the image to be stored, writing the data of the image to be stored into the updated address to be stored, and obtaining a new address to be stored after the data of the image to be stored is written;
and if the next image to be stored exists, taking the next image to be stored as a new image to be stored, and continuously executing the step of obtaining the size of the image to be stored.
2. The image storage method according to claim 1, wherein after the acquiring the data of the image to be stored and writing the data of the image to be stored in the updated address to be stored, the image storage method further comprises:
calculating a first check code according to the data of the image to be stored;
after the data of the image to be stored is written, reading the written data of the image to be stored from the updated address to be stored, and calculating a second check code according to the read written data;
if the first check code is the same as the second check code, continuing to execute the step of obtaining a new address to be stored after the data of the image to be stored is written;
and if the first check code is different from the second check code, prompting image storage failure information and quitting the image storage process.
3. The image storage method according to claim 1, wherein after said obtaining the size of the image to be stored, the image storage method further comprises:
and calculating a third check code according to the size of the image to be stored.
4. The image storage method according to claim 3, wherein the writing the size of the image to be stored into the address to be stored comprises:
and writing the size of the image to be stored and the third check code into the address to be stored.
5. The image storage method according to any one of claims 1 to 4, wherein the writing the size of the image to be stored into the address to be stored and updating the address to be stored comprises:
writing the size of the image to be stored into a storage space with a first preset size from the address to be stored;
and updating the address to be stored according to the address to be stored and the first preset size.
6. An image storage system, comprising:
the sector erasing module is used for acquiring the size of an image to be stored, calculating the number of sectors to be erased according to the size of the image to be stored and the size of the sectors acquired in advance, and erasing the sectors from addresses to be stored according to the number of the sectors;
the image size writing module is used for writing the size of the image to be stored into the address to be stored and updating the address to be stored;
the image data writing module is used for acquiring the data of the image to be stored, writing the data of the image to be stored into the updated address to be stored, and obtaining a new address to be stored after the data of the image to be stored is written;
and the image continuous storage module is used for taking the next image to be stored as a new image to be stored and continuously executing the step of obtaining the size of the image to be stored if the next image to be stored exists.
7. The image storage system according to claim 6, further comprising:
the first check code calculating module is used for calculating a first check code according to the data of the image to be stored;
the second check code calculation module is used for reading the written data of the image to be stored from the updated address to be stored after the data of the image to be stored is written, and calculating a second check code according to the read written data;
the first processing module is used for continuing to execute the step of obtaining a new address to be stored after the data of the image to be stored is written into the image to be stored if the first check code is the same as the second check code;
and the second processing module is used for prompting image storage failure information and quitting the image storage process if the first check code is different from the second check code.
8. The image storage system according to claim 6, further comprising:
and the third check code calculation module is used for calculating a third check code according to the size of the image to be stored.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the image storage method according to any one of claims 1 to 5 when executing the computer program.
10. A computer-readable storage medium, characterized in that it stores a computer program which, when executed by one or more processors, implements the steps of the image storage method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911416252.1A CN111143240B (en) | 2019-12-31 | 2019-12-31 | Image storage method, system and terminal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911416252.1A CN111143240B (en) | 2019-12-31 | 2019-12-31 | Image storage method, system and terminal equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111143240A true CN111143240A (en) | 2020-05-12 |
CN111143240B CN111143240B (en) | 2022-07-05 |
Family
ID=70522744
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911416252.1A Active CN111143240B (en) | 2019-12-31 | 2019-12-31 | Image storage method, system and terminal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111143240B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113696732A (en) * | 2020-05-20 | 2021-11-26 | 北京新能源汽车股份有限公司 | Low-voltage power-down control method and device and electric automobile |
CN114816832A (en) * | 2022-04-15 | 2022-07-29 | 巨翊科技(上海)有限公司 | Data management method, device and system of single chip microcomputer |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050038955A1 (en) * | 2003-04-03 | 2005-02-17 | Chih-Wei Chen | Flash ROM content updating method and system |
CN101241469A (en) * | 2007-02-05 | 2008-08-13 | 力博特公司 | Method and device for storing and reading data in embedded system |
US20090210634A1 (en) * | 2008-02-20 | 2009-08-20 | Hitachi, Ltd. | Data transfer controller, data consistency determination method and storage controller |
US20090240860A1 (en) * | 2008-03-24 | 2009-09-24 | Coon Brett W | Lock Mechanism to Enable Atomic Updates to Shared Memory |
CN102045258A (en) * | 2010-12-22 | 2011-05-04 | 北京星网锐捷网络技术有限公司 | Data caching management method and device |
CN102591789A (en) * | 2011-12-26 | 2012-07-18 | 成都市华为赛门铁克科技有限公司 | Storage space recovery method and storage space recovery device |
CN102681918A (en) * | 2012-05-17 | 2012-09-19 | 华为技术有限公司 | Data storage and backup method and device |
CN106407050A (en) * | 2016-10-20 | 2017-02-15 | 厦门科华恒盛股份有限公司 | Data storage method |
CN110023896A (en) * | 2016-12-19 | 2019-07-16 | 净睿存储股份有限公司 | The merged block in flash-memory storage system directly mapped |
CN110515544A (en) * | 2019-08-06 | 2019-11-29 | 科华恒盛股份有限公司 | The method and terminal device of data storage |
-
2019
- 2019-12-31 CN CN201911416252.1A patent/CN111143240B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050038955A1 (en) * | 2003-04-03 | 2005-02-17 | Chih-Wei Chen | Flash ROM content updating method and system |
CN101241469A (en) * | 2007-02-05 | 2008-08-13 | 力博特公司 | Method and device for storing and reading data in embedded system |
US20090210634A1 (en) * | 2008-02-20 | 2009-08-20 | Hitachi, Ltd. | Data transfer controller, data consistency determination method and storage controller |
US20090240860A1 (en) * | 2008-03-24 | 2009-09-24 | Coon Brett W | Lock Mechanism to Enable Atomic Updates to Shared Memory |
CN102045258A (en) * | 2010-12-22 | 2011-05-04 | 北京星网锐捷网络技术有限公司 | Data caching management method and device |
CN102591789A (en) * | 2011-12-26 | 2012-07-18 | 成都市华为赛门铁克科技有限公司 | Storage space recovery method and storage space recovery device |
CN102681918A (en) * | 2012-05-17 | 2012-09-19 | 华为技术有限公司 | Data storage and backup method and device |
CN106407050A (en) * | 2016-10-20 | 2017-02-15 | 厦门科华恒盛股份有限公司 | Data storage method |
CN110023896A (en) * | 2016-12-19 | 2019-07-16 | 净睿存储股份有限公司 | The merged block in flash-memory storage system directly mapped |
CN110515544A (en) * | 2019-08-06 | 2019-11-29 | 科华恒盛股份有限公司 | The method and terminal device of data storage |
Non-Patent Citations (1)
Title |
---|
朱浩: "SSD文件***优化技术的研究与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113696732A (en) * | 2020-05-20 | 2021-11-26 | 北京新能源汽车股份有限公司 | Low-voltage power-down control method and device and electric automobile |
CN114816832A (en) * | 2022-04-15 | 2022-07-29 | 巨翊科技(上海)有限公司 | Data management method, device and system of single chip microcomputer |
CN114816832B (en) * | 2022-04-15 | 2023-03-17 | 巨翊科技(上海)有限公司 | Data management method, device and system of single chip microcomputer |
Also Published As
Publication number | Publication date |
---|---|
CN111143240B (en) | 2022-07-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110245220B (en) | Electronic document signing method, electronic document signing device, electronic document server and storage medium | |
CN111090628B (en) | Data processing method and device, storage medium and electronic equipment | |
CN109814524B (en) | Vehicle diagnosis method, device and system | |
CN112765271A (en) | Block chain transaction index storage method and device, computer equipment and medium | |
CN111159329B (en) | Sensitive word detection method, device, terminal equipment and computer readable storage medium | |
CN111143240B (en) | Image storage method, system and terminal equipment | |
CN108632624B (en) | Image data processing method and device, terminal equipment and readable storage medium | |
CN111090663A (en) | Transaction concurrency control method, device, terminal equipment and medium | |
CN111694589B (en) | Upgrade package generation method, device, server and computer readable storage medium | |
CN111208933A (en) | Data access method, device, equipment and storage medium | |
CN115129257A (en) | Data reading and writing method, electronic equipment and computer readable storage medium | |
CN111522574B (en) | Differential packet generation method and related equipment | |
CN111104178A (en) | Dynamic library loading method, terminal device and storage medium | |
CN113129150A (en) | Transaction data processing method and device, terminal device and readable storage medium | |
CN111210004A (en) | Convolution calculation method, convolution calculation device and terminal equipment | |
CN112015459A (en) | Method and device for upgrading image file, terminal and readable storage medium | |
CN112269665A (en) | Memory processing method and device, electronic equipment and storage medium | |
CN113272785B (en) | Method for mounting file system, terminal equipment and storage medium | |
CN109324838B (en) | Execution method and execution device of single chip microcomputer program and terminal | |
CN111143092A (en) | Fault recording data processing method and system and terminal equipment | |
CN107257281B (en) | Method, apparatus and computer readable storage medium for NOR F L ASH storage key record | |
US9003364B2 (en) | Overriding system attributes and function returns in a software subsystem | |
CN114968841A (en) | Information flash memory storage method and device, computer equipment and storage medium | |
CN113760237A (en) | Compiling address updating method and device, terminal equipment and readable storage medium | |
CN111427550A (en) | Object creating method, terminal device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CB02 | Change of applicant information |
Address after: 361101 Ma Long Road 457, Torch Garden, Xiamen Torch High-tech Zone, Fujian Province Applicant after: Kehua Data Co.,Ltd. Applicant after: Zhangzhou Kehua Technology Co., Ltd Address before: 361101 Ma Long Road 457, Torch Garden, Xiamen Torch High-tech Zone, Fujian Province Applicant before: XIAMEN KEHUAHENGSHENG LIMITED BY SHARE Ltd. Applicant before: Zhangzhou Kehua Technology Co., Ltd |
|
CB02 | Change of applicant information |