A data processing method of an electronic device with a pre-recording function and related products

CN122765147APending Publication Date: 2026-09-15YUNDING NETWORK TECH BEIJING
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610883698.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-17
Publication Date
2026-09-15

AI Technical Summary

Technical Problem

然而,当事件触发系统唤醒并准备读取预录视频时,如果不能准确读取预录视频,可能造成屏幕花屏的结果,给用户带来较差的体验

Benefits of technology

[0022] This application provides a data processing method for an electronic device with pre-recording functionality. When executing the method, in response to a wake-up event, a stop pre-recording video command is issued to control the electronic device to stop pre-recording video. Then, the current write address and the storage size of a single frame image are obtained, wherein the storage size of the single frame image and the actual total storage space size are coprime. Next, the modulo operation result of the current write address and the storage size of the single frame image is calculated, and the starting address of the pre-recorded video is determined based on the modulo operation result. Finally, the image data corresponding to the pre-recorded video is extracted based on the starting address of the pre-recorded video. Thus, by setting the storage size of the single frame image and the actual total storage space size to be coprime, only one modulo operation is needed on the obtained current write address and the storage size of the single frame image to accurately calculate the true starting address of the pre-recorded video, thereby accurately and completely extracting the pre-recorded video data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122765147A_ABST
    Figure CN122765147A_ABST
Patent Text Reader

Abstract

The application provides a data processing method of an electronic device with a pre-recording function and related products, and relates to the technical field of intelligent security protection. In response to a wake-up event trigger, a stop pre-recording video instruction is issued to control the electronic device with the pre-recording function to stop pre-recording video, the current write address and the storage size of a single frame image are obtained, the storage size of the single frame image and the actual total storage space size are prime numbers, the modulo operation result of the current write address to the storage size of the single frame image is calculated, the starting address of the pre-recording video is determined according to the modulo operation result, and finally, the image data corresponding to the pre-recording video is extracted based on the starting address of the pre-recording video. In this way, by setting the storage size of the single frame image and the actual total storage space size to be co-prime, the current write address to the storage size of the single frame image is subjected to a modulo operation, the real starting address of the pre-recording video can be accurately calculated, and the pre-recording video data can be accurately and completely extracted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of intelligent security technology, and in particular to a data processing method and related products for an electronic device with pre-recording function. Background Technology

[0002] With the rapid development of smart home security technology, smart door locks with video recording capabilities have become mainstream in the market. These devices are typically battery-powered, thus requiring stringent low-power design. In smart door lock applications, to fully record the scene before a triggering event (such as someone lingering or pressing the doorbell), the industry commonly employs a pre-roll function. The core logic of this function is that while the main control chip is in sleep mode, the image sensor continuously acquires images and writes them to a high-speed cache medium, so that a complete video clip containing the "prelude" can be saved when an event is triggered.

[0003] In hardware architectures implementing pre-recording functionality, pseudo-static random access memory (PSRAM) is often used as a circular buffer between the image sensor and the main control chip due to its fast read / write speed, moderate cost, and the fact that it does not require a complex refresh mechanism compared to DRAM. During system operation, the image sensor continuously writes uncompressed image data acquired in real time into the PSRAM. When the storage space reaches its limit, new data automatically overwrites the oldest data, forming a circular overwrite write mechanism. However, when an event triggers the system to wake up and prepare to read the pre-recorded video, if the pre-recorded video cannot be read accurately, it may result in screen distortion, leading to a poor user experience.

[0004] In conclusion, how to accurately and completely extract pre-recorded video data is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] In view of this, this application provides a data processing method and related products for an electronic device with pre-recording function, which aims to accurately and completely extract pre-recorded video data.

[0006] In a first aspect, this application provides a data processing method for an electronic device with pre-recording functionality, comprising: In response to a wake-up event, a command to stop pre-recording video is issued, controlling electronic devices with pre-recording capabilities to stop pre-recording video. Obtain the current write address and the storage size of a single frame image; the storage size of the single frame image and the actual total storage space size are coprime numbers. Calculate the modulo operation result of the current write address with respect to the storage size of the single frame image; The starting address of the pre-recorded video is determined based on the modulo operation result; The image data corresponding to the pre-recorded video is extracted based on the starting address of the pre-recorded video.

