Data processing method and device and electronic equipment

By applying for memory blocks for data producers in Linux system and using free linked lists to manage the usage status of memory slices, the problem of low data storage efficiency in shared memory is solved, and efficient data storage in video transmission scenarios is achieved.

CN119225994APending Publication Date: 2024-12-31GUANGZHOU AUTOMOBILE GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411110773.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

There is a low problem with the shared memory mechanism in Linux system in terms of data storage efficiency, especially in video transmission scenarios, where the data size of each frame is basically the same, but the existing technology is difficult to efficiently manage the usage status of memory slices, resulting in data storage efficiency. Not high.

Method used

A data processing method is proposed. By applying for a memory block for the data producer in the shared memory space, the memory block includes a data area and a management area, the data area includes an idle linked list and a used linked list, and the management area records the usage status of the memory slice. , determine the target memory slice based on the usage status of the idle linked list, and store the target data into the memory slice, avoiding traversing the entire idle linked list and improving data storage efficiency.

Benefits of technology

Through the usage status of memory slices in the idle linked list recorded in the management area, the target memory slice is quickly determined and the data is directly stored in the memory slice, which improves data storage efficiency, especially in video transmission scenarios, the image data size of each frame is the same, simplifying The memory slice management has been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225994A_ABST
    Figure CN119225994A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data processing method and device and electronic equipment. The method comprises the following steps: when a data producer starts to transmit a video, applying a memory block for the data producer from a shared memory space; determining a target memory chip from the idle linked list based on the use state of the memory chip in the idle linked list; and storing the target data into the target memory chip. Through the mode, the target memory chip can be determined only through the use state of the memory chip in the idle linked list without traversing the whole idle linked list. Moreover, the idle linked list is divided into a plurality of memory chips with the same storage space, the residual storage space of each memory chip does not need to be calculated, and the target data can be directly stored in the target memory chip after the target memory chip is determined, so that the data storage efficiency is improved. The data storage efficiency is improved by storing the memory chips with the same size of the storage spaces in the idle linked list and recording the use states of the memory chips.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electronic equipment, and more specifically, to a data processing method, device and electronic equipment. Background Art

[0002] The Linux system can provide a shared memory mechanism to enable data transmission between multiple processes. In a related method, the process as a data producer can apply for shared memory from the shared memory space to store the produced data, but the related method still has the problem of low data storage efficiency. Summary of the invention

[0003] In view of the above problems, the present application proposes a data processing method, device and electronic device to improve the above problems.

[0004] In a first aspect, the present application provides a data processing method, the method comprising: when a data producer starts to transmit a video, applying for a memory block for the data producer from a shared memory space, wherein the memory block includes a data area and a management area, the data area includes a free list, the free list includes multiple memory slices of the same size of storage space, and the management area is used to record the usage status of all memory slices in the data area; based on the usage status of the memory slices in the free list, determining a target memory slice from the free list, the target memory slice being the node closest to the head node in the free list and being in an unused state; storing target data in the target memory slice, the target data being the image data of the current frame in the video transmitted by the data producer.

[0005] In the second aspect, the present application provides a data processing device, which includes: a memory block acquisition unit, used to apply for a memory block for a data producer from a shared memory space, wherein the memory block includes a data area and a management area, the data area includes a free linked list and a used linked list, the free linked list and the used linked list respectively include multiple memory slices of the same size in the storage space, and the head node of the free linked list is connected to the head node of the used linked list, and the management area is used to record the usage status of all memory slices in the data area; a target memory slice acquisition unit, used to determine the target memory slice from the free linked list based on the usage status of the memory slices in the free linked list, the target memory slice is the node closest to the head node in the free linked list and is in an unused state; a linked list management unit, used to store target data in the target memory slice, the target data is the data currently produced by the data producer.

[0006] In a third aspect, the present application provides an electronic device comprising one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above-mentioned method.

[0007] In a fourth aspect, the present application provides a computer-readable storage medium, in which program code is stored, wherein the above method is executed when the program code is run.

