Non-continuous memory access device for handling out-of-bound coordinates and control method
Patent Information
- Application Number
- CN202610007775.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-05
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2046-01-05
AI Technical Summary
但是,在汇聚数据的过程中,往往会出现坐标越界的问题,尤其是在双线性插值过程中,当需要访问某个像素点的周围四个像素点时,如果该像素点的坐标位于原始图像的边缘,那么要访问的四个像素点就可能会超出原始图像的范围,从而会导致gather模块访问到了原始图像之外的坐标,也即造成了越界访问
[0014] In an embodiment of this application, a continuous reading module reads the original coordinates from memory; a detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates; a coordinate-to-address module obtains the detection result; if the detection result indicates that the original coordinates are not out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates; a non-continuous reading module reads the target data from memory based on the absolute address corresponding to the original coordinates; and a writing module writes the target data into memory. This technical solution processes out-of-bounds coordinates through hardware and can directly and continuously process them without needing to separately request out-of-bounds coordinates from memory, significantly saving time and improving the processing efficiency. Furthermore, this technical solution does not require actual filling of the original image, saving memory space and bandwidth.
Smart Images

Figure CN121958141B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of chip technology, and in particular to a device and control method for handling non-continuous memory access with out-of-bounds coordinates. Background Technology
[0002] Currently, in digital signal processing devices involving vector processing, the gather (non-contiguous memory access) module can aggregate data from multiple non-contiguous memory addresses into a single vector. However, during the data aggregation process, coordinate out-of-bounds issues often occur, especially during bilinear interpolation. When accessing the four pixels surrounding a given pixel, if the pixel's coordinates are located at the edge of the original image, the four pixels to be accessed may exceed the range of the original image. This causes the gather module to access coordinates outside the original image, resulting in out-of-bounds access.
[0003] To address the aforementioned technical issues, related technologies employ software to perform edge padding on the original image in Double Data Rate Synchronous Dynamic Random Access Memory (DDR) before writing it back to DDR. This not only incurs additional processing time but also consumes DDR memory and bandwidth. Summary of the Invention
[0004] This application provides a device and control method for handling non-contiguous memory access with out-of-bounds coordinates. By processing out-of-bounds coordinates in hardware, it eliminates the need for actual filling of the original image, saving time, memory space, and bandwidth. The technical solution is as follows: According to a first aspect of the embodiments of this application, a device for processing non-contiguous memory access with out-of-bounds coordinates is provided, comprising: The system comprises a continuous read module, a detection module, a coordinate-to-address module, a non-continuous read module, and a write module, which are electrically connected in sequence; the continuous read module and the non-continuous read module are electrically connected to the memory. The continuous reading module is used to read the original coordinates from the memory; The detection module is used to detect the original coordinates and obtain the detection result corresponding to the original coordinates; The coordinate-to-address module is used to obtain the detection result; if the detection result is that the original coordinates are not the out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates; the out-of-bounds coordinates are the coordinates outside the original image; the endpoint coordinates are the last coordinates to be read; The non-continuous reading module is used to read target data from the memory based on the absolute address corresponding to the original coordinates; The write module is used to write the target data into the memory.
[0005] In one possible implementation, the device further includes a FIFO and an insertion module; The first end of the FIFO is electrically connected to the detection module; The first end of the insertion module is electrically connected to the non-continuous reading module, the second end of the insertion module is electrically connected to the second end of the FIFO, and the third end of the insertion module is electrically connected to the write module.
[0006] In one possible implementation, under constant-fill mode: The detection module is also used to generate encoded information of the original coordinates based on the detection results of the original coordinates; The FIFO is used to store the encoded information of the original coordinates; The insertion module is configured to receive the target data when the encoding information of the original coordinates indicates that the original coordinates are not the out-of-bounds coordinates and are not the endpoint coordinates; or when the encoding information of the original coordinates indicates that the original coordinates are not the out-of-bounds coordinates and are the endpoint coordinates.
[0007] In one possible implementation, under constant-fill mode: The coordinate-to-address module is further configured to, if the detection result indicates that the original coordinates are the out-of-bounds coordinates and the endpoint coordinates, obtain the starting coordinates of the original image; the starting coordinates are the first coordinates read from the original image; and convert the starting coordinates to obtain the absolute address corresponding to the starting coordinates. The non-continuous read module is used to read the target data from the memory based on the absolute address corresponding to the starting coordinates; The insertion module is further configured to receive the target data and obtain a preset value if the encoded information indicates that the original coordinates are the out-of-bounds coordinates and the endpoint coordinates; The write module is used to write the preset value into the memory.
[0008] In one possible implementation, under constant-fill mode: The coordinate-to-address module is further configured to, if the detection result indicates that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates, not convert the original coordinates and not transmit the original coordinates to the non-continuous reading module; The insertion module is further configured to obtain a preset value if the encoding information of the original coordinates indicates that the original coordinates are the out-of-bounds coordinates and not the endpoint coordinates. The write module is also used to write the preset value into the memory.
[0009] In one possible implementation, the FIFO is in a closed state during edge copy-fill mode; The coordinate-to-address module is used to adjust the out-of-bounds coordinates based on a preset adjustment value if the detection result indicates that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates, thereby obtaining adjusted coordinates; and to convert the adjusted coordinates to obtain the absolute address corresponding to the adjusted coordinates. The non-continuous reading module is used to read target data from the memory based on the absolute address corresponding to the adjusted coordinates; The insertion module is used to receive the target data; The write module is used to write the target data into the memory.
[0010] In one possible implementation, adjusting the out-of-bounds coordinates based on preset coordinates to obtain adjusted coordinates includes: When the x-coordinate of the out-of-bounds coordinate exceeds the limit, the x-coordinate is adjusted to a preset x-coordinate. And / or when the ordinate of the out-of-bounds coordinate goes out of bounds, the ordinate is adjusted to a preset ordinate.
[0011] In one possible implementation, the FIFO is in a closed state in mirror-fill mode; The coordinate-to-address module is used to adjust the out-of-bounds coordinates based on a preset algorithm to obtain adjusted coordinates if the detection result indicates that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates; and to convert the adjusted coordinates to obtain the absolute address corresponding to the adjusted coordinates. The non-continuous reading module is used to read target data from the memory based on the absolute address corresponding to the adjusted coordinates; The insertion module is used to receive the target data; The write module is used to write the target data into the memory.
[0012] In one possible implementation, adjusting the out-of-bounds coordinates based on a preset algorithm to obtain the adjusted coordinates includes: When the x-coordinate of the out-of-bounds coordinate exceeds the limit, the x-coordinate difference is obtained; the x-coordinate difference is the difference between a preset x-coordinate threshold and the x-coordinate of the out-of-bounds coordinate. The horizontal coordinate of the adjusted coordinate is obtained by subtracting the preset horizontal coordinate threshold and the horizontal coordinate difference. And / or when the ordinate of the out-of-bounds coordinate is out of bounds, the ordinate difference is obtained; the ordinate difference is the difference between a preset ordinate threshold and the ordinate of the out-of-bounds coordinate. The ordinate of the adjusted coordinate is obtained by subtracting the preset ordinate threshold and the ordinate difference.
[0013] According to a second aspect of the embodiments of this application, a method for handling non-contiguous memory access control for out-of-bounds coordinates is provided, comprising: The control module continuously reads the original coordinates from the memory; The control detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates; The control coordinate to address module obtains the detection result; if the detection result is that the original coordinates are not the out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates; the out-of-bounds coordinates are the coordinates outside the original image; the endpoint coordinates are the last coordinates read from the original image; The control module for non-continuous reading reads target data from the memory based on the absolute address corresponding to the original coordinates; The control write module writes the target data into the memory.
[0014] In an embodiment of this application, a continuous reading module reads the original coordinates from memory; a detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates; a coordinate-to-address module obtains the detection result; if the detection result indicates that the original coordinates are not out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates; a non-continuous reading module reads the target data from memory based on the absolute address corresponding to the original coordinates; and a writing module writes the target data into memory. This technical solution processes out-of-bounds coordinates through hardware and can directly and continuously process them without needing to separately request out-of-bounds coordinates from memory, significantly saving time and improving the processing efficiency. Furthermore, this technical solution does not require actual filling of the original image, saving memory space and bandwidth. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1This is a schematic diagram of a first non-contiguous memory access device for processing out-of-bounds coordinates provided in an embodiment of this application; Figure 2 This is a schematic diagram of a method for processing non-contiguous memory access with out-of-bounds coordinates, performed by an apparatus according to an embodiment of this application. Figure 3 This is a schematic diagram of a second non-contiguous memory access device for processing out-of-bounds coordinates provided in an embodiment of this application; Figure 4 This is a flowchart illustrating a first method for processing non-contiguous memory access with out-of-bounds coordinates in constant-fill mode, as provided in the embodiments of this application. Figure 5 This is a flowchart illustrating a second method for processing non-contiguous memory accesses with out-of-bounds coordinates, performed by the device in constant-fill mode, according to an embodiment of this application. Figure 6 This is a flowchart illustrating a method for processing non-contiguous memory accesses that cross boundaries in edge copy-fill mode, as provided in an embodiment of this application. Figure 7 This is a flowchart illustrating a method for handling non-contiguous memory access with out-of-bounds coordinates, performed by a device in mirror-fill mode, according to an embodiment of this application. Figure 8 This is a flowchart illustrating a non-contiguous memory access control method for handling out-of-bounds coordinates, according to an embodiment of this application. Figure 9 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of this application. Detailed Implementation
[0017] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the concept or scope of this application. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.
[0018] To facilitate understanding of the technical solutions of the embodiments of this application, the relevant technologies of the embodiments of this application are described below. The following relevant technologies are optional solutions and can be combined with the technical solutions of the embodiments of this application in any way, and all of them fall within the protection scope of the embodiments of this application.
[0019] In related technologies, edge filling of the original image in the Double Data Rate Synchronous Dynamic Random Access Memory (DDR) is performed by software and then written back to DDR. This not only takes extra processing time, but also consumes DDR memory and bandwidth. Moreover, as the size of the original image increases, the time consumed, the DDR memory consumed, and the bandwidth consumed will also increase accordingly.
[0020] The three most common edge filling methods are as follows: The first edge filling method: The original image is filled with a constant, so the coordinates of the out-of-bounds edges correspond to constant values. For example, a custom constant can be used to fill the area outside the original image.
[0021] The second edge filling method involves copying and filling the edges of the original image. The data corresponding to the out-of-bounds coordinates is the data corresponding to the nearest coordinate in the original image to that out-of-bounds coordinate.
[0022] The third edge filling method involves mirroring the original image. The data corresponding to the out-of-bounds coordinate is then the data corresponding to the mirror-symmetric coordinate in the original image. Specifically, mirror filling sets the pixel values outside the original image to the "mirror values" of the pixels inside the original image to avoid out-of-bounds access.
[0023] To address the aforementioned technical problems, embodiments of this application provide a non-contiguous memory access device for handling out-of-bounds coordinates. During non-contiguous memory access, a detection module detects each original coordinate. If the original coordinate is out of bounds, a coordinate-to-address module performs coordinate and address conversion to obtain an absolute address. A non-contiguous read module reads target data from memory based on the absolute address. An insertion module selects to receive the target data or replace the target data with a preset value, and a write module writes the target data and the preset value into memory. This technical solution can handle out-of-bounds coordinates continuously without needing to process them separately and issue a read request to memory after determining them, significantly saving time compared to related technologies. Furthermore, it eliminates the need for additional padding of the original image, greatly saving memory space and bandwidth compared to related technologies.
[0024] Figure 1 This is a schematic diagram of a first type of non-contiguous memory access device for handling out-of-bounds coordinates, provided according to an embodiment of this application. (Combined with...) Figure 1 A detailed description is provided of non-contiguous memory access structures for handling out-of-bounds coordinates. The apparatus includes: The sequentially connected sequential read module 102, detection module 103, coordinate-to-address module 104, non-sequential read module 105, and write module 106 are electrically connected; the sequential read module 102 and the non-sequential read module 105 are electrically connected to the memory 101. All of these modules are implemented in hardware. The interfaces of all modules conform to the Advanced eXtensible Interface Stream (AXIS) protocol.
[0025] For example, the memory is implemented based on DDR. The sequential read module 102 and the non-sequential read module 105 are implemented based on Direct Memory Access (DMA). The write module 106 is implemented based on Write DMA.
[0026] The embodiments of this application process out-of-bounds coordinates through a hardware module, thereby solving the problems of wasted time, memory bandwidth, and space caused by using software to process out-of-bounds coordinates in related technologies.
[0027] Figure 2 This is a schematic diagram illustrating a method for processing non-contiguous memory accesses with out-of-bounds coordinates, executed by a device according to an embodiment of this application. (In conjunction with...) Figure 2 A detailed description of the method for handling non-contiguous memory access with out-of-bounds coordinates is provided. This method includes the following steps S201 to S205.
[0028] In step S201, the continuous reading module reads the original coordinates from memory.
[0029] In some examples, the sequential read module uses a pipeline to read the original coordinates corresponding to multiple consecutive addresses one by one from memory.
[0030] In step S202, the detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates.
[0031] In some examples, the detection module detects the received raw coordinates and obtains the detection results corresponding to each raw coordinate.
[0032] For example, let's explain using an original coordinate as an example. The detection module checks each original coordinate to determine whether it's an out-of-bounds coordinate and whether it's the endpoint coordinate. Specifically, the detection module performs two checks on the original coordinate: one check is to determine whether the original coordinate is an out-of-bounds coordinate, i.e., whether the original coordinate exceeds the range of the original image; the other check is to determine whether the original coordinate is the endpoint coordinate, i.e., whether the original coordinate is the last coordinate to be read in the original image. Generally, the original image is read in the order from left to right and from top to bottom. Therefore, the endpoint coordinate is the last coordinate to be read, and its ordinate is also the largest coordinate. In other words, the detection result is whether the original coordinate is an out-of-bounds coordinate and whether it is the endpoint coordinate.
[0033] For example, given the x-coordinate range and y-coordinate range of the original coordinates, determine whether the original coordinates are out of bounds based on the x-coordinate and y-coordinate. The x-coordinate range is... Indicates; among which, Represents the smallest x-coordinate in the original image. The x-coordinate represents the largest value in the original image; the range of the y-coordinate is represented by... Indicates; among which, Represents the smallest ordinate in the original image. This represents the minimum ordinate in the original image. The ranges for both the x and y coordinates are pre-configured in the registers. The original coordinates are represented by (...). , () indicates. When It falls within the range of the horizontal axis, and If the coordinates fall within the range of the vertical coordinate, then the original coordinates are not out-of-bounds coordinates; or when Not falling within the range of the horizontal axis and / or If the coordinates do not fall within the original coordinate range, then the original coordinates are considered out-of-bounds coordinates. When the detection module detects a high-level Transfer Last (TLAST) signal, it determines the original coordinates are the destination coordinates; or when the detection module detects a low-level TLAST signal, it determines the original coordinates are not the destination coordinates. For example, The range is 1 to 11; The range is 2 to 12.
[0034] Based on the above analysis, it can be understood that the test results include the following situations: The first type of test result: When Falling within the range of the horizontal axis, If the coordinates fall within the range of the vertical coordinate and the detection module detects a low-level TLAST signal, then the original coordinates are neither out-of-bounds coordinates nor endpoint coordinates.
[0035] The second test result: When Falling within the range of the horizontal axis, If the coordinates fall within the range of the vertical coordinate and the detection module detects a high-level TLAST signal, then the original coordinates are not out-of-bounds coordinates, but the endpoint coordinates.
[0036] The third type of test result: When Not falling within the range of the horizontal axis and / or If the original coordinates do not fall within the range of the vertical coordinates and the detection module detects a low-level TLAST signal, then the original coordinates are out-of-bounds coordinates, not the endpoint coordinates.
[0037] The fourth type of test result: when Not falling within the range of the horizontal axis and / or If the original coordinates do not fall within the range of the vertical coordinates and the detection module detects a high-level TLAST signal, then the original coordinates are out-of-bounds coordinates and are the endpoint coordinates.
[0038] In step S203, the coordinate-to-address module obtains the detection result; if the detection result is that the original coordinates are not out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates.
[0039] In some examples, `offset_addr`, `stride_x`, `stride_y`, and `bytes_num` are obtained. Here, `offset_addr` is the offset address of the original image relative to the base address in DDR; `x-axis step` refers to the number of bytes added to the corresponding absolute address in DDR for each increment of the x-coordinate; `y-axis step` refers to the number of bytes added to the corresponding absolute address in DDR for each increment of the y-coordinate; and `bytes_num` refers to the number of bytes to be read from the consecutive addresses corresponding to each original coordinate. The absolute address corresponding to the original coordinate is calculated based on the x-coordinate, y-coordinate, `offset_addr`, `stride_x`, and `stride_y`.
[0040] For example, multiply stride_x and the x-coordinate to get the number of bytes that the absolute address corresponding to the x-coordinate increases; multiply stride_y and y to get the number of bytes that the absolute address corresponding to the y-coordinate increases; calculate the offset address, the number of bytes that the absolute address corresponding to the x-coordinate increases, and the number of bytes that the absolute address corresponding to the y-coordinate increases to get the absolute address corresponding to the original coordinate.
[0041] For example, the absolute address corresponding to the original coordinates can be calculated using the following formula: Absolute address = offset_addr + stride_x × x + stride_y × y.
[0042] For example: offset_addr is 100, stride_x is 2, stride_y is 22, and bytes_num is 2.
[0043] For example, although the multiple original coordinates to be read correspond to multiple consecutive addresses in memory, after the coordinate-to-address module converts each original coordinate into its corresponding absolute address based on the above formula, these absolute addresses are non-contiguous, that is, discrete.
[0044] In step S204, the non-continuous reading module reads the target data from memory based on the absolute address corresponding to the original coordinates.
[0045] In some examples, the non-contiguous read module reads consecutive bytes corresponding to the absolute address based on bytes_num. For instance, if bytes_num is 2, the non-contiguous read module reads two consecutive bytes corresponding to the absolute address based on bytes_num.
[0046] In step S205, the write module reads the target data from the non-continuous read module and writes the target data into memory.
[0047] Figure 3 This is a schematic diagram of a second non-contiguous memory access device for handling out-of-bounds coordinates, provided according to an embodiment of this application. (Combined with...) Figure 3 The non-contiguous memory access structure for handling out-of-bounds coordinates is described in detail. The device also includes: FIFO 108 and insertion module 107; the first end of FIFO 108 is electrically connected to detection module 103; the first end of insertion module 107 is electrically connected to non-contiguous read module 105, the second end of insertion module 107 is electrically connected to the second end of FIFO 108; and the third end of insertion module 107 is electrically connected to write module 106.
[0048] In related technologies, during the linear interpolation of the original image, the original image can be filled using constant filling, edge copy filling, and mirror filling. Correspondingly, the embodiments of this application can also implement the aforementioned constant filling, edge copy filling, and mirror filling. However, the embodiments of this application do not actually fill the original image. Instead, when the read original coordinates are out-of-bounds coordinates, if in constant filling mode, a preset value, i.e., a constant, is output; if in edge copy filling mode, according to the edge copy principle, the target data corresponding to the coordinates in the original image closest to the out-of-bounds coordinates is output; if in mirror filling mode, according to the mirror principle, the target data corresponding to the coordinates in the original image closest to the out-of-bounds coordinates is output.
[0049] It is understandable that the filling mode to be executed by the device is configured in the relevant registers before the device is powered on. That is, once the device is powered on, the corresponding filling mode is automatically executed according to the configuration value in the register.
[0050] The constant filling mode will be explained below with reference to some examples.
[0051] Figure 4 This is a flowchart illustrating a first method for handling non-contiguous memory accesses with out-of-bounds coordinates, performed by a device in constant-fill mode, according to an embodiment of this application. (Combined with...) Figure 4 A detailed description is provided of the method for handling non-contiguous memory access with out-of-bounds coordinates. This method includes steps S401 to S408.
[0052] In step S401, in constant fill mode, the continuous read module reads the original coordinates from memory.
[0053] In some examples, the continuous read module reads multiple signals in addition to the original coordinates, including the Transfer Valid (TVALID) signal, the Transfer Ready (TREADY) signal, the Transfer Data (TDATA) signal, and the TLAST signal.
[0054] For example, the original coordinates to be read are (1, 3). Still using... The range is 1 to 11. Taking 2 to 12 as an example, (1, 3) is not an out-of-bounds coordinate.
[0055] In step S402, the detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates.
[0056] In step S403, the detection module generates encoded information of the original coordinates based on the detection results of the original coordinates.
[0057] In some examples, the encoding information includes a first sub-encoding information and a second sub-encoding information; the first sub-encoding information is obtained by encoding whether the original coordinates are out-of-bounds coordinates; the second sub-encoding information is obtained by encoding whether the original coordinates are the endpoint coordinates to be read.
[0058] For example, the bit width and bit value of the first sub-encoding information and the second sub-encoding are set and adjusted according to actual needs.
[0059] For example, the low bits of the encoded information store the first sub-encoded information, and the high bits of the encoded information store the second sub-encoded information; the bit width of both the first and second sub-encoded information is 1 bit; when the original coordinates are out-of-bounds coordinates, the first sub-encoded information is "1"; when the original coordinates are not out-of-bounds coordinates, the first sub-encoded information is "0"; when the original coordinates are the endpoint coordinates, the second sub-encoded information is "1"; when the original coordinates are not the endpoint coordinates, the second sub-encoded information is "0".
[0060] That is, when the original coordinates are neither out-of-bounds coordinates nor endpoint coordinates, the encoding information corresponding to the original coordinates is "00".
[0061] In some examples, when the detection module needs to write encoded information to the FIFO, the detection module pulls the write enable signal high; after the FIFO detects the high-level write enable signal, it writes the encoded information.
[0062] In step S404, the FIFO stores the encoded information of the original coordinates.
[0063] In some examples, the bit width of the encoded information is equal to the bit width of the FIFO.
[0064] In some examples, when the FIFO is empty, an empty signal is sent to the insertion module; when the FIFO is full, a full signal is sent to the detection module.
[0065] In step S405, the coordinate-to-address module obtains the detection result; if the detection result is that the original coordinates are not out-of-bounds coordinates and are not terminal coordinates, then the original coordinates are converted to obtain the absolute address.
[0066] Using the formula above as an example to calculate the absolute address, the absolute address of the original coordinates (1, 3) is 100 + 2 × 1 + 22 × 3, which is 168.
[0067] In some examples, a suitable FIFO depth is selected based on actual needs. This is because, after a non-continuous module sends a read request to memory, it needs to wait for a certain response time before receiving the target data returned by memory. Therefore, in the embodiments of this application, the FIFO ensures that while the non-continuous read module is waiting for the target data to be returned by memory, the detection module can continuously write encoded information to the FIFO. This allows the FIFO depth to cover the memory latency, thereby ensuring that the continuous read module is not stuck during the memory response period and can still read data normally.
[0068] In step S406, the non-continuous read module reads the corresponding target data from memory based on the absolute address.
[0069] When the absolute address is 168, the non-contiguous read module reads the 168th and 169th bytes of data, which are the target data. For example, the target data is c and d.
[0070] In step S407, the insertion module receives the target data when the encoding information of the original coordinates indicates that the original coordinates are not out-of-bounds coordinates and are not the endpoint coordinates.
[0071] In some examples, the insertion module determines whether the original coordinates are out-of-bounds coordinates and whether they are endpoint coordinates based on the encoded information, and determines whether to receive the target data corresponding to the encoded information based on the judgment results.
[0072] In some examples, when the insertion module needs to read the FIFO's encoded information, the detection module pulls the read enable signal high, and the FIFO returns the encoded information to the insertion module after detecting the high-level read enable signal.
[0073] It should be noted that steps S406 to S407 above are just an example. In another example, when the original coordinates are not out-of-bounds coordinates and are the endpoint coordinates, the coordinate-to-address module pulls the TLAST signal high to inform the non-continuous reading module that the target data is the last data to be read; when the encoding information of the original coordinates indicates that the original coordinates are not out-of-bounds coordinates and are the endpoint coordinates, the insertion module receives the target data.
[0074] For example, if the original coordinates are (11, 12), and the original coordinates are not out-of-bounds coordinates but are the endpoint coordinates, then the encoding information corresponding to the original coordinates is "10".
[0075] In step S408, the write module reads the target data from the insert module and writes the target data into memory.
[0076] The write module writes c and d into memory.
[0077] Based on the above analysis, it can be seen that, firstly, in constant-fill mode, using a FIFO to store encoded information eliminates the need to separately request out-of-bounds coordinates from memory; secondly, the depth of the FIFO is controlled by the latency of overwriting memory, preventing the continuous reading module from being stuck due to memory delays. Furthermore, because the FIFO has a small bit width, the increased hardware resource consumption is minimal. The detection and insertion modules only involve judgment logic and do not involve complex computational logic. Therefore, compared to related technologies, the device of this application has a smaller increase in area and power consumption.
[0078] Secondly, the above embodiments process out-of-bounds coordinates continuously, eliminating the need to request out-of-bounds coordinates from memory and process them separately after determining them. This saves the time of requesting and processing out-of-bounds coordinates from memory separately. Furthermore, the larger the size of the original image and the more out-of-bounds coordinates there are, the more time this application saves compared to related technologies.
[0079] In addition, the embodiments of this application process the endpoint coordinates to ensure that if the original coordinates are endpoint coordinates, the coordinate-to-address module replaces the original coordinates with the starting coordinates, converts the starting coordinates to obtain the absolute address of the starting coordinates, and pulls the TLAST signal high to notify the non-continuous reading module that the last target data is being read. This allows the non-continuous reading module to release the bus or send an interrupt after completing the task.
[0080] Figure 5 This is a flowchart illustrating a second method for handling non-contiguous memory accesses with out-of-bounds coordinates, performed by the device in constant-fill mode, according to an embodiment of this application. (Combined with...) Figure 5 A detailed description is provided of the method for handling non-contiguous memory access with out-of-bounds coordinates. This method includes steps S501 to S508.
[0081] In step S501, in constant fill mode, the continuous read module reads the original coordinates from memory.
[0082] In step S502, the detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates.
[0083] In step S503, the detection module generates encoded information of the original coordinates based on the detection results of the original coordinates.
[0084] For example, still using The range is 1 to 11. Taking 2 to 12 as an example, when the original coordinates are (4, 14), the original coordinates are out-of-bounds coordinates and are the endpoint coordinates, so the encoding information corresponding to the original coordinates is "11".
[0085] In step S504, the FIFO stores the encoded information of the original coordinates.
[0086] In step S505, if the detection result shows that the original coordinates are out-of-bounds coordinates and are the endpoint coordinates, the coordinate-to-address module obtains the starting coordinates of the original image; it then converts the starting coordinates to obtain the absolute address corresponding to the starting coordinates.
[0087] The starting coordinates are the first coordinates read from the original image; alternatively, the starting coordinates can also be understood as the coordinates in the original image with the smallest x-coordinate and the smallest y-coordinate. (Continuing with...) The range is 1 to 11. Taking 2 to 12 as an example, the starting coordinates are (1, 2).
[0088] It is understandable that although (4, 14) is an out-of-bounds coordinate, since it is also the endpoint coordinate, if the non-continuous reading module does not read this time, it cannot determine when to stop reading data, and thus cannot release the bus. Therefore, in the embodiments of this application, the starting coordinates of the original image are used instead of the original coordinates. That is, the coordinate-to-address module does not convert the original coordinates, but converts the starting coordinates to obtain the absolute address corresponding to the starting coordinates.
[0089] Using the above formula as an example to calculate the absolute address, the absolute address = 100 + 2 × 1 + 22 × 2, which is 146.
[0090] In step S506, the non-continuous reading module reads the target data from memory based on the absolute address corresponding to the starting coordinates.
[0091] When the absolute address is 146, the non-contiguous read module reads the 146th and 147th bytes of data, which are the target data. For example, the target data is a and b.
[0092] In step S507, when the encoding information indicates that the original coordinates are out-of-bounds coordinates and are the endpoint coordinates, the insertion module receives the target data and obtains the preset value.
[0093] In some examples, since the target data corresponds to the starting coordinates, the target data itself is not the data to be read in this instance. Therefore, although the insertion module receives the target data, it does not store it and instead retrieves preset values. These preset values are two constants. For example, the preset values might be m and m'.
[0094] In step S508, the write module writes the preset value into memory.
[0095] The write module writes m and m into memory.
[0096] It should be noted that steps S505 to S508 above are just an example. In another example, if the coordinate-to-address module detects that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates, it will not convert the original coordinates and will not transmit the original coordinates to the non-continuous reading module; the non-continuous reading module will pull down the TLAST signal level. If the encoding information of the original coordinates indicates that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates, the insertion module will not receive the target data and will obtain the preset value. In this case, since the original coordinates are both out-of-bounds coordinates and not the endpoint coordinates, there is no need to notify the non-continuous reading module to release the bus. Therefore, the coordinate-to-address module does not process the original coordinates. The insertion module only needs to directly obtain the preset value, i.e., m, m, after determining that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates. The write module reads the preset from the insertion module and writes the preset value into memory, i.e., writes m, m into memory.
[0097] In some examples, the write module reads preset values from the insert module but does not read the target dataset and writes the preset values to memory.
[0098] As can be seen from the above embodiments, the FIFO is enabled in constant fill mode. However, in edge copy fill mode and mirror mode, since the original coordinates are adjusted when they are out of bounds, resulting in adjusted coordinates, it can be assumed that the original coordinates are not out of bounds, and therefore the FIFO is not needed. Therefore, the FIFO is disabled in edge copy fill mode and mirror mode.
[0099] Figure 6 This is a flowchart illustrating a method for handling non-contiguous memory accesses exceeding boundaries in an edge copy-fill mode, as provided in an embodiment of this application. (Combined with...) Figure 6 A detailed description is provided of the method for handling non-contiguous memory access with out-of-bounds coordinates. This method includes steps S601 to S606.
[0100] In step S601, in edge copy fill mode, the continuous reading module reads the original coordinates from memory.
[0101] In step S602, the detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates.
[0102] It should be noted that steps S601 to S602 are the same as steps S201 to S202, and the embodiments of this application will not be described in detail.
[0103] In step S603, when the detection result shows that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates, the coordinate-to-address module adjusts the out-of-bounds coordinates based on the preset adjustment value to obtain the adjusted coordinates; the adjusted coordinates are then converted to obtain the absolute address corresponding to the adjusted coordinates.
[0104] In some examples, under edge copy fill mode, when the original coordinates are out of bounds, it could be the x-coordinate that is out of bounds, the y-coordinate that is out of bounds, or both the x-coordinate and y-coordinate that are out of bounds.
[0105] For example, when the x-coordinate of the out-of-bounds coordinate exceeds the limit, the x-coordinate is adjusted to a preset x-coordinate; When the ordinate of an out-of-bounds coordinate exceeds the limit, the ordinate is adjusted to a preset ordinate. The preset x-coordinate is the x-coordinate of the coordinate closest to the original coordinate in the original image, and the preset ordinate is the ordinate of the coordinate closest to the original coordinate in the original image.
[0106] For example, the original coordinates to be read are (13, 3). Still using... The range is 1 to 11. Taking coordinates 2 to 12 as an example, (13, 3) is an out-of-bounds coordinate, specifically the x-coordinate is out of bounds while the y-coordinate is within bounds, and it is not the endpoint coordinate. In this case, the default x-coordinate is... Then the coordinates are adjusted to (11, 3).
[0107] When the coordinates are adjusted to (11, 3), the absolute address = 100 + 2 × 11 + 22 × 3, which is 188.
[0108] In step S604, the non-continuous reading module reads the target data from memory based on the absolute address corresponding to the adjusted coordinates.
[0109] When the absolute address is 188, the non-contiguous read module reads the 188th and 189th consecutive bytes. For example, the target data is e and f.
[0110] In step S605, the insertion module receives the target data.
[0111] Understandably, in edge copy-fill mode, no encoding information or FIFO is involved. Therefore, the insertion module does not need to determine whether the original coordinates are out-of-bounds coordinates or end coordinates based on the encoding information. Thus, in edge copy-fill mode, the insertion module transparently transmits the target data.
[0112] The insertion module receives e and f.
[0113] In step S606, the write module writes the target data into memory.
[0114] The write module writes e and f into memory.
[0115] It should be noted that steps S603 to S604 above are an example. In another example, when the coordinate-to-address module detects that the original coordinates are out-of-bounds coordinates and are the endpoint coordinates, it adjusts the out-of-bounds coordinates based on a preset adjustment value to obtain adjusted coordinates; it then converts the adjusted coordinates to obtain the absolute address corresponding to the adjusted coordinates. After obtaining the absolute address corresponding to the adjusted coordinates, the TLAST signal level is pulled high to inform the non-continuous read module that this is the last target data to be read. The non-continuous read module reads the target data from memory based on the absolute address corresponding to the adjusted coordinates.
[0116] For example, if the original coordinates to be read are (4, 14), then (4, 14) are out-of-bounds coordinates, specifically the ordinate is out of bounds while the x-coordinate is within bounds. In this case, the default ordinate is... Then the coordinates are adjusted to (4, 12).
[0117] When the coordinates are adjusted to (4, 12), the absolute address = 100 + 2 × 4 + 22 × 12, which is 372.
[0118] When the absolute address is 372, the non-contiguous read module reads the 372nd and 373rd consecutive bytes. For example, the target data is g and h.
[0119] In another example, when the coordinate-to-address module detects that the original coordinates are neither out-of-bounds nor the endpoint coordinates, it adjusts the out-of-bounds coordinates based on a preset adjustment value to obtain adjusted coordinates. The adjusted coordinates are then converted to obtain the absolute address corresponding to those coordinates. The non-continuous read module reads the target data from memory based on the absolute address corresponding to the adjusted coordinates.
[0120] For example, if the original coordinates to be read are (1, 4), and (1, 3) are not out-of-bounds coordinates, then no adjustment of the original coordinates is needed.
[0121] When the coordinates are adjusted to (1, 4), the absolute address = 100 + 2 × 1 + 22 × 4, which is 190.
[0122] When the absolute address is 190, the non-contiguous read module reads the 190th and 191st consecutive bytes. For example, the target data is p and q.
[0123] Figure 7 This is a flowchart illustrating a method for handling non-contiguous memory accesses with out-of-bounds coordinates, executed by a device in mirror-fill mode, according to an embodiment of this application. (Combined with...) Figure 7 A detailed description is provided of the method for handling non-contiguous memory access with out-of-bounds coordinates. This method includes steps S701 to S706.
[0124] In step S701, in mirror fill mode, the continuous read module reads the original coordinates from memory.
[0125] In step S702, the detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates.
[0126] It should be noted that steps S701 to S702 are the same as steps S201 to S202, and the embodiments of this application will not be described in detail.
[0127] In step S703, if the detection result shows that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates, the coordinate-to-address module adjusts the out-of-bounds coordinates based on a preset algorithm to obtain the adjusted coordinates; and converts the adjusted coordinates to obtain the absolute address corresponding to the adjusted coordinates.
[0128] In some examples, under mirror fill mode, when the original coordinates are out of bounds, it could be the x-coordinate that is out of bounds, the y-coordinate that is out of bounds, or both the x-coordinate and y-coordinate that are out of bounds.
[0129] For example, when the x-coordinate of the out-of-bounds coordinate is out of bounds, the x-coordinate difference is obtained; the x-coordinate difference is the difference between the preset x-coordinate threshold and the x-coordinate of the out-of-bounds coordinate; the preset x-coordinate threshold and the x-coordinate difference are subtracted to obtain the x-coordinate of the adjusted coordinate.
[0130] For example, when the ordinate of the out-of-bounds coordinate is out of bounds, the ordinate difference is obtained; the ordinate difference is the difference between the preset ordinate threshold and the ordinate of the out-of-bounds coordinate; the preset ordinate threshold and the ordinate difference are subtracted to obtain the ordinate of the adjusted coordinate.
[0131] For example, the threshold for the horizontal axis is The threshold for the ordinate is When the x-coordinate of an out-of-bounds coordinate exceeds the limit, the difference in x-coordinates is obtained (x- Adjust the x-coordinate of the coordinate system to ( -(x- When the ordinate of an out-of-bounds coordinate exceeds the limit, the difference in ordinates (y-) is obtained. Adjust the ordinate of the coordinate system to ( ). -(y- )).
[0132] For example, the original coordinates to be read are (13, 3). Still using... The range is 1 to 11. Taking 2 to 12 as an example, (13, 3) is an out-of-bounds coordinate, specifically the x-coordinate is out of bounds while the y-coordinate is not, and it is not the endpoint coordinate. In this case, the x-coordinate of the adjusted coordinate is 9, so the adjusted coordinate is (9, 3).
[0133] When the coordinates are adjusted to (9, 3), the absolute address = 100 + 2 × 9 + 22 × 3, which is 184.
[0134] In step S704, the non-continuous reading module reads the target data from memory based on the absolute address corresponding to the adjusted coordinates.
[0135] When the absolute address is 184, the non-contiguous read module reads the 184th and 185th consecutive bytes. For example, the target data is h, i.
[0136] In step S705, the insertion module receives the target data.
[0137] The insertion module receives h and i.
[0138] Understandably, in mirror fill mode, no encoding information or FIFO is involved. Therefore, the insertion module no longer needs to determine whether the original coordinates are out-of-bounds coordinates or whether they are the endpoint coordinates based on the encoding information. Thus, in mirror fill mode, the insertion module transparently transmits the target data.
[0139] In step S706, the write module writes the target data into memory.
[0140] The write module writes h and i into memory.
[0141] It should be noted that steps S703 to S704 above are an example. In another example, if the coordinate-to-address module detects that the original coordinates are out-of-bounds coordinates and are the endpoint coordinates, it adjusts the out-of-bounds coordinates based on a preset algorithm to obtain adjusted coordinates; it then converts the adjusted coordinates to obtain the absolute address corresponding to the adjusted coordinates. After obtaining the absolute address corresponding to the adjusted coordinates, the TLAST signal level is pulled high to inform the non-continuous read module that this is the last target data to be read. The non-continuous read module reads the target data from memory based on the absolute address corresponding to the adjusted coordinates.
[0142] For example, if the original coordinates to be read are (4, 14), then (4, 14) is an out-of-bounds coordinate, specifically the ordinate is out of bounds while the x-coordinate is not, making it the endpoint coordinate. In this case, adjusting the ordinate to 10 will result in the adjusted coordinates being (4, 10).
[0143] When the coordinates are adjusted to (4, 10), the absolute address = 100 + 2 × 4 + 22 × 10, which is 328.
[0144] When the absolute address is 328, the non-contiguous read module reads the 328th and 329th consecutive bytes. For example, the target data is j and k.
[0145] In another example, the coordinate-to-address module converts the original coordinates to their absolute addresses if the original coordinates are neither out-of-bounds nor the endpoint. The non-continuous read module then reads the target data from memory based on the adjusted absolute address.
[0146] It should be noted that the non-continuous memory access device for processing out-of-bounds coordinates provided in the above embodiments is only illustrated by the division of the above functional modules when performing the corresponding steps. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0147] In an embodiment of this application, a continuous reading module reads the original coordinates from memory; a detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates; a coordinate-to-address module obtains the detection result; if the detection result indicates that the original coordinates are not out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates; a non-continuous reading module reads the target data from memory based on the absolute address corresponding to the original coordinates; and a writing module writes the target data into memory. This technical solution processes out-of-bounds coordinates through hardware and can directly and continuously process them without needing to separately request out-of-bounds coordinates from memory, significantly saving time and improving the processing efficiency. Furthermore, this technical solution does not require actual filling of the original image, saving memory space and bandwidth.
[0148] Figure 8 This is a flowchart illustrating a non-contiguous memory access control method for handling out-of-bounds coordinates, according to an embodiment of this application. The control method includes steps S801 to S805.
[0149] In step S801, the continuous reading module is controlled to read the original coordinates from memory.
[0150] In step S802, the control detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates.
[0151] In step S803, the coordinate-to-address module obtains the detection result; if the detection result is that the original coordinates are not out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates.
[0152] The boundary coordinates are the coordinates outside the original image; the endpoint coordinates are the last coordinates read from the original image.
[0153] In step S804, the control discontinuous reading module reads the target data from memory according to the absolute address corresponding to the original coordinates.
[0154] In step S805, the control write module writes the target data into memory.
[0155] In one possible implementation, the device further includes a FIFO and an insertion module; The first end of the FIFO is electrically connected to the detection module; The first end of the insertion module is electrically connected to the non-continuous read module, the second end of the insertion module is electrically connected to the second end of the FIFO, and the third end of the insertion module is electrically connected to the write module.
[0156] In one possible implementation, under constant-fill mode: The detection module is also used to generate encoded information of the original coordinates based on the detection results of the original coordinates; FIFO is used to store encoded information of the original coordinates; The insertion module is used to receive target data when the encoding information of the original coordinates indicates that the original coordinates are not out-of-bounds coordinates and are not the endpoint coordinates; or when the encoding information of the original coordinates indicates that the original coordinates are not out-of-bounds coordinates and are the endpoint coordinates.
[0157] In one possible implementation, under constant-fill mode: The coordinate-to-address module is also used to obtain the starting coordinates of the original image if the detection result is that the original coordinates are out-of-bounds coordinates and are the endpoint coordinates; the starting coordinates are the first coordinates read from the original image; the starting coordinates are converted to obtain the absolute address corresponding to the starting coordinates; The non-continuous read module is used to read target data from memory based on the absolute address corresponding to the starting coordinates; The insertion module is also used to receive target data and obtain preset values if the encoded information indicates that the original coordinates are out-of-bounds coordinates and are the endpoint coordinates; The write module is used to write preset values into memory.
[0158] In one possible implementation, under constant-fill mode: The coordinate-to-address module is also used to prevent the original coordinates from being converted and transmitted to the non-continuous reading module if the detection result shows that the original coordinates are out of bounds and are not the endpoint coordinates. The insertion module is also used to obtain a preset value if the encoding information of the original coordinates indicates that the original coordinates are out-of-bounds coordinates and are not the endpoint coordinates. The write module is also used to write preset values into memory.
[0159] In one possible implementation, the FIFO is turned off in edge copy-fill mode; The coordinate-to-address module is used to adjust the out-of-bounds coordinates based on a preset adjustment value if the detection result shows that the original coordinates are out-of-bounds coordinates and are not the endpoint coordinates, so as to obtain the adjusted coordinates; and to convert the adjusted coordinates to obtain the absolute address corresponding to the adjusted coordinates. The non-continuous read module is used to read target data from memory based on the absolute address corresponding to the adjusted coordinates; The insertion module is used to receive target data; The write module is used to write target data into memory.
[0160] In one possible implementation, the out-of-bounds coordinates are adjusted based on preset coordinates to obtain the adjusted coordinates, including: If the x-coordinate of an out-of-bounds coordinate exceeds the limit, the x-coordinate will be adjusted to the preset x-coordinate. And / or if the ordinate of the out-of-bounds coordinate is out of bounds, the ordinate will be adjusted to the preset ordinate.
[0161] In one possible implementation, the FIFO is in the off state in mirror-fill mode; The coordinate-to-address module is used to adjust the out-of-bounds coordinates based on a preset algorithm if the detection result shows that the original coordinates are out-of-bounds coordinates and are not the endpoint coordinates, so as to obtain the adjusted coordinates; and to convert the adjusted coordinates to obtain the absolute address corresponding to the adjusted coordinates. The non-continuous read module is used to read target data from memory based on the absolute address corresponding to the adjusted coordinates; The insertion module is used to receive target data; The write module is used to write target data into memory.
[0162] In one possible implementation, the out-of-bounds coordinates are adjusted based on a preset algorithm to obtain the adjusted coordinates, including: When the x-coordinate of the out-of-bounds coordinate is out of bounds, the x-coordinate difference is obtained; the x-coordinate difference is the difference between the preset x-coordinate threshold and the x-coordinate of the out-of-bounds coordinate. The horizontal coordinate is obtained by subtracting the preset horizontal coordinate threshold and the horizontal coordinate difference; And / or when the ordinate of the out-of-bounds coordinate is out of bounds, the ordinate difference is obtained; the ordinate difference is the difference between the preset ordinate threshold and the ordinate of the out-of-bounds coordinate. The ordinate of the adjusted coordinate is obtained by subtracting the preset ordinate threshold and the ordinate difference.
[0163] In an embodiment of this application, a continuous reading module reads the original coordinates from memory; a detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates; a coordinate-to-address module obtains the detection result; if the detection result indicates that the original coordinates are not out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates; a non-continuous reading module reads the target data from memory based on the absolute address corresponding to the original coordinates; and a writing module writes the target data into memory. This technical solution processes out-of-bounds coordinates through hardware and can directly and continuously process them without needing to separately request out-of-bounds coordinates from memory, significantly saving time and improving the processing efficiency. Furthermore, this technical solution does not require actual filling of the original image, saving memory space and bandwidth.
[0164] It should be noted that the non-contiguous memory access control method for handling out-of-bounds coordinates provided in the above embodiments and the non-contiguous memory access device embodiments for handling out-of-bounds coordinates belong to the same concept. For details of its specific implementation process, please refer to the device embodiments, which will not be repeated here.
[0165] In an embodiment of this application, a continuous reading module reads the original coordinates from memory; a detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates; a coordinate-to-address module obtains the detection result; if the detection result indicates that the original coordinates are not out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates; a non-continuous reading module reads the target data from memory based on the absolute address corresponding to the original coordinates; and a writing module writes the target data into memory. This technical solution processes out-of-bounds coordinates through hardware and can directly and continuously process them without needing to separately request out-of-bounds coordinates from memory, significantly saving time and improving the processing efficiency. Furthermore, this technical solution does not require actual filling of the original image, saving memory space and bandwidth.
[0166] Figure 9 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Figure 9 As shown, the electronic device includes a memory 901 and a processor 902. The memory 901 stores a computer program that can run on the processor 902. When the processor 902 executes the computer program, it implements the method described in the above embodiments. The number of memories 901 and processors 902 can be one or more. The electronic device also includes: The communication interface 903 is used to communicate with external devices and exchange and transmit data.
[0167] If the memory 901, processor 902, and communication interface 903 are implemented independently, they can be interconnected via a bus to communicate with each other. This bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0168] Optionally, in a specific implementation, if the memory 901, processor 902, and communication interface 903 are integrated on a single chip, then the memory 901, processor 902, and communication interface 903 can communicate with each other through an internal interface.
[0169] This application also provides a chip including a processor for calling and executing instructions stored in a memory, causing a communication device with the chip installed to perform the method provided in this application.
[0170] This application also provides a chip, including: an input interface, an output interface, a processor, and a memory. The input interface, output interface, processor, and memory are connected through an internal connection path. The processor is used to execute code in the memory. When the code is executed, the processor is used to execute the method provided in this application.
[0171] It should be understood that the aforementioned processor can be a CPU, or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), FPGAs, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. General-purpose processors can be microprocessors or any conventional processor. It is worth noting that the processor can be a processor supporting Advanced Reduced Instruction Set Machines (ARM) architecture.
[0172] Further, optionally, the aforementioned memory may include read-only memory and random access memory. The memory may be volatile memory or non-volatile memory, or may include both. Non-volatile memory may include read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available. Examples include Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Sync Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0173] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another.
[0174] In addition to the methods and apparatus described above, embodiments of this disclosure may also provide a computer program product, including computer program instructions that, when executed by a processor, cause the processor to perform the steps of the image processing methods of the various embodiments of this disclosure described in the "Exemplary Methods" section above.
[0175] Computer program products can be written in any combination of one or more programming languages to perform the operations of embodiments of this disclosure. These programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on a user's computing device, partially on a user's computing device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0176] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.
[0177] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0178] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process. Furthermore, the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functionality involved.
[0179] The logic and / or steps described in the flowchart or otherwise herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-included system or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).
[0180] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. All or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware, the program being stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiments.
[0181] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. This storage medium can be a read-only memory, a disk, or an optical disk, etc.
[0182] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various variations or substitutions within the technical scope described in this application, and these should all be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A device for handling non-contiguous memory access with out-of-bounds coordinates, characterized in that, include: The sequentially electrically connected modules are a continuous reading module, a detection module, a coordinate-to-address module, a non-continuous reading module, and a write module. The continuous read module and the non-continuous read module are electrically connected to the memory; The continuous reading module is used to read the original coordinates from the memory; The detection module is used to detect the original coordinates and obtain the detection result corresponding to the original coordinates; The coordinate-to-address module is used to obtain the detection result; if the detection result is that the original coordinates are not the out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates; the out-of-bounds coordinates are the coordinates outside the original image; the endpoint coordinates are the last coordinates to be read; The non-continuous reading module is used to read target data from the memory based on the absolute address corresponding to the original coordinates; The write module is used to write the target data into the memory.
2. The apparatus according to claim 1, characterized in that, The device also includes a FIFO and an insertion module; The first end of the FIFO is electrically connected to the detection module; The first end of the insertion module is electrically connected to the non-continuous reading module, the second end of the insertion module is electrically connected to the second end of the FIFO, and the third end of the insertion module is electrically connected to the write module.
3. The apparatus according to claim 2, characterized in that, In constant fill mode: The detection module is also used to generate encoded information of the original coordinates based on the detection results of the original coordinates; The FIFO is used to store the encoded information of the original coordinates; The insertion module is configured to receive the target data when the encoding information of the original coordinates indicates that the original coordinates are not the out-of-bounds coordinates and are not the endpoint coordinates; or when the encoding information of the original coordinates indicates that the original coordinates are not the out-of-bounds coordinates and are the endpoint coordinates.
4. The apparatus according to claim 3, characterized in that, In constant fill mode: The coordinate-to-address module is further configured to, if the detection result indicates that the original coordinates are the out-of-bounds coordinates and the endpoint coordinates, obtain the starting coordinates of the original image; the starting coordinates are the first coordinates read from the original image; and convert the starting coordinates to obtain the absolute address corresponding to the starting coordinates. The non-continuous read module is used to read the target data from the memory based on the absolute address corresponding to the starting coordinates; The insertion module is further configured to receive the target data and obtain a preset value if the encoded information indicates that the original coordinates are the out-of-bounds coordinates and the endpoint coordinates; The write module is used to write the preset value into the memory.
5. The apparatus according to claim 2, characterized in that, In constant fill mode: The coordinate-to-address module is further configured to, if the detection result indicates that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates, not convert the original coordinates and not transmit the original coordinates to the non-continuous reading module; The insertion module is further configured to obtain a preset value if the encoding information of the original coordinates indicates that the original coordinates are the out-of-bounds coordinates and not the endpoint coordinates. The write module is also used to write the preset value into the memory.
6. The apparatus according to claim 2, characterized in that, In edge copy fill mode, the FIFO is in the off state; The coordinate-to-address module is used to adjust the out-of-bounds coordinates based on a preset adjustment value if the detection result indicates that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates, thereby obtaining adjusted coordinates; and to convert the adjusted coordinates to obtain the absolute address corresponding to the adjusted coordinates. The non-continuous reading module is used to read target data from the memory based on the absolute address corresponding to the adjusted coordinates; The insertion module is used to receive the target data; The write module is used to write the target data into the memory.
7. The apparatus according to claim 6, characterized in that, The step of adjusting the out-of-bounds coordinates based on a preset adjustment value to obtain the adjusted coordinates includes: When the x-coordinate of the out-of-bounds coordinate exceeds the limit, the x-coordinate is adjusted to a preset x-coordinate. And / or when the ordinate of the out-of-bounds coordinate goes out of bounds, the ordinate is adjusted to a preset ordinate.
8. The apparatus according to claim 2, characterized in that, In mirror-fill mode, the FIFO is in the off state; The coordinate-to-address module is used to adjust the out-of-bounds coordinates based on a preset algorithm to obtain adjusted coordinates if the detection result indicates that the original coordinates are out-of-bounds coordinates and not the endpoint coordinates; and to convert the adjusted coordinates to obtain the absolute address corresponding to the adjusted coordinates. The non-continuous reading module is used to read target data from the memory based on the absolute address corresponding to the adjusted coordinates; The insertion module is used to receive the target data; The write module is used to write the target data into the memory.
9. The apparatus according to claim 8, characterized in that, The step of adjusting the out-of-bounds coordinates based on a preset algorithm to obtain the adjusted coordinates includes: When the x-coordinate of the out-of-bounds coordinate exceeds the limit, the x-coordinate difference is obtained; the x-coordinate difference is the difference between a preset x-coordinate threshold and the x-coordinate of the out-of-bounds coordinate. The horizontal coordinate of the adjusted coordinate is obtained by subtracting the preset horizontal coordinate threshold and the horizontal coordinate difference. And / or when the ordinate of the out-of-bounds coordinate is out of bounds, the ordinate difference is obtained; the ordinate difference is the difference between a preset ordinate threshold and the ordinate of the out-of-bounds coordinate. The ordinate of the adjusted coordinate is obtained by subtracting the preset ordinate threshold and the ordinate difference.
10. A method for controlling non-contiguous memory access to handle out-of-bounds coordinates, characterized in that, include: The continuous reading module is controlled to read the original coordinates from memory; The control detection module detects the original coordinates and obtains the detection result corresponding to the original coordinates; The control coordinate to address module obtains the detection result; if the detection result is that the original coordinates are not the out-of-bounds coordinates and are not the endpoint coordinates, then the original coordinates are converted to obtain the absolute address corresponding to the original coordinates; the out-of-bounds coordinates are the coordinates outside the original image; the endpoint coordinates are the last coordinates read from the original image; The control module for non-continuous reading reads target data from the memory based on the absolute address corresponding to the original coordinates; The control write module writes the target data into the memory.
Citation Information
Patent Citations
Memory cross-border detection method and device, electronic equipment and storage medium
CN114691469A
Image transformation method and component, chip and storage medium
CN115936971A