[0007] Optionally, calculating the modulo operation result of the current write address with respect to the storage size of the single frame image includes: The modulo operation result is obtained by dividing the amount of data at the current write address by the storage size of the single frame image; the modulo operation result is either a remainder or a remainder.

[0008] Optionally, determining the starting address of the pre-recorded video based on the modulo operation result includes: If the modulo operation result is a remainder, it is determined that the memory is not full, and the starting address 0 of the memory is determined as the starting address of the pre-recorded video. If the modulo operation result is a remainder, it is determined that the memory is full. The starting address of the pre-recorded video is calculated by taking the modulo of the actual total storage space size based on the current write address.

[0009] Optionally, if the modulo operation result is a remainder, it is determined that the memory is full, and the starting address of the pre-recorded video is calculated by taking the modulo of the actual total storage space size based on the current write address, including: If the modulo operation result is a remainder, it is determined that the memory is full. The starting address of the pre-recorded video is determined by dividing the amount of data at the current write address by the actual total storage space size.

[0010] Optionally, before obtaining the current write address and the storage size of a single frame image, the method further includes: The actual total storage space size and the storage size of a single frame image are set such that the storage size of a single frame image and the actual total storage space size are coprime numbers.

[0011] Optionally, before issuing a stop pre-recording video command in response to a wake-up event, and controlling the electronic device with pre-recording function to stop pre-recording video, the method further includes: In response to the issuance of the pre-recording command, image data is written starting from the starting address of the memory and is cyclically overwritten.

[0012] Optionally, before extracting the image data corresponding to the pre-recorded video based on the starting address of the pre-recorded video, the method further includes: The byte preceding the current write address is determined as the termination address of the pre-recorded video; The step of extracting image data corresponding to the pre-recorded video based on the starting address of the pre-recorded video includes: Based on the start address and the end address of the pre-recorded video, the image data corresponding to the pre-recorded video is extracted.

[0013] Secondly, this application provides a data processing apparatus for an electronic device with pre-recording function, comprising: The stop pre-recording module is used to respond to a wake-up event and issue a stop pre-recording video command to control electronic devices with pre-recording function to stop pre-recording video. The acquisition module is used to acquire the current write address and the storage size of a single frame image; the storage size of the single frame image and the actual total storage space size are coprime numbers. The calculation module is used to calculate the modulo operation result of the current write address with respect to the storage size of the single frame image; The first determining module is used to determine the starting address of the pre-recorded video based on the modulo operation result; The extraction module is used to extract the image data corresponding to the pre-recorded video based on the starting address of the pre-recorded video.

[0014] Optionally, the computing module includes: The calculation submodule is used to divide the amount of data at the current write address by the storage size of the single frame image to obtain the modulo operation result; the modulo operation result is either a remainder or a remainder.

[0015] Optionally, the first determining module includes: The first determining submodule is used to determine that the memory is not full if the result of the modulo operation is no remainder, and to determine the starting address 0 of the memory as the starting address of the pre-recorded video. The second determining submodule is used to determine that the memory is full if the result of the modulo operation is a remainder, and to calculate the starting address of the pre-recorded video by taking the modulo of the actual total storage space size based on the current write address.

[0016] Optionally, the second determining submodule includes: The determining unit is used to determine that the memory is full if the result of the modulo operation is a remainder, and to determine the starting address of the pre-recorded video by dividing the amount of data at the current write address by the actual total storage space size.

[0017] Optionally, the device further includes: The setting module is used to set the actual total storage space size of the memory and the storage size of a single frame image, such that the storage size of the single frame image and the actual total storage space size are coprime numbers.

[0018] Optionally, the device further includes: The pre-recording module is used to respond to the issuance of the pre-recording command, write image data starting from the starting address of the memory, and perform cyclic overwriting.

[0019] Optionally, the device further includes: The second determining module is used to determine the byte preceding the current write address as the termination address of the pre-recorded video; Optionally, the extraction module includes: The extraction submodule is used to extract image data corresponding to the pre-recorded video based on the start address and the end address of the pre-recorded video.

[0020] Thirdly, embodiments of this application provide a device, wherein the door lock includes: a data processing device for an electronic device with pre-recording function as described in any embodiment of the second aspect of this application.

[0021] Fourthly, embodiments of this application provide a door, which includes the device and door body described in the third aspect of embodiments of this application.