[0008] The present application provides a data processing method, device, electronic device and storage medium. When a data producer starts to transmit a video, a memory block is applied for the data producer from a shared memory space. Based on the usage status of the memory slices in the free linked list, a target memory slice is determined from the free linked list, and target data is stored in the target memory slice. The target data is the image data of the current frame in the video transmitted by the data producer. Through the above-mentioned method, when the data producer starts to transmit a video, after applying for a memory block for the data producer from a shared memory space, the target memory slice is determined by the usage status of the memory slices in the free linked list recorded in the management area, so as to store the target data in the target memory slice. Therefore, the target memory slice can be determined only by the usage status of the memory slices in the free linked list without traversing the entire free linked list. Furthermore, because the size of each frame of image data is basically the same in the video transmission scenario, the free linked list is divided into multiple memory slices with the same storage space size. There is no need to calculate the remaining storage space of each memory slice. After determining the target memory slice, the target data can be directly stored in the target memory slice. Therefore, by dividing the free linked list into multiple memory slices with the same storage space and recording the usage status of the memory slices, the data storage efficiency is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0010] Figure 1 A flowchart of a data processing method proposed in an embodiment of the present application;

[0011] Figure 2 A flow chart of a data processing method proposed in another embodiment of the present application is shown;

[0012] Figure 3 A schematic diagram of a free linked list and a used linked list proposed in the present application is shown;

[0013] Figure 4 A flow chart of a data processing method proposed in another embodiment of the present application is shown;

[0014] Figure 5 A structural block diagram of a data processing device proposed in an embodiment of the present application is shown;

[0015] Figure 6 A structural block diagram of an electronic device proposed in this application is shown. DETAILED DESCRIPTION

[0016] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0017] In an embodiment of the present application, the inventor proposes a data processing method, device and electronic device. When a data producer starts to transmit a video, a memory block is applied for the data producer from a shared memory space. Based on the usage status of the memory slices in the free linked list, a target memory slice is determined from the free linked list, and target data is stored in the target memory slice. The target data is the image data of the current frame in the video transmitted by the data producer. Through the above-mentioned method, when the data producer starts to transmit a video, after applying for a memory block for the data producer from a shared memory space, the target memory slice is determined by the usage status of the memory slices in the free linked list recorded in the management area, so that the target data is stored in the target memory slice, so that the target memory slice can be determined only by the usage status of the memory slices in the free linked list without traversing the entire free linked list. Furthermore, because the size of each frame of image data is basically the same in the video transmission scenario, the free linked list is divided into multiple memory slices with the same storage space size. There is no need to calculate the remaining storage space of each memory slice. After determining the target memory slice, the target data can be directly stored in the target memory slice. Therefore, by dividing the free linked list into multiple memory slices with the same storage space and recording the usage status of the memory slices, the data storage efficiency is improved.

[0018] See also Figure 1 , an embodiment of the present application provides a data processing method, the method comprising:

[0019] S110: When the data producer starts to transmit the video, a memory block is applied for the data producer from the shared memory space, wherein the memory block includes a data area and a management area, the data area includes a free list, the free list includes multiple memory slices of the same size of the storage space, and the management area is used to record the usage status of all memory slices in the data area.

[0020] Among them, the data processing method proposed in the present application can be executed by an electronic device. In the video transmission scenario, the data producer can be the process corresponding to the device (such as a camera) or sensor (such as an infrared sensor) that collects video in the electronic device; the data producer can also be a process that pre-processes the collected video, such as filtering, noise reduction, etc.

[0021] A free linked list may refer to a linked list in which no data is stored or a linked list in which no unused data is stored, wherein unused data may be understood as data that has not been used by all corresponding data consumers. That is to say, used data may be stored in a linked list, and used data may refer to data that has been used by all corresponding data consumers and may be overwritten by other unused new data at any time.

[0022] In an embodiment of the present application, because the management area is used to record the usage status of all memory chips in the data area, the storage space corresponding to the management area may be smaller than the storage space corresponding to the data area. For example, the management area may be 4K and the data area may be 100M.

