A data frame transmission method, device, equipment and medium

By splitting image data frames into multiple data packets and adding packet headers in memory during data transmission between the UVC device and the host computer, the problems of high memory usage and high processor load are solved, and the system response speed is improved.

CN116567113BActive Publication Date: 2026-03-17SHENZHEN ORBBEC CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-18
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

During the data transmission between the UVC device and the host computer, the existing technology's image data splitting and reassembly operations result in a large memory footprint, high processor load, and low system response speed.

Method used

The image data frame is split into multiple data packets and arranged sequentially in the initial memory of the storage device. A header is added to the memory before the first data packet according to the order of the data packets. Then, the data packets are output one by one until all data packets are output, thus avoiding multiple copies of the data.

Benefits of technology

By adding packet headers directly to the memory, memory footprint and processor load are reduced, thus improving system response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116567113B_ABST
    Figure CN116567113B_ABST
Patent Text Reader

Abstract

The application provides a data frame transmission method and device, equipment and medium, relates to the technical field of data transmission, and the method comprises the following steps: acquiring a data frame of an image, splitting the data frame into a plurality of data packets, and sequentially arranging and storing the plurality of data packets on an initial memory of a storage; adding a packet header to the front memory of the first data packet according to the arrangement order of the plurality of data packets on the initial memory, and outputting the data packet after adding the packet header from the storage; wherein the memory unit where the data packet and the packet header are located is regarded as an idle state after being output; the packet header is added to the front memory of the next data packet and is output until all the data packets are output. Through the implementation of the application scheme, the packet header is directly added before the memory unit of the data packet stored in the storage, the multiple copying of data is avoided, the occupation of the memory of the storage and the load of the processor are reduced, and the system response speed is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and more particularly to the field of data transmission technology, applicable to image data transmission scenarios. More specifically, this application discloses a data frame transmission method, apparatus, device, and medium. Background Technology

[0002] Currently, the Universal Serial Bus (USB) protocol is widely used in data transmission. Besides the general hardware and software electrical interface specifications, this protocol also includes various class protocols. The UVC (USB Video Class) protocol provides a unified data exchange standard for USB devices. Different UVC devices, after being connected to a host computer, can be directly recognized by the host computer's operating system and used directly without requiring drivers.

[0003] During data transmission, if a frame of image data needs to be transferred from the UVC device to the host computer, the image data needs to be split into several data packets at the UVC device end, and then reassembled at the host computer end. The process of splitting and repackaging the image data at the UVC device end consumes a significant amount of memory, and the data copying operation increases the processor load, reducing system response speed.

[0004] It is important to note that the techniques described in this section are not necessarily those previously conceived or adopted. Unless otherwise specified, no technique described in this section should be assumed to be prior art simply because it is included in this section. Similarly, unless otherwise specified, the issues mentioned in this section should not be considered to be recognized in any prior art. Summary of the Invention

[0005] This application provides a data frame transmission method, apparatus, device, and medium, which can at least solve the problems of large memory usage, high processor load, and low system response speed of the data transmission methods provided in related technologies.

[0006] The first aspect of this application provides a data frame transmission method, comprising: acquiring an image data frame; splitting the data frame into multiple data packets; and storing the multiple data packets sequentially in the initial memory of a memory; according to the arrangement order of the multiple data packets in the initial memory, adding a header to the front memory of the first data packet; and outputting the data packet with the added header from the memory; wherein, after the data packet and its header are output, the memory unit where it is located is considered to be in an idle state; adding a header to the front memory of the next data packet and outputting it, until all data packets are output.

[0007] A second aspect of this application provides a data frame transmission apparatus, including a storage module for acquiring image data frames, splitting the data frames into multiple data packets, and storing the multiple data packets sequentially in the initial memory of the memory; a transmission module for adding a header to the front memory of the first data packet according to the order of the multiple data packets in the initial memory, and outputting the data packet with the added header from the memory; wherein, after the data packet and its header are output, the memory unit where it is located is considered to be in an idle state; the transmission module is further used to add a header to the front memory of the next data packet and output it, until all data packets are output.