[0022] This application provides a data processing method for an electronic device with pre-recording functionality. When executing the method, in response to a wake-up event, a stop pre-recording video command is issued to control the electronic device to stop pre-recording video. Then, the current write address and the storage size of a single frame image are obtained, wherein the storage size of the single frame image and the actual total storage space size are coprime. Next, the modulo operation result of the current write address and the storage size of the single frame image is calculated, and the starting address of the pre-recorded video is determined based on the modulo operation result. Finally, the image data corresponding to the pre-recorded video is extracted based on the starting address of the pre-recorded video. Thus, by setting the storage size of the single frame image and the actual total storage space size to be coprime, only one modulo operation is needed on the obtained current write address and the storage size of the single frame image to accurately calculate the true starting address of the pre-recorded video, thereby accurately and completely extracting the pre-recorded video data. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings used in the description of the embodiment or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 A flowchart illustrating a data processing method for an electronic device with pre-recording function, provided in an embodiment of this application; Figure 2A schematic diagram of PSRAM storage provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a data processing device for an electronic device with pre-recording function, provided in an embodiment of this application. Detailed Implementation

[0025] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. This application provides a data processing method and related products for an electronic device with pre-recording function, applicable to the field of intelligent security technology. The above are merely examples and do not limit the application areas of the methods and devices provided in this application.

[0026] With the rapid development of smart home security technology, smart door locks with video recording capabilities have become mainstream in the market. These devices are typically battery-powered, thus requiring stringent low-power design. In smart door lock applications, to fully record the scene before a triggering event (such as someone lingering or pressing the doorbell), the industry commonly employs a pre-roll function. The core logic of this function is that while the main control chip is in sleep mode, the image sensor continuously acquires images and writes them to a high-speed cache medium, so that a complete video clip containing the "prelude" can be saved when an event is triggered.

[0027] In hardware architectures implementing pre-recording functionality, pseudo-static random access memory (PSRAM) is often used as a circular buffer between the image sensor and the main control chip due to its fast read / write speed, moderate cost, and the fact that it does not require a complex refresh mechanism compared to DRAM. During system operation, the image sensor continuously writes uncompressed image data acquired in real time into the PSRAM. When the storage space reaches its limit, new data automatically overwrites the oldest data, forming a circular overwrite mechanism. However, when an event triggers the system to wake up and prepare to read the pre-recorded video, accurately determining the current write state of the PSRAM—whether the data is still in the initial, incomplete write state or has already undergone circular overwrite—becomes a key technical bottleneck in ensuring the integrity and accuracy of the video data.

[0028] The inventors, through research, proposed the technical solution of this application. In response to a wake-up event, a command to stop pre-recording video is issued, controlling the electronic device with pre-recording function to stop pre-recording video. Then, the current write address and the storage size of a single frame image are obtained, wherein the storage size of the single frame image and the actual total storage space size are coprime. Next, the modulo operation result of the current write address divided by the storage size of the single frame image is calculated. Finally, the modulo operation result of the current write address divided by the storage size of the single frame image is calculated. Thus, by setting the storage size of the single frame image and the actual total storage space size of the PSRAM to be coprime, only one modulo operation is needed on the obtained current write address divided by the storage size of the single frame image to accurately calculate the true starting address of the pre-recorded video, thereby accurately and completely extracting the pre-recorded video data.

[0029] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present application. It should be noted that, for ease of description, only the parts related to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features in the embodiments of the present application can be combined with each other.

[0030] See Figure 1 , Figure 1 A flowchart of a data processing method for an electronic device with pre-recording function provided in this application embodiment includes: S101: In response to a wake-up event, a stop video recording command is issued to control electronic devices with pre-recording function to stop pre-recording video.

[0031] Before executing the implementation method in step S101, it is necessary to respond to the issuance of the pre-recording instruction and start pre-recording video. After starting pre-recording video, each frame of image data is written into the physical address of PSRAM. The writing process follows a circular overwrite mechanism, that is, the data is stored sequentially starting from address 0. When the write pointer reaches the upper limit of the maximum address MAX_ADDR of PSRAM used by the pre-recording function, it automatically turns back to the starting address to continue writing, thereby forming a circular data buffer.

[0032] When implementing the implementation method in step S101, in response to the wake-up event, wherein the wake-up event includes, but is not limited to, the door lock camera detecting human movement, a stop pre-recording video command is issued to control the electronic device with pre-recording function to stop pre-recording video, so as to start the acquisition stage of pre-recorded video.