[0023] The usage status of the memory slice can be a used status or an unused status. The used status can be understood as new data being stored in the memory slice; the unused status can be understood as no new data being stored in the memory slice, or data that has been used by all corresponding data consumers is stored in the memory slice. For example, 0 can be used to represent the unused status, and 1 can be used to represent the used status.

[0024] As a way, when the data producer starts to transmit video, the middleware of the electronic device can apply for a memory block for the data producer from the shared memory space.

[0025] Among them, the middleware can refer to a service program that can manage shared memory management and provide interfaces for data producers and data consumers to call, so that data producers and data consumers can access memory blocks.

[0026] S120: Based on the usage status of the memory slices in the free linked list, determine a target memory slice from the free linked list, where the target memory slice is a node that is closest to the head node in the free linked list and is in an unused state.

[0027] A head node may be provided in the free list, and the address of the head node of the free list is recorded in the management area.

[0028] As a method, a target memory slice may be determined from the free list based on the usage status of the memory slices in the free list.

[0029] Optionally, the usage status of each memory slice in the free linked list can be traversed starting from the memory slice corresponding to the head node to obtain the node that is closest to the head node in the free linked list and is in an unused state, thereby obtaining the target memory slice.

[0030] S130: Storing target data into the target memory slice, the target data being image data of a current frame in the video transmitted by the data producer.

[0031] Among them, a video can be composed of multiple frames of image data.

[0032] As a method, the middleware can store the target data obtained from the data producer into the target memory slice.

[0033] The present embodiment provides a data processing method, when the data producer starts to transmit the video, a memory block is applied for the data producer from the shared memory space, based on the usage status of the memory slices in the free linked list, the target memory slice is determined from the free linked list, and the target data is stored in the target memory slice, the target data being the image data of the current frame in the video transmitted by the data producer. Through the above method, when the data producer starts to transmit the video, after applying for a memory block for the data producer from the shared memory space, the target memory slice is determined by the usage status of the memory slices in the free linked list recorded in the management area, so that the target data is stored in the target memory slice, so that the target memory slice can be determined only by the usage status of the memory slices in the free linked list without traversing the entire free linked list. Furthermore, because the size of each frame of image data is basically the same in the video transmission scenario, the free linked list is divided into multiple memory slices with the same storage space size. There is no need to calculate the remaining storage space of each memory slice. After determining the target memory slice, the target data can be directly stored in the target memory slice. Therefore, by dividing the free linked list into multiple memory slices with the same storage space and recording the usage status of the memory slices, the data storage efficiency is improved.

[0034] See also Figure 2 , an embodiment of the present application provides a data processing method, the method comprising:

[0035] S210: When the data producer starts to transmit the video, a memory block is applied for the data producer from the shared memory space, wherein the memory block includes a data area and a management area, the data area includes a free list, the free list includes multiple memory slices of the same size in the storage space, and the management area is used to record the usage status of all memory slices in the data area.

[0036] S220: Based on the usage status of the memory slices in the free linked list, determine a target memory slice from the free linked list, where the target memory slice is a node that is closest to the head node in the free linked list and is in an unused state.

[0037] S230: Storing target data into the target memory slice, the target data being image data of a current frame in the video transmitted by the data producer.

[0038] S240: Update the usage status of the target memory to a used status.

[0039] As a way, the middleware may update the usage status of the target memory in the management area to a used status.

[0040] S250: Deleting the target memory slice from the free linked list, and inserting the target memory slice into the used linked list.

[0041] Among them, Figure 3 As shown, the data area may also include a used linked list. The head node of the used linked list may be associated with the head node of the free linked list through a memory allocation interface (mmap). The free linked list is a bidirectional circular linked list whose head node does not point to the tail node. The used linked list is a bidirectional circular linked list whose head node does not point to the tail node. The head node of the used linked list may point to the next memory slice of the used linked list.