[0008] A third aspect of this application provides a UVC device, including a camera, a memory, a processor, and a UVC interface. The camera is used to acquire image data frames; the memory is used to provide memory units for storing data; the processor is used to implement the steps in the data frame transmission method provided in the first aspect of the embodiments of this application; and the UVC interface is used to output data packets with added headers to a host computer.

[0009] The fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the steps of the data frame transmission method provided in the first aspect of the embodiments of this application.

[0010] The fifth aspect of this application provides a computer program product that, when run on a computer, implements the steps of the data frame transmission method provided in the first aspect of this application.

[0011] As can be seen from the above, according to the data frame transmission method, apparatus, device, and medium provided in this application, image data frames are acquired, the data frames are split into multiple data packets, and the multiple data packets are sequentially arranged and stored in the initial memory of the memory. Based on the arrangement order of the multiple data packets in the initial memory, a header is added to the memory before the first data packet, and the data packet with the added header is output from the memory. After the data packet and its header are output, the memory unit where it is located is considered idle. A header is added to the memory before the next data packet and output, until all data packets are output. By implementing this application, a header is directly added before the memory unit where the data packets are stored in the memory, avoiding multiple copies of data, reducing memory usage and processor load, and effectively improving system response speed.

[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0013] The accompanying drawings exemplify embodiments and form part of the specification, working together with the textual description to explain exemplary implementations of the embodiments. The drawings shown are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0014] Figure 1 This is a schematic diagram of the structure of an image acquisition system provided in an embodiment of this application;

[0015] Figure 2 This is a schematic diagram of the structure of an image acquisition system provided in another embodiment of this application;

[0016] Figure 3 A schematic diagram illustrating the principle of a data frame transmission method provided in an embodiment of this application;

[0017] Figure 4 A schematic diagram illustrating the principle of a data frame transmission method provided in another embodiment of this application;

[0018] Figure 5 A schematic diagram illustrating the principle of a data frame transmission method provided in another embodiment of this application;

[0019] Figure 6 A basic flowchart illustrating a data frame transmission method provided in an embodiment of this application;

[0020] Figure 7 A schematic diagram of the program modules of a data frame transmission apparatus provided in an embodiment of this application. Detailed Implementation

[0021] To make the inventive objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] To better understand the solutions of the embodiments of this application, the following will first combine... Figure 1 A brief introduction to the possible application scenarios of the embodiments of this application is provided.

[0023] Figure 1An image acquisition system is shown, comprising a UVC device 100 and a host computer 200. The UVC device 100 includes a camera 110, a memory 120, a processor 130, and a UVC interface 140. The UVC device 100 includes, but is not limited to, digital cameras, analog video converters, TV cards, and still video cameras, while the host computer 200 includes, but is not limited to, smart terminals such as mobile phones, personal computers, or information processing centers.

[0024] exist Figure 1 In the illustrated embodiment, the images captured by the UVC device 100 through the camera 110 are first stored in the memory 120 and processed by the processor 110. Then, they are sent to the host computer 200 through the UVC interface 140, and the host computer 200 can display the images captured by the UVC device 100 on the screen. During the transmission of image data from the UVC device 100 to the host computer 200, the image data in the memory needs to be split into several data packets. The host computer then reconstructs these split data packets, and also involves adding reconstructed information.

[0025] In one implementation, the processor 130 may be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), neural network chips, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0026] Understandably, the UVC device 100 provided in this embodiment includes a camera 110, a memory 120, a processor 130, and a UVC interface 140. The camera 110 is used to acquire image data frames; the memory 120 provides memory units for data storage, with the memory units arranged consecutively and each memory unit corresponding to a physical address; the processor 130 is used to execute a data frame transmission method; and the UVC interface 140 is used to output data packets with added headers to a host computer. The processor 130 can execute the data frame transmission method by calling a computer program in the memory 120 or by using its own chip program.

[0027] Figure 2Another image acquisition system is shown, which includes a UVC device 100 and a host computer 200. The UVC device 100 includes a camera 110, a memory 120, a processor 130, a UVC interface 140, and a Direct Memory Access (DMA) controller 150.

[0028] Compared to Figure 1 The embodiment shown, Figure 2 The image acquisition system in the illustrated embodiment includes a DMA controller 150, which is controlled by the processor 110 and can output data from the memory 120 via a dedicated bus. Specifically, the processor 110 sends a control signal to the DMA controller 150, which then retrieves the currently header-added data packet from the memory 120 and sends it to the UVC interface. Figure 2 Other device functions and Figure 1 Similarly, detailed solutions can be found in the description above, and will not be repeated here.