[0033] S102: Get the current write address and the storage size of a single frame image.

[0034] Before implementing the method in step S102, it is necessary to first set the maximum address MAX_ADDR of the PSRAM used by the pre-recording function. For example, the maximum address MAX_ADDR of 32MB PSRAM can be set to 32×1024×1024-2=33554430 bytes. It is also necessary to specify the storage size FRAME_SIZE of a single frame image. This parameter depends on the camera's resolution and pixel format; for example, the size of each frame image at 720P resolution is 921600 bytes. In this embodiment, it is essential to ensure that the actual total storage space S (MAX_ADDR+1) of the PSRAM used for pre-recording and the storage size FRAME_SIZE of a single frame image (denoted as F) are coprime numbers, i.e., the greatest common divisor of the actual total storage space S used for pre-recording and the storage size F of a single frame image is gcd(S,F)=1.

[0035] When executing the implementation method in step S102, the current write address Current_Write_Addr and the storage size F of a single frame image are obtained. It should be noted that the current write address Current_Write_Addr is the starting address END_Addr+1 of the pre-recorded video.

[0036] S103: Calculate the result of the modulo operation of the storage size of a single frame image at the current write address.

[0037] Calculate the modulo operation result of the current write address with respect to the storage size of a single frame image. Specifically, divide the data volume S (END_Addr+1) of the current write address by the storage size F of a single frame image to obtain the modulo operation result, which may or may not have a remainder.

[0038] S104: Determine the starting address of the pre-recorded video based on the modulo operation result.

[0039] like Figure 2 As shown, Figure 2This embodiment of the application provides a schematic diagram of PSRAM storage. Since data is always written in whole frames when the PSRAM is not full, when the remainder is 0, it indicates that the write pointer is just stopping at the frame boundary. At this time, the PSRAM is determined to be in a non-full state, and data can be read directly from the start address of the PSRAM to obtain the complete pre-recorded content. That is, the start address 0 of the PSRAM is determined as the start address START_Addr of the pre-recorded video. If the calculated remainder is not equal to 0, it is determined that the PSRAM is full, indicating that the write pointer is in the middle of a frame of data. This means that the PSRAM has completed at least one cycle of overwriting, and the old data has been replaced by the new data. If reading from the start address at this time, it will cause video gaps. It is necessary to take the modulo of the actual total storage space size S based on the current write address Current_Write_Addr to calculate the start address of the pre-recorded video. Specifically, the start address START_Addr of the pre-recorded video is the current write address Current_Write_Addr (END_Addr+1) divided by the actual total storage space size S (MAX_ADDR+1), that is, considering the cycle overwriting, it starts from the next byte of the current write address.

[0040] S105: Extract image data corresponding to the pre-recorded video based on the starting address.

[0041] Based on the start address START_Addr and the end address END_Addr, the image data corresponding to the pre-recorded video is extracted, and the pre-recorded video is obtained.

[0042] In the embodiments provided in this application, in response to a wake-up event, a stop pre-recording video command is issued to control the electronic device with pre-recording function to stop pre-recording video. Then, the current write address and the storage size of a single frame image are obtained, wherein the storage size of the single frame image and the actual total storage space size are coprime. Next, the modulo operation result of the current write address and the storage size of the single frame image is calculated, and the starting address of the pre-recorded video is determined based on the modulo operation result. Finally, the image data corresponding to the pre-recorded video is extracted based on the starting address of the pre-recorded video. Thus, by setting the storage size of the single frame image and the actual total storage space size to be coprime, only one modulo operation is needed on the obtained current write address and the storage size of the single frame image to accurately calculate the true starting address of the pre-recorded video, thereby accurately and completely extracting the pre-recorded video data.

[0043] Furthermore, it should be noted that in this embodiment, to ensure the absolute reliability of the modulo operation result, the address space must be mathematically optimized. The most crucial aspect is defining the numerical relationship between the actual total storage space S used for pre-recording in the PSRAM and the storage size F of a single frame image. For example, a 32MB PSRAM chip is selected, and its maximum available address MAX_ADDR is set to 33554430. Therefore, the actual total storage space S used for pre-recording in the PSRAM is MAX_ADDR plus 1, equal to 33554431 bytes. Simultaneously, the storage size FRAME_SIZE of a single frame image at 720P resolution for the smart door lock camera is set to 921600 bytes. The system then pre-calculates the greatest common divisor of these two values, verifying that gcd(33554431, 921600) equals 1. This satisfies the key constraint that the two values ​​are mutually prime, effectively resolving potential address alignment misjudgments.