[0042] As a way, because the head node of the used linked list can be associated with the head node of the free linked list through the memory allocation interface (mmap), the used linked list and the free linked list can access each other, so that the target memory slice can be deleted from the free linked list through the memory allocation interface, and the target memory slice can be inserted into the used linked list.

[0043] As a method of deleting a target memory slice, a first memory slice and a second memory slice can be obtained, wherein the first memory slice can be the previous memory slice of the target memory slice, and the second memory slice can be the next memory slice of the target memory slice; the subsequent link node of the first memory slice is changed from the target memory slice to the second memory slice, and the previous link node of the second memory slice is changed from the target memory slice to the first memory slice, so as to delete the target memory slice from the free linked list.

[0044] The previous memory slice of the target memory slice may refer to a memory slice before the target memory slice and adjacent to the target memory slice; the next memory slice of the target memory slice may refer to a memory slice after the target memory slice and adjacent to the target memory slice.

[0045] As a method of inserting the target memory slice, the link node of the head node in the used linked list can be changed from the next memory slice to the target memory slice; the link node of the next memory slice is changed from the head node to the target memory slice to insert the target memory slice into the used linked list.

[0046] A data processing method provided by this embodiment can, through the above-mentioned method, when a data producer starts to transmit a video, after applying for a memory block for the data producer from the shared memory space, determine the target memory slice through the usage status of the memory slices in the free linked list recorded by the management area, so as to store the target data in the target memory slice, thereby eliminating the need to traverse the entire free linked list, and only determining the target memory slice through the usage status of the memory slices in the free linked list. In addition, because the size of each frame of image data is basically the same in the video transmission scenario, the free linked list is divided into multiple memory slices with the same storage space size, so there is no need to calculate the remaining storage space of each memory slice. After determining the target memory slice, the target data can be directly stored in the target memory slice. Therefore, by including multiple memory slices with the same storage space in the free linked list and recording the usage status of the memory slices, the data storage efficiency is improved. Furthermore, in this embodiment, the free linked list and the used linked list are set so that the head node does not point to the tail node but is associated with mmap, which can facilitate the management of the two linked lists and enable the two linked lists to access each other; and the free linked list and the used linked list are set as bidirectional circular linked lists with the head node not pointing to the tail node, so that bidirectional transmission of data, information, etc. can be achieved, so that the upper and lower nodes can be quickly located according to any node in the circular linked list, so that no matter whether a node is added or deleted, the node that needs to be modified can be quickly obtained, and the pointing can be adjusted to complete the addition and deletion operation.

[0047] See also Figure 4 , an embodiment of the present application provides a data processing method, the method comprising:

[0048] S310: When the data producer starts to transmit video, a memory block is applied for the data producer from the shared memory space, wherein the memory block includes a data area and a management area, the data area includes a free list, the free list includes multiple memory slices of the same size in the storage space, and the management area is used to record the usage status of all memory slices in the data area.

[0049] S320: Based on the usage status of the memory slices in the free linked list, determine a target memory slice from the free linked list, where the target memory slice is a node that is closest to the head node in the free linked list and is in an unused state.

[0050] S330: Storing target data into the target memory slice, the target data being image data of a current frame in the video transmitted by the data producer.

[0051] S340: Based on the number of data consumers corresponding to the target data, set a reference count corresponding to the target memory slice.

[0052] Among them, data consumers can refer to the processes that use the data generated by data producers.

[0053] As a method, the number of data consumers corresponding to the target data may be set to a reference count corresponding to the target memory slice.

[0054] Optionally, after the data producer applies for a memory block from the middleware, the middleware can send the data producer's information to other processes. If other processes need to use the data produced by the data producer, they can register with the middleware. The middleware can use the successfully registered process as the data consumer corresponding to the target data and count the number of data consumers corresponding to the target data.

[0055] S350: When the reference count becomes 0, the usage state of the target memory is updated to an unused state, wherein each time a data consumer finishes using the target data, the reference count is reduced by 1.