[0029] like Figure 3 The diagram illustrates the principle of a data frame transmission method. First, the data of a single frame image is split into multiple data packets (data packets 1 to n), and these data packets are stored in the initial memory 121 of the memory 120. To send data packets 1 to n to the host computer, a header needs to be added to each data packet. The header includes identification information, verification information, etc., which are not limited here. Each memory segment in the memory 120 includes several memory units, and the physical addresses of these memory units are contiguous. To add a corresponding header to each data packet, this embodiment searches for a target memory segment 122 in the memory 120, and then executes steps S31-S3n to obtain the data frame with the added header. Specifically, step S31 involves copying data packet 1 and adding the corresponding header; step S32 involves copying data packet 2 and adding the corresponding header; ...; step S3n involves copying data packet n and adding the corresponding header. After obtaining the data frame with the added header, the processor 110 sequentially acquires the data packets with the added header and outputs them to the host computer via the UVC interface. The target memory 122 is a contiguous free memory unit, and its storage space is not less than that of the data frame after adding the packet header.

[0030] like Figure 4The diagram illustrates another data frame transmission method. First, the data frame of a certain image frame is split into multiple data packets, which are then stored in the initial memory 121 of the memory 120. Similar to the previous embodiment, to send data packets 1 to n to the host computer, a header needs to be added before each data packet, and the memory units on the memory 120 are contiguous. In this embodiment, a target memory segment 122 is located on the memory 120, and steps S41 and S42 are executed to obtain the data frame with the added header. Specifically, in step S41, data packets 1 to n are copied from the initial memory 121 to the target memory 122, ensuring that each data packet has a free memory unit before it for adding a header; in step S42, a corresponding header is added before each data packet, resulting in the data frame with the added header. After obtaining the data frame with the added header, the processor 110 sequentially acquires the data packets with the added header and outputs them to the host computer via the UVC interface. The target memory 122 is a contiguous free memory unit, and its storage space is not less than the data frame with the added header.

[0031] However in Figure 3 or Figure 4 In the data frame processing process shown, all data packets of the data frame need to be copied. The copying process will consume memory, increase the load, and result in low data transmission efficiency.

[0032] Therefore, in order to solve the problem that the above-mentioned data frame processing process consumes memory, increases load, and leads to low data transmission efficiency, an embodiment of this application provides a data frame transmission method, applied to, for example... Figure 1 or Figure 2 The image acquisition system shown.

[0033] The following will describe in detail, with reference to the accompanying drawings, a data frame transmission method, apparatus, device, and medium according to embodiments of this application.

[0034] like Figure 5This is a schematic diagram illustrating the principle of a data frame transmission method provided in this application embodiment. First, the data frame of a certain image frame is split into multiple data packets. Considering that the front-end memory of the data frame (or data packet 1) stored in the initial memory 121 may not be empty, or the space in the front-end memory may not be sufficient to accommodate the header of data packet 1, this embodiment will search for a target memory 122 on the memory 120, and then execute steps S51-S53. During the execution of steps S51-S53, a header is added to each data packet, and the processor 110 immediately outputs the data packet with the added header to the host computer through the UVC interface. Specifically, in step S51, data packet 1 is cut to the target memory 122, and a header is added to the front-end memory of data packet 1. It can be understood that the front-end memory of data packet 1 after cutting belongs to the target memory 122. Before step S52 is executed, data packet 1 and its header will be output under the control of the processor 110, meaning the memory unit storing data packet 1 and its header will be a free memory unit. Similarly, in step S52, the corresponding header is added to the front memory of data packet 2, and then output after the header is added; ...; in step S5n, the corresponding header is added to the front memory of data packet n, and then output after the header is added. This ultimately achieves the goal of adding headers to all data packets of a data frame and outputting them to the host computer. By implementing this embodiment, it is possible to ensure that other data stored in the memory is not affected, while reducing data packet transfer operations and memory usage.