[0044] Based on the aforementioned coprime relationship, the system can maximize the so-called "alignment period," thereby addressing potential theoretical challenges. Specifically, during PSRAM cyclic writing, without restrictions, it's possible that the current write address (Current_Write_Addr) happens to be at the maximum address (MAX_ADDR), while the next frame starts writing from the starting address. In this case, simply taking the modulo operation could easily lead to a misjudgment of an incomplete state. However, under the condition that S and F are coprime, the period for this address to realign to the frame boundary is extended to S frames. Substituting specific numerical calculations, this means that a misjudgment might only occur after continuously writing 33,554,431 frames. Considering the typical low-power pre-recorded frame rate of 5fps for smart locks, the time required for a single misalignment is approximately 33,554,431 divided by 5, which equals 6,710,886 seconds, or approximately 77.67 days. This period far exceeds the typical sleep time of smart locks, thus mathematically ensuring extremely high reliability of the judgment mechanism in practical applications.

[0045] To further eliminate this extremely low probability theoretical risk, this embodiment also introduces a software optimization strategy to enhance reliability, namely, implementing a timed reset mechanism. Specifically, a software timer is started simultaneously with the pre-recording function. The timer's timeout is set to a value much less than 77.67 days, for example, 30 days. When the hibernation state exceeds 30 days, a wake-up event is actively triggered, forcibly re-initializing the pre-recording function, causing the write pointer to be forcibly reset to zero and writing to begin from the beginning. This completely eliminates the possibility of misjudgment caused by excessively long hibernation periods.

[0046] The above are some specific implementations of the data processing method for an electronic device with pre-recording function provided in the embodiments of this application. Based on this, the present application also provides a corresponding device. The device provided in the embodiments of this application will be described below from the perspective of functional modularity.

[0047] See Figure 3 , Figure 3 This application provides a schematic diagram of the structure of a data processing device 300 for an electronic device with pre-recording function. The data processing device 300 includes: The stop pre-recording module 310 is used to respond to a wake-up event trigger, issue a stop pre-recording video command, and control the electronic device with pre-recording function to stop pre-recording video. The acquisition module 320 is used to acquire the current write address and the storage size of a single frame image; the storage size of the single frame image and the actual total storage space size are coprime numbers. The calculation module 330 is used to calculate the modulo operation result of the current write address with respect to the storage size of the single frame image; The first determining module 340 is used to determine the starting address of the pre-recorded video based on the modulo operation result; The extraction module 350 is used to extract the image data corresponding to the pre-recorded video based on the starting address of the pre-recorded video.

[0048] Optionally, the computing module 330 includes: The calculation submodule is used to divide the amount of data at the current write address by the storage size of the single frame image to obtain the modulo operation result; the modulo operation result is either a remainder or a remainder.

[0049] Optionally, the first determining module 340 includes: The first determining submodule is used to determine that the memory is not full if the result of the modulo operation is no remainder, and to determine the starting address 0 of the memory as the starting address of the pre-recorded video. The second determining submodule is used to determine that the memory is full if the result of the modulo operation is a remainder, and to calculate the starting address of the pre-recorded video by taking the modulo of the actual total storage space size based on the current write address.

[0050] Optionally, the second determining submodule includes: The determining unit is used to determine that the memory is full if the result of the modulo operation is a remainder, and to determine the starting address of the pre-recorded video by dividing the amount of data at the current write address by the actual total storage space size.

[0051] Optionally, the device 300 further includes: The setting module is used to set the actual total storage space size of the memory and the storage size of a single frame image, such that the storage size of the single frame image and the actual total storage space size are coprime numbers.

[0052] Optionally, the device 300 further includes: The pre-recording module is used to respond to the issuance of the pre-recording command, write image data starting from the starting address of the memory, and perform cyclic overwriting.

[0053] Optionally, the device 300 further includes: The second determining module is used to determine the byte preceding the current write address as the termination address of the pre-recorded video; Optionally, the extraction module 350 includes: The extraction submodule is used to extract image data corresponding to the pre-recorded video based on the start address and the end address of the pre-recorded video.