[0056] As a method, when the reference count becomes 0, it can be indicated that all data consumers corresponding to the target data have finished using the target data, and the usage status of the target memory in the management area can be updated to an unused status.

[0057] It should be noted that, since the virtual address of the memory block is automatically allocated by the system, the virtual addresses used by different processes for the target memory slice in step S330 may be different. In order for the data producer to successfully read the target data in the target memory slice,

[0058] Receive the logical address of the target memory slice from the data producer, where the logical address can be obtained by the data producer based on the starting virtual address of the memory block obtained by itself and the virtual address of the target memory slice; send the logical address to the data consumer corresponding to the target data, so that the data consumer can determine the storage location of the target memory slice based on the logical address and the starting virtual address of the memory block obtained by the data consumer itself, and use the target data based on the storage location of the target memory slice.

[0059] Optionally, the virtual address of the target memory slice is subtracted from the starting virtual address of the memory block obtained by the data producer itself to obtain the logical address, and then the logical address is added to the starting virtual address of the memory block obtained by the data consumer itself to obtain the storage location of the target memory slice.

[0060] S360: Deleting the target memory slice from the used linked list through the memory allocation interface, and inserting it into the free linked list.

[0061] As a method, the target memory slice can be deleted from the used linked list and inserted into the free linked list through the memory allocation interface.

[0062] A data processing method provided by this embodiment can be used in the above manner to determine the target memory slice through the usage status of the memory slice in the free linked list recorded by the management area when the data producer starts to transmit the video, so that the target memory slice can be stored in the target memory slice, so that the target memory slice can be determined only through the usage status of the memory slice in the free linked list without traversing the entire free linked list. In addition, because the size of each frame of image data is basically the same in the video transmission scenario, the free linked list is divided into multiple memory slices with the same storage space size, and the remaining storage space of each memory slice does not need to be calculated. After determining the target memory slice, the target data can be directly stored in the target memory slice. Therefore, by dividing the free linked list into multiple memory slices with the same storage space and recording the usage status of the memory slice, the data storage efficiency is improved. In addition, in this embodiment, by setting reference counts and zero copies, the memory can be allocated multiple references at one time, thereby realizing efficient communication of target data between processes with minimal performance consumption.

[0063] See also Figure 5 The present application provides a data processing device 600, the device 600 comprising:

[0064] A memory block acquisition unit 610 is used to apply for a memory block for a data producer from a shared memory space, wherein the memory block includes a data area and a management area, the data area includes a free linked list and a used linked list, the free linked list and the used linked list respectively include a plurality of memory slices of the same size in the storage space, and the head node of the free linked list is connected to the head node of the used linked list, and the management area is used to record the use status of all memory slices in the data area;

[0065] A target memory slice acquisition unit 620 is used to determine a target memory slice from the free linked list based on the usage status of the memory slices in the free linked list, wherein the target memory slice is a node that is closest to the head node in the free linked list and is in an unused state;

[0066] The linked list management unit 630 is used to store the target data into the target memory slice, where the target data is the data currently produced by the data producer.

[0067] As a method, the linked list management unit 630 is specifically used to update the usage status of the target memory to a used status; delete the target memory slice from the free linked list, and insert the target memory slice into the used linked list.

[0068] Optionally, the head node of the used linked list and the head node of the free linked list are associated with each other through a memory allocation interface, and the linked list management unit 630 is specifically used to delete the target memory slice from the free linked list through the memory allocation interface, and insert the target memory slice into the used linked list.

[0069] Optionally, the free linked list is a bidirectional circular linked list whose head node does not point to the tail node, and the linked list management unit 630 is specifically used to obtain a first memory slice and a second memory slice, wherein the first memory slice is the previous memory slice of the target memory slice, and the second memory slice is the next memory slice of the target memory slice; the rear link node of the first memory slice is changed from the target memory slice to the second memory slice, and the front link node of the second memory slice is changed from the target memory slice to the first memory slice, so as to delete the target memory slice from the free linked list.