[0035] In some other embodiments, to further reduce data packet transfer operations, before executing step S51, it can be determined whether the front memory of the data frame (or data packet 1) in the initial memory 121 is empty, or whether the space of the front memory can accommodate the header of data packet 1. If it is determined that the front memory is empty, or the space of the front memory can accommodate the header of data packet 1, step S51 is modified to: directly add the header to the front memory of the current location of data packet 1. There is no need to search for the target memory 122 in the memory 120. The reason why the header cannot be directly added to the front memory of data packet 1 in the initial memory is that the addresses of the physical memory in the memory are contiguous. The front memory of data packet 1 in the initial memory is not necessarily empty; it may contain other data. Forcibly storing it may cause system crashes. Therefore, when adding a header to the first data packet of a data frame, it is necessary to check in advance whether there are enough free addresses in the front memory of the data frame to allow for successful insertion of the header without affecting other data stored in the memory.

[0036] In this embodiment, both copying and cutting of data packets can be performed using the `memcpy` function. Copying process: The `memcpy` function copies the data packet from the specified memory location to the new memory location. Cutting process: The `memcpy` function copies the data packet from the specified memory location to the new memory location, and the initial memory of the data packet is marked as free.

[0037] like Figure 6 This is a schematic diagram illustrating the basic process of a data frame transmission method provided in an embodiment of this application. In this embodiment, the data frame transmission method can be applied to... Figure 1 or Figure 2 The UVC equipment in the process includes the following steps:

[0038] S61, acquire the image data frame, split the data frame into multiple data packets, and store the multiple data packets in the initial memory of the memory in sequence.

[0039] In practical applications, a camera is used to capture image data frames. The camera may include an image sensor and a buffer. The data frames captured by the image sensor are first temporarily stored in the buffer, and then transferred to a contiguous block of memory. Of course, in some embodiments, the data frames in the buffer can be processed and calculated by a processor before being sent to memory. In this embodiment, due to data transmission limitations, the processor will split the data frames captured by the camera into multiple data packets based on transmission limitation indicators, and then store these multiple data packets sequentially in contiguous initial memory according to the order of the memory units.

[0040] Understandably, data transmission limit refers to the size of the data packet that can be transmitted each time. If a data frame is 100kb in size, but the data transmission limit (usually a hardware limitation) causes only 5kb data packets to be transmitted each time, then the data frame needs to be decomposed into multiple data packets according to the data transmission limit. The decomposed data packets, after adding a header, satisfy the data transmission limit (e.g., less than 5kb).

[0041] S62, according to the order of multiple data packets in the initial memory, adds a header to the front memory of the first data packet, and outputs the data packet with the added header from the memory.

[0042] Once the data packet and its header are output, the memory unit where it is located will be considered to be in an idle state.

[0043] S63 adds a header to the front memory of the next data packet and outputs it, until all data packets are output.

[0044] In this embodiment, the memory units of the memory are contiguous. The memory segment before the memory unit storing the packet header is a memory unit with free space before the memory unit storing the data packet. The packet header may include essential data packet attribute information such as frame markers and timestamps. How to add the packet header can be referred to the description of the principle diagram of the data frame transmission method in the previous embodiment.

[0045] In this embodiment, the UVC device and the host computer communicate via the UVC interface. In one optional implementation, after a header is added to a single data packet, the header-added data packet is output to the host computer via the UVC interface. That is, in this embodiment, after adding headers to each data packet, the packaged data is output, and then headers are added to subsequent data packets, and so on, to achieve the packaging and output of data packets one by one.

[0046] In some embodiments, step S62 includes: determining whether the memory preceding the first data packet is free; if not, searching for a target memory segment in the memory, adding the data packet and its header to the target memory, and outputting the data packet with the added header from the memory; wherein the memory space of the target memory is larger than the size of the first data packet and its header. Specifically, before transferring the data packet to the target memory, it is determined whether there is enough free address in front of the first data packet stored in the initial memory to store the header of the first data packet; if so, there is no need to transfer the first data packet to other memory units, that is, the header is directly added to the memory preceding the current first data packet. When adding a header to the first data packet of a data frame, checking in advance whether there is enough free address in front of the data packet to allow for successful header addition can ensure that other data stored in the memory is not affected, while reducing data packet transfer operations and reducing memory usage.