[0054] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the methods of the above embodiments can be implemented by means of software plus a general-purpose hardware platform. Based on this understanding, the technical solution of this application can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as a read-only memory (ROM) / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, a server, or a network communication device such as a router) to execute the methods described in various embodiments or some parts of the embodiments of this application.

[0055] Furthermore, this application also provides a device comprising: the data processing apparatus of the aforementioned electronic device with pre-recording function. In some embodiments, the device is an electronic device applied to smart security, including but not limited to smart door locks, smart peepholes, etc.

[0056] In addition, this application embodiment also provides a door, which includes the device and door body described in the foregoing embodiments.

[0057] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0058] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0059] The above description is merely an exemplary implementation of this application and is not intended to limit the scope of protection of this application.

Claims

1. A data processing method for an electronic device having a pre-recording function, characterized by, include: In response to a wake-up event, a command to stop pre-recording video is issued, controlling electronic devices with pre-recording capabilities to stop pre-recording video. Obtain the current write address and the storage size of a single frame image; the storage size of the single frame image and the actual total storage space size are coprime numbers. Calculate the modulo operation result of the current write address with respect to the storage size of the single frame image; The starting address of the pre-recorded video is determined based on the modulo operation result; The image data corresponding to the pre-recorded video is extracted based on the starting address of the pre-recorded video.

2. The method of claim 1, wherein, The calculation of the modulo operation result of the current write address with respect to the storage size of the single frame image includes: The modulo operation result is obtained by dividing the amount of data at the current write address by the storage size of the single frame image; the modulo operation result is either a remainder or a remainder.

3. The method of claim 2, wherein, Determining the starting address of the pre-recorded video based on the modulo operation result includes: If the modulo operation result is a remainder, it is determined that the memory is not full, and the starting address 0 of the memory is determined as the starting address of the pre-recorded video. If the modulo operation result is a remainder, it is determined that the memory is full. The starting address of the pre-recorded video is calculated by taking the modulo of the actual total storage space size based on the current write address.

4. The method of claim 3, wherein, If the modulo operation result is a remainder, it is determined that the memory is full. The starting address of the pre-recorded video is calculated by taking the modulo of the actual total storage space size based on the current write address, including: If the modulo operation result is a remainder, it is determined that the memory is full. The starting address of the pre-recorded video is determined by dividing the amount of data at the current write address by the actual total storage space size.

5. The method according to claim 1, characterized in that, Before obtaining the current write address and the storage size of a single frame image, the method further includes: The actual total storage space size and the storage size of a single frame image are set such that the storage size of a single frame image and the actual total storage space size are coprime numbers.

6. The method of claim 1, wherein, Before issuing a stop pre-recording video command in response to a wake-up event, and controlling the electronic device with pre-recording function to stop pre-recording video, the method further includes: In response to the issuance of the pre-recording command, image data is written starting from the starting address of the memory and is cyclically overwritten.

7. The method according to any one of claims 1 to 6, characterized in that, Before extracting the image data corresponding to the pre-recorded video based on the starting address of the pre-recorded video, the method further includes: The byte preceding the current write address is determined as the termination address of the pre-recorded video; The step of extracting image data corresponding to the pre-recorded video based on the starting address of the pre-recorded video includes: Based on the start address and the end address of the pre-recorded video, the image data corresponding to the pre-recorded video is extracted.

8. A data processing apparatus of an electronic device having a pre-recording function, characterized by comprising: include: The stop pre-recording module is used to respond to a wake-up event and issue a stop pre-recording video command to control electronic devices with pre-recording function to stop pre-recording video. The acquisition module is used to acquire the current write address and the storage size of a single frame image; the storage size of the single frame image and the actual total storage space size are coprime numbers. The calculation module is used to calculate the modulo operation result of the current write address with respect to the storage size of the single frame image; The first determining module is used to determine the starting address of the pre-recorded video based on the modulo operation result; The extraction module is used to extract image data corresponding to the pre-recorded video based on the starting address of the pre-recorded video.

9. An apparatus, comprising: The device includes: the data processing apparatus of the electronic device with pre-recording function as described in claim 8.

10. A door characterized in that, The door includes the device as described in claim 9 and the door body.