[0070] Optionally, the used linked list is a bidirectional circular linked list whose head node does not point to the tail node, and the head node of the used linked list points to the next memory slice of the used linked list. The linked list management unit 630 is specifically used to change the link node of the head node in the used linked list from the next memory slice to the target memory slice; and change the link node of the next memory slice from the head node to the target memory slice, so as to insert the target memory slice into the used linked list.

[0071] As a method, the data area also includes a used linked list, and the head node of the used linked list is associated with the head node of the free linked list through a memory allocation interface. The linked list management unit 630 is specifically used to set the reference count corresponding to the target memory slice based on the number of data consumers corresponding to the target data; when the reference count becomes 0, the usage status of the target memory is updated to an unused status, wherein each time a data consumer uses the target data, the reference count is reduced by 1; the target memory slice is deleted from the used linked list through the memory allocation interface and inserted into the free linked list.

[0072] Optionally, the linked list management unit 630 is specifically used to receive the logical address of the target memory slice from the data producer, where the logical address is obtained by the data producer based on the starting virtual address of the memory block obtained by itself and the virtual address of the target memory slice; send the logical address to the data consumer corresponding to the target data, so that the data consumer determines the storage location of the target memory slice based on the logical address and the starting virtual address of the memory block obtained by the data consumer itself, and uses the target data based on the storage location of the target memory slice.

[0073] The following will be combined Figure 6 An electronic device provided by the present application is described.

[0074] See also Figure 6 Based on the above data processing method and device, the embodiment of the present application also provides another electronic device 100 that can execute the above data processing method. The electronic device 100 includes a processor 102 and a memory 104. The memory 104 stores a program that can execute the content of the above embodiment, and the backup processor 102 can execute the program stored in the memory 104.