[0047] In this embodiment, data packet 1 is transferred to the target memory, ensuring that after the transfer, there is sufficient free address in the memory preceding data packet 1 to store its header. After the transfer and header addition, data packet 1 is output to the UVC interface by the processor. The addresses in both the initial and target memory used to store data packet 1 become free. Understandably, the memory preceding data packet 2 was originally occupied by data packet 1. After the header is added, data packet 1 is output, leaving the memory preceding data packet 2 free. Therefore, the header can be directly added to the memory preceding data packet 2 without transferring it. Subsequent data packets undergo the same operation. After the header is added to data packet n-1, it is output to the UVC interface by the processor, leaving the memory preceding data packet n free. The header of data packet n can then be directly added to the memory preceding data packet n.

[0048] In some embodiments, step S62 includes: locating a target memory segment in the memory, copying the first data packet to the target memory, and then sending the header of the first data packet to the front memory segment of the data packet; wherein the memory space of the target memory is larger than the size of the first data packet and its header; and outputting the first data packet and its header from the memory. In this embodiment, it is not necessary to determine whether there is enough free address before the first data packet to store the header of the first data packet, thus improving the situation where a large number of data frames need to be output. That is, when the data frame is output from the UVC device to the host computer, the first data packet after the data frame is split will be transferred to a memory unit where the front memory segment is free, omitting the process that the processor needs to make a judgment and avoiding the probability of errors.

[0049] In some embodiments, the data frame transmission method is applied to Figure 1 The image acquisition system shown in the diagram outputs data packets to the UVC interface via a processor after a header is added. In another embodiment, the data frame transmission method is applied... Figure 2 In the image acquisition system shown, after a header is added to the data packet, the processor sends a control signal to the DMA controller. The DMA controller then retrieves the data packet with the added header and sends it to the UVC interface.

[0050] In one optional embodiment of this example, the memory includes multiple memory partitions, each with contiguous memory units. Accordingly, the process of decomposing the data frames of the images captured by the camera into multiple data packets and then storing them in a contiguous segment of memory includes: identifying a free initial memory segment in any memory partition, decomposing the data frames of the images captured by the camera into multiple data packets, and sequentially storing the multiple data packets in the initial memory; wherein the storage space of the initial memory is larger than the space required by the data frames.

[0051] Specifically, the memory in this embodiment is configured with multiple memory partitions, each corresponding to a contiguous segment of memory units. The initial memory for storing the data frame is located in a certain memory partition, and the free memory space of the initial memory is greater than the actual space required for storing the data frame. In this embodiment, since the memory units before the memory unit where the first data packet is stored may not be free, forcibly inserting a header may erase some important data and cause the system to crash. Therefore, in one embodiment, a free address for adding a header is reserved in the initial memory before storing the data frame. In another embodiment, after the data frame is stored in a certain memory partition, the first data packet of the data frame is copied to another memory partition, and a free address for adding a header is ensured in that memory partition.

[0052] Furthermore, in an optional embodiment of this example, before copying the first data packet of the data frame to the target memory, the method further includes: obtaining the data attributes of the currently stored data in the front-end memory of the first data packet; determining whether the currently stored data is non-deletable based on the data attributes; and if the currently stored data is non-deletable, performing the step of transferring the first data packet to a new memory unit in another free memory partition.

[0053] Specifically, in practical applications, although the front-end memory of the first data packet is occupied, the current stored data in the front-end memory is not necessarily valid data. Therefore, this embodiment can determine whether the data can be deleted based on the data attributes of the current stored data in the front-end memory, and only implement the aforementioned process of transferring the first data packet when it is determined that it cannot be deleted.

[0054] Furthermore, in an optional embodiment of this example, after the step of determining whether the currently stored data is undeletable based on data attributes, the method further includes: if the currently stored data is not undeletable, deleting the currently stored data in the front memory of the memory unit where the first data packet is stored, and then adding the corresponding packet header to the front memory.

[0055] Continuing with the description of the aforementioned implementation method, if the current stored data in the front-end memory of the first data packet is non-essential data that can be deleted, then the data in the front-end memory of the first data packet can be modified in the memory partition where the data frame is originally stored. That is, the original stored data in the memory unit can be deleted, and then the corresponding packet header of the first data packet can be added to the memory unit, and the sending address can be moved to the position where the packet header is added, thereby realizing data frame packaging and avoiding copying the data frame in memory.