[0075] Among them, the processor 102 may include one or more processing cores. The processor 102 uses various interfaces and lines to connect various parts within the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 104, and calling data stored in the memory 104. Optionally, the processor 102 can be implemented in at least one hardware form of a network processor (Neural network Processing Unit, NPU), a digital signal processing (Digital Signal Processing, DSP), a field programmable gate array (Field-Programmable Gate Array, FPGA), and a programmable logic array (Programmable Logic Array, PLA). The processor 102 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU), a network processor (Neural network Processing Unit, NPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; the NPU is responsible for processing multimedia data such as video and images; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 102, but may be implemented separately through a communication chip.

[0076] The memory 104 may include a random access memory (RAM), and may also include a read-only memory (RAM) and a double data rate synchronous dynamic random access memory (DDR). The memory 104 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the electronic device 100 during use.

[0077] An embodiment of the present application provides a computer-readable storage medium in which a program code is stored, and the program code can be called by a processor to execute the method described in the above method embodiment.

[0078] The computer readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium includes a non-transitory computer-readable storage medium. The computer readable storage medium has storage space for program codes that execute any of the method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code can be compressed, for example, in an appropriate form.

[0079] In summary, the present application provides a data processing method, device, and electronic device. When a data producer starts to transmit a video, a memory block is applied for the data producer from a shared memory space. Based on the usage status of the memory slices in the free linked list, a target memory slice is determined from the free linked list, and target data is stored in the target memory slice. The target data is the image data of the current frame in the video transmitted by the data producer. Through the above-mentioned method, when the data producer starts to transmit a video, after applying for a memory block for the data producer from a shared memory space, the target memory slice is determined by the usage status of the memory slices in the free linked list recorded in the management area, so that the target data is stored in the target memory slice. Therefore, there is no need to traverse the entire free linked list, and the target memory slice can be determined only by the usage status of the memory slices in the free linked list. Furthermore, because the size of each frame of image data is basically the same in the video transmission scenario, the free linked list is divided into multiple memory slices with the same storage space size. There is no need to calculate the remaining storage space of each memory slice. After determining the target memory slice, the target data can be directly stored in the target memory slice. Therefore, by dividing the free linked list into multiple memory slices with the same storage space and recording the usage status of the memory slices, the data storage efficiency is improved.

[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A data processing method, characterized in that: The method comprises: When the data producer starts to transmit the video, a memory block is applied for the data producer from the shared memory space, wherein the memory block includes a data area and a management area, the data area includes a free list, the free list includes multiple memory slices of the same size of the storage space, and the management area is used to record the usage status of all memory slices in the data area; Based on the usage status of the memory slices in the free linked list, determining a target memory slice from the free linked list, wherein the target memory slice is a node that is closest to the head node in the free linked list and is in an unused state; The target data is stored in the target memory slice, wherein the target data is the image data of the current frame in the video transmitted by the data producer.

2. The method according to claim 1, characterized in that The data area also includes a used linked list, and after storing the target data in the target memory slice, it also includes: Updating the usage status of the target memory to a used status; The target memory slice is deleted from the free linked list, and the target memory slice is inserted into the used linked list.

3. The method according to claim 2, characterized in that The head node of the used linked list and the head node of the free linked list are associated with each other through a memory allocation interface, and the target memory slice is deleted from the free linked list and the target memory slice is inserted into the used linked list, including: The target memory slice is deleted from the free linked list through the memory allocation interface, and the target memory slice is inserted into the used linked list.

4. The method according to claim 2, characterized in that: The free linked list is a bidirectional circular linked list whose head node does not point to the tail node, and deleting the target memory slice from the free linked list includes: Obtain a first memory slice and a second memory slice, wherein the first memory slice is a previous memory slice of the target memory slice, and the second memory slice is a next memory slice of the target memory slice; The target memory slice is deleted from the free linked list by changing the following link node of the first memory slice from the target memory slice to the second memory slice and changing the preceding link node of the second memory slice from the target memory slice to the first memory slice.

5. The method according to claim 2, characterized in that: The used linked list is a bidirectional circular linked list whose head node does not point to the tail node, and the head node of the used linked list points to the next memory slice of the used linked list. Inserting the target memory slice into the used linked list includes: Changing the link node of the head node in the used linked list from the next memory slice to the target memory slice; The link node of the next memory slice is changed from the head node to the target memory slice, so as to insert the target memory slice into the used linked list.

6. The method according to claim 1, characterized in that The data area also includes a used linked list, and the head node of the used linked list is associated with the head node of the free linked list through a memory allocation interface. The method also includes: Based on the number of data consumers corresponding to the target data, setting a reference count corresponding to the target memory slice; When the reference count becomes 0, the use state of the target memory is updated to an unused state, wherein each time a data consumer finishes using the target data, the reference count is reduced by 1; The target memory slice is deleted from the used linked list through the memory allocation interface, and is inserted into the free linked list.

7. The method according to claim 6, characterized in that When the reference count becomes 0, before updating the usage state of the target memory to an unused state, the method further includes: Receiving the logical address of the target memory slice from the data producer, where the logical address is obtained by the data producer based on the starting virtual address of the memory block obtained by the data producer and the virtual address of the target memory slice; The logical address is sent to a data consumer corresponding to the target data, so that the data consumer determines the storage location of the target memory slice based on the logical address and the starting virtual address of the memory block obtained by the data consumer itself, and uses the target data based on the storage location of the target memory slice.

8. A data processing device, characterized in that: The device comprises: A memory block acquisition unit, used to apply for a memory block for a data producer from a shared memory space, wherein the memory block includes a data area and a management area, the data area includes a free linked list and a used linked list, the free linked list and the used linked list respectively include a plurality of memory slices of the same size in the storage space, and the head node of the free linked list is connected to the head node of the used linked list, and the management area is used to record the use status of all memory slices in the data area; A target memory slice acquisition unit, configured to determine a target memory slice from the free linked list based on the usage status of the memory slices in the free linked list, wherein the target memory slice is a node that is closest to the head node in the free linked list and is in an unused state; The linked list management unit is used to store target data into the target memory slice, wherein the target data is the data currently produced by the data producer.

9. An electronic device, characterized in that: including one or more processors and memory; One or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, wherein when the program code is run, the method according to any one of claims 1 to 7 is executed.