[0056] An embodiment of this application also provides a computer-readable storage medium, which can be disposed in the aforementioned image acquisition system. The computer-readable storage medium can be the aforementioned... Figure 1 or Figure 2 The memory 120 in the illustrated embodiment. Furthermore, the computer storage medium can also be a USB flash drive, external hard drive, read-only memory (ROM), RAM, magnetic disk, or optical disk, or any other medium capable of storing program code.

[0057] Figure 7A data frame transmission apparatus provided in one embodiment of this application can be used to implement the data frame transmission method in the foregoing embodiments. The data frame transmission apparatus mainly includes: a storage module 71, used to acquire image data frames, split the data frames into multiple data packets, and store the multiple data packets in the initial memory of the memory in sequence; a transmission module 72, used to add a header to the front memory of the first data packet according to the arrangement order of the multiple data packets in the initial memory, and output the data packet with the added header from the memory; wherein, after the data packet and its header are output, the memory unit where it is located will be considered to be in an idle state; the transmission module 72 is also used to add a header to the front memory of the next data packet and output it, until all data packets are output.

[0058] In some implementations of this embodiment, the above-mentioned output module is specifically used to: output the data packet with the added header to the host computer via the UVC interface whenever a single data packet has had its header added.

[0059] In some embodiments of this example, the memory includes multiple memory partitions, each of which has multiple memory units with contiguous physical addresses. Accordingly, the aforementioned storage module is specifically used to: decompose the data frames of the images captured by the camera into multiple data packets, and request initial memory in the memory according to the theoretical space occupied by the data packets; wherein the free memory space of the initial memory is greater than the theoretical space occupied; reserve the target memory at the head of the queue in the initial memory as free, and then store the multiple data packets in multiple contiguous memory units following the target memory.

[0060] In some implementations of this embodiment, the above-mentioned adding module is specifically used to: determine whether the front memory of the memory unit where the first data packet is stored in the multiple data packets has free memory space; if the front memory does not have free memory space, then transfer the first data packet to a new memory unit in another free memory partition, and add the corresponding packet header to the front memory of the new memory unit; for the remaining data packets that are not the first data packet in the multiple data packets, add the corresponding packet header to the front memory of the current memory partition where each remaining data packet is located in turn.

[0061] Furthermore, in some embodiments of this example, the data frame transmission device further includes an acquisition module and a judgment module, wherein the acquisition module is used to acquire the data attributes of the currently stored data in the front memory of the memory unit where the first data packet is stored; the judgment module is used to determine whether the currently stored data is non-deletable based on the data attributes. Accordingly, when the above-mentioned adding module performs the function of transferring the first data packet to a new memory unit in another free memory partition, it is specifically used to: if the currently stored data is non-deletable, then transfer the first data packet to a new memory unit in another free memory partition.

[0062] Furthermore, in some embodiments of this example, the above-mentioned adding module is also used to: if the currently stored data is not undeletable, delete the currently stored data in the front memory of the memory unit where the first data packet is stored, and then add the corresponding packet header to the front memory.

[0063] In some embodiments of this example, the above-mentioned output module is specifically used to: transmit data packets with headers added to the memory to the device output buffer based on the direct memory access mechanism; and output the data packets with headers added to the device output buffer to the host computer using the UVC interface.

[0064] It should be noted that the data frame transmission methods in the foregoing embodiments can all be implemented based on the data frame transmission device provided in this embodiment. Those skilled in the art can clearly understand that, for the sake of convenience and brevity, the specific working process of the data frame transmission device described in this embodiment can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0065] Based on the technical solution of the above embodiments of this application, the data frames of the images captured by the camera are decomposed into multiple data packets, and then stored in multiple consecutive memory units in the memory. For each data packet, a corresponding header is added to the front-end memory, where the front-end memory is the memory unit with free memory space preceding the memory unit storing the data packet. The data packet with the added header is output to the host computer using the UVC interface. By implementing the solution of this application, the header is directly added before the memory unit storing the data packet in the kernel, avoiding multiple copies of memory, reducing memory usage and processor load, and effectively improving system response speed.

[0066] It should be noted that the apparatuses and methods disclosed in the several embodiments provided in this application can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0067] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0068] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0069] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned readable storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0070] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0071] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0072] The above is a description of the data frame transmission method, apparatus, device and medium provided in this application. For those skilled in the art, based on the ideas of the embodiments of this application, there will be changes in the specific implementation and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method of data frame transmission, characterized by, The method comprises the following steps: acquiring a data frame of an image, splitting the data frame into a plurality of data packets, and sequentially arranging and storing the plurality of data packets on an initial memory of a memory, wherein the initial memory is a continuous free memory unit in the memory, and a storage space of the initial memory is greater than an actual occupied space of the data frame; determining whether a front memory of a first data packet is in a free state; if not, acquiring a data attribute of current stored data in the front memory, and determining whether the current stored data is non-deletable data based on the data attribute; if the current stored data is non-deletable data, searching for a target memory on the memory, cutting the first data packet to the target memory, and adding a packet header on the front memory of the first data packet, wherein a memory space of the target memory is greater than a size of the first data packet and the packet header; if the current stored data is not non-deletable data, deleting the current stored data in the front memory and adding a packet header on the front memory; if the front memory of the first data packet is in the free state, directly adding a packet header on the front memory; outputting the data packets with the added packet headers from the memory, wherein each of the data packets and the packet header is immediately regarded as in the free state after being outputted and can be reused by new data; adding a packet header on a front memory of a next data packet and outputting, until all the data packets are outputted, and using a memcpy function to realize a copy operation of the data packets, and outputting each of the data packets with the added packet header to an upper computer through a UVC interface.

2. The data frame transmission method of claim 1, wherein, The method of acquiring the data frame of the image and splitting the data frame into the plurality of data packets comprises the following steps: acquiring the data frame of the image, and splitting the data frame into the plurality of data packets based on a preset transmission limit.

3. A data frame transmission apparatus, characterized by comprising: The method comprises the following steps: a storage module is configured to acquire a data frame of an image, split the data frame into a plurality of data packets, and sequentially arrange and store the plurality of data packets on an initial memory of a memory, wherein the initial memory is a continuous free memory unit in the memory, and a storage space of the initial memory is greater than an actual occupied space of the data frame; a transmission module is configured to determine whether a front memory of a first data packet is in a free state; if not, acquire a data attribute of current stored data in the front memory, and determine whether the current stored data is non-deletable data based on the data attribute; if the current stored data is non-deletable data, search for a target memory on the memory, cut the first data packet to the target memory, and add a packet header on the front memory of the first data packet, wherein a memory space of the target memory is greater than a size of the first data packet and the packet header; if the current stored data is not non-deletable data, delete the current stored data in the front memory and add a packet header on the front memory; if the front memory of the first data packet is in the free state, directly add a packet header on the front memory; output the data packets with the added packet headers from the memory, wherein each of the data packets and the packet header is immediately regarded as in the free state after being outputted and can be reused by new data; The transmission module is further configured to add a packet header to the front of each of the data packets and output the data packets until all the data packets are output, and to use a memcpy function to implement a copy operation of the data packets and output each of the data packets with the packet header to the host computer through the UVC interface.

4. The data frame transmission apparatus of claim 3, wherein The storage module is further configured to: obtain a data frame of an image, and split the data frame into a plurality of data packets based on a preset transmission limit.

5. A UVC device, characterized by, Comprise: a camera configured to collect a data frame of an image; a memory configured to provide a memory unit for storing data; a processor configured to implement the steps in the data frame transmission method of claim 1 or 2; a UVC interface configured to output the data packets with the packet header to the host computer.

6. The UVC device of claim 5, wherein, Further comprising a DMA controller configured to receive instructions from the processor, extract the data packets with the packet header from the memory, and output the data packets to the UVC interface.

7. A computer-readable storage medium storing a computer program, wherein the computer program comprises the following steps of: receiving a request for a resource from a client; determining whether the client is authorized to access the resource; and if the client is authorized to access the resource, providing the resource to the client. The computer program, when executed by the processor, implements the steps in the data frame transmission method of claim 1 or 2.

Citation Information

Patent Citations

  • Message sending method and communication equipment

    CN109672629A