A census transform processor parallel computing method
By processing image data in blocks and utilizing the ping-pong caching technology of SRAM and DDR, the problem of decreased Census transform computation performance in the DSP computing unit is solved, achieving more efficient parallel computing and improving image processing performance and hardware utilization.
Patent Information
- Application Number
- CN202310486542.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-04
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-05-04
AI Technical Summary
When the DSP computing unit performs Census transform calculations, there are eight discontinuous points when comparing the size of the center point and the eight surrounding points. This makes it difficult to achieve parallel processing of data loading, data size comparison, and data splicing, resulting in performance degradation.
A parallel computing method using a Census transform processor is adopted. By processing image data in blocks, data loading and calculation are performed using SRAM and DDR. Ping-pong caching technology and parallel computing units are used to achieve continuous data loading and storage, thereby improving computing efficiency.
It improves the access and computation performance of Census transform, reduces memory usage, and enhances the parallel computing capabilities of the hardware, especially excelling in applications such as visual stereo matching and visual odometry.
Smart Images

Figure CN116503236B_ABST
Abstract
Description
[Technical Field]
[0001] This invention relates to the field of image transformation technology, and more specifically to a parallel computing method for a Census transform processor. [Background Technology]
[0002] The Census transform is a type of nonparametric image transform that can effectively detect local structural features in an image, such as edges and corners. The Census transform uses the local gray-level differences within the pixel neighborhood to convert pixel gray levels into bit strings. The Census calculation requires comparing C with eight surrounding points and then concatenating the eight 0 / 1 results into an 8-bit number. All points on the image must undergo the above calculation.
[0003] The Census transform can measure the similarity between two points in an image. To compare the similarity between two points in left and right views for disparity calculation, the Census values of these two points can be XORed bit by bit. The number of 1s in the result is then counted, which is denoted as the Hamming value between the two points. The Hamming value reflects the similarity between the two points; the smaller the Hamming value, the greater the similarity. The algorithm can be implemented by first XORing and then counting the number of 1s. A smaller Hamming value (distance) indicates higher similarity.
[0004] Figure 1 This is a schematic diagram of the Census transform. As shown in the figure, the Census transform algorithm flow is as follows.
[0005] (1) Compare the size of each point on the image with its eight neighboring points. If it is greater than or equal to the middle point C, output 1; otherwise, output 0.
[0006] (2) Concatenate the 0s or 1s of the eight outputs in the order of their labels to form an 8-bit value, which is the census value of the corresponding C point.
[0007] Figure 2 This is an example diagram of Census transform truth value calculation. (See diagram for example.) Figure 2 The image shows an example of truth value calculation for one of the points.
[0008] Figure 3 This is a schematic diagram of the changing Census transform. (Example) Figure 3 As shown, some algorithms make some changes to the above Census transform algorithm, and the selection positions of the eight points are changed accordingly.
[0009] Figure 4 This is a schematic diagram of the memory access structure of the DSP processor's computing unit. For example... Figure 4As shown in the diagram, the DSP processor hardware structure includes DDR, SRAM, and vector registers, all of which are memory units. Accessing these three memory units is fastest via the vector register, followed by SRAM, and then DDR. The computation unit directly retrieves data from the vector register for calculations.
[0010] When performing Census transform calculations using the DSP computing unit, as can be seen from the above Census transform algorithm calculation process, there are eight discontinuous points when comparing the size of the center point and the eight surrounding points. When loading these eight numbers into the vector register, there is a problem of skipping data retrieval, and they cannot be loaded into the vector register all at once, which will greatly affect performance. On the DSP processor, it is difficult to achieve parallel processing of data loading, data size comparison, and data concatenation according to the above calculation method.
[0011] Searching using the keyword "census transform" yielded a US patent titled "METHOD AND CIRCUITRYFOR PERFORMING CENSUS TRANSFORMS" with patent number US9905020. This patent does not include optimizations related to segmentation and drainage.
[0012] This invention addresses the technical problem of performance degradation in Census transformation calculations performed by DSP computing units, where the eight points are discontinuous and cannot be loaded into the vector register at once when comparing the size of the center point and the surrounding eight points. The invention provides a technical improvement to the Census transformation calculation method based on a DSP / vector processor. [Summary of the Invention]
[0013] The purpose of this invention is to provide a method for parallel processing computation of Census transform with improved access and computation performance.
[0014] A further objective of this invention is to provide a method for parallel processing computation of Census transform that improves access and computation performance without consuming more storage space.
[0015] To achieve the above objectives, the present invention adopts a Census transform processor parallel computing method. The Census transform is used to compare each pixel C in an image with eight neighboring pixels, where the distance between the eight pixels and pixel C is r pixels. If the comparison result is greater than or equal to the value of C, the output is 1; otherwise, the output is 0. The eight outputs of 0 or 1 are concatenated in numerical order to form an 8-bit value, which is the census value of pixel C. The processor includes SRAM, DDR, and N parallel computing units. The computing units directly retrieve data from the vector register for computation. When the processor executes a computation task, it first loads data from DDR into SRAM, then performs data computation by reading data from SRAM, outputting the result to SRAM, and finally storing the result from SRAM back to DDR. The method includes the following steps:
[0016] S1. Compare the size of pixel C with the eight neighboring pixels, and convert it into the size of the corresponding pixels of the middle region regionC with the number of row pixels w and column pixels h. Then compare the size and census value of each pixel in the eight surrounding regions region0, region1, region2, region3, region4, region5, region6 and region7 one by one. The processor loads the pixel data of the middle region and the eight surrounding regions from DDR to SRAM at one time.
[0017] S2, where w is an integer multiple of N, and the processor uses N pixels per row of the region as parallel access units; or where h is an integer multiple of N, and the processor uses N pixels per column of the region as parallel access units; the region consists of (w*h) / N parallel access units; the processor sequentially reads the parallel access units of the region, and the N calculation units perform one-to-one comparisons and concatenation of census values for the N pixels of the parallel access units, and output the corresponding parallel access unit census value sub-table; the process is repeated (w*h) / N times to obtain the census value table of the intermediate region C, and stored in SRAM.
[0018] Preferably, the specific steps of the calculation unit in step S2 to compare the size and census value of each pixel and concatenate them are as follows:
[0019] S21. Calculate the size of the region0 pixel and initialize the census value. Load the region0 pixel from SRAM into vector register v0, and load the regionC pixel from SRAM into vector register v1. Compare the data in vector registers v0 and v1, and store the comparison result in vector register v4.
[0020] S22: Calculate the size of the pixel in Region1 and shift and concatenate the census value. Load the pixel in Region0 from SRAM into vector register v0, and load the pixel in RegionC from SRAM into vector register v1. Load the data in vector register v4 into vector register v3. Compare the data in vector registers v0 and v1, store the comparison result in vector register v2, then shift the data in v3 left by one bit, and finally perform a bitwise OR operation between v2 and v3 and store the result in vector register v4.
[0021] S23. Following the calculation method in step S22, compare and calculate the size of pixels from Region2 to Region7 and perform census value shifting and splicing to obtain the census value, and store it in SRAM.
[0022] Preferably, the above-mentioned parallel computing method for Census transform processor divides the image stored in DDR into a group of blocks of size (w+2*r)*(h+2*r) that are stacked end to end and stored continuously. Each block includes pixel data of the middle region and eight surrounding regions. In step S1, the processor continuously reads the blocks to perform image Census transform.
[0023] Preferably, the SRAM is divided into an input SRAM ping-pong buffer and an output SRAM ping-pong buffer; the input SRAM ping-pong buffer includes input buffer0 and input buffer1, used to read blocks from DDR for the processor to calculate census values, and the size of input buffer0 and input buffer1 is equal to (w+2*r)*(h+2*r); the output SRAM ping-pong buffer includes output buffer0 and output buffer1, used for the processor to store the census value table back to DDR after completing the census value calculation, and the size of output buffer0 and output buffer1 is equal to w*h; the total SRAM size SRAM_SIZE >= (w+2*r)*(h+2*r)*2+w*h*2.
[0024] Furthermore, the step S1, in which the processor continuously reads blocks to perform image Census transformation, is a pipelined arrangement of several sequentially executed Census transformation tasks. Each block Census transformation task first performs block loading, loading one block from DDR into the input SRAM ping-pong buffer each time. Then, it performs block computation, reading the block from the input SRAM ping-pong buffer, and storing the result in the output SRAM ping-pong buffer. Finally, it performs block storage, storing the result in the output SRAM ping-pong buffer back into DDR. The block computation time of this block Census transformation task masks the block loading time of subsequent block Census transformation tasks and the block storage time of earlier block Census transformation tasks.
[0025] Preferably, the pipeline layout ensures that three Census transform tasks are working simultaneously at any given time, specifically:
[0026] The first block loads input buffer0;
[0027] The first calculation result is stored in output buffer0, and the second result is loaded into input buffer1.
[0028] The first block is stored, the second block of calculation results is stored in output buffer1, and the third block is loaded into input buffer0;
[0029] The second block stores the results, the third block stores the calculation results in output buffer0, and the fourth block loads them into input buffer1.
[0030] This process is repeated until the image undergoes a Census transformation.
[0031] Preferably, the processor is a DSP or a vector processor.
[0032] Preferably, the Census transform processor parallel computing method is used for visual stereo matching or visual odometry.
[0033] The beneficial effects of the parallel computing method for Census transform processors in this invention are as follows: 1. The hardware can calculate one row of data at a time. Since the data in each row of the region is continuous, this algorithm can ensure that the data load and store from SRAM to the vector can load one row of data at a time, resulting in high data loading and storage efficiency and improved performance; 2. Improved computational performance: After being loaded into the vector register, the hardware can calculate the result of one row of data at a time, including comparison and data concatenation; 3. Due to the use of memory reuse, data is read from the result of the previous region each time, and then stored back into the region after calculation, so it does not occupy more memory. [Attached Image Description]
[0034] Figure 1 This is a schematic diagram of the Census transform.
[0035] Figure 2 This is an example diagram of Census transform truth value calculation.
[0036] Figure 3 This is a schematic diagram of the changing Census transformation.
[0037] Figure 4 This is a schematic diagram of the memory access structure of the DSP processor's computing unit.
[0038] Figure 5 This is a schematic diagram of a Census transform processor parallel computing method that divides an image into a group of blocks according to the ping-pong buffer size.
[0039] Figure 6 This is a schematic diagram of a ping-pong buffer drainage method for parallel computing using a Census transform processor.
[0040] Figure 7 This is a schematic diagram of the ping-pong cache pipeline layout for a parallel computing method using the Census transform processor.
[0041] Figure 8 This is a schematic diagram of the left half of the position of eight regions relative to the middle region in a parallel computing method of Census transform processor.
[0042] Figure 9 This is a schematic diagram of the right half of the position of eight regions relative to the middle region in a parallel computing method of Census transform processor.
[0043] Figure 10 This is a schematic diagram of the computation process of a parallel computing method using a Census transform processor.
Detailed Implementation Methods
[0044] The features and exemplary embodiments of various aspects of the present invention will now be described in detail. In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the invention. However, it will be apparent to those skilled in the art that the invention may be practiced without requiring some of these specific details. The following description of embodiments is merely intended to provide a better understanding of the invention by illustrating examples of the invention. The invention is by no means limited to any specific configurations and algorithms presented below, but covers any modifications, substitutions, and improvements to elements, components, and algorithms without departing from the inventive concept. In the accompanying drawings and the following description, well-known structures and techniques are not shown in order to avoid unnecessarily obscuring the invention.
[0045] Example
[0046] This embodiment implements a parallel computing method for the Census transform processor.
[0047] When performing Census transform calculations using a DSP computing unit, the eight points around the center point are discontinuous when comparing their sizes. This leads to a skipping issue when loading these eight numbers into the vector register, preventing them from being loaded all at once. On a DSP processor, this method of data loading, size comparison, and concatenation can easily degrade performance. This embodiment addresses this by maximizing the use of vector and SRAM to cache intermediate results, and by performing parallel processing of data loading, size comparison, and concatenation during Census transform calculations on the DSP processor to improve performance.
[0048] As can be seen from the Census transform calculation process, the corresponding census value needs to be calculated for each point in the image. The method in this embodiment uses a block-based processing approach to increase the parallelism of each calculation. The algorithm flow is as follows:
[0049] (1) Figure 5 This is a schematic diagram illustrating a parallel computing method of the Census transform processor that divides an image into a group of blocks according to the ping-pong buffer size. (Example:) Figure 5 As shown, since the storage space of SRAM is generally small, the image is first divided into a group of blocks according to the size of SRAM.
[0050] (2) Draining: Load BLOCK0 from DDR into SRAM input buffer 0. While BLOCK0 is being calculated, load BLOCK1 into SRAM input buffer 1. After BLOCK0 is completed, store the result of BLOCK0 back to DDR and start the calculation of BLOCK1 and load BLOCK2 from DDR into SRAM input buffer 0. The subsequent BLOCKs are drained in the same way. Figure 6 This is a schematic diagram of a ping-pong cache drainage method for parallel computing using the Census transform processor. (See diagram for example.) Figure 6 As shown, the SRAM input and output positions belong to two pingpang buffers, namely BLOCK0 and BLOCK2 are loaded into input buffer0, and BLOCK1 and BLOCK3 are loaded into input buffer1. The store is similar. Figure 7 This is a schematic diagram of a ping-pong cache pipeline layout for a parallel computing method using the Census transform processor. (Example:) Figure 7 As shown, this ensures that three tasks are working simultaneously at any given time, using computation time to mask the load and store times.
[0051] A pingpang buffer is a structure consisting of two single-port SRAMs placed back-to-back.
[0052] (3) The third step is the characteristic of the method in this embodiment: the calculation of each block.
[0053] by Figure 3 The calculation method shown compares the size of the middle point with the eight surrounding points, transforming it into comparing the size of the middle region C with the eight surrounding regions one by one. Then, the result of the current region block is concatenated with the output result of the previous block until the calculation of the eight regions is completed, and finally the census result corresponding to region C is obtained. Figure 8 This is a schematic diagram of the left half of the position of eight regions relative to the middle region in a parallel computing method of Census transform processor. Figure 9 This is a right-half diagram illustrating the positions of eight regions relative to the central region in a Census transform processor parallel computing method. (See diagram for example.) Figure 8 , Figure 9 As shown, the positions of the eight regions relative to the central region are displayed in two separate images for easier viewing. The size of the region is determined based on the parallelism of the DSP processor and the SRAM size, with the specific settings as follows.
[0054] Let the width of the region be w pixels, the high-order bits be h pixels, the distance from the eight points to the center point be r pixels, the SRAM size be SRAM_SIZE, and the number of parallel computing units be N, where w is an integer multiple of N. The region Census transformation is performed using the N region pixel data in each row as parallel access units.
[0055] (w+2*r)*(h+2*r)*2+w*hε2<=SRAM_SIZE
[0056] The above condition ensures that the SRAM can store the basic region pixel data required for the Census transform calculation in this embodiment.
[0057] In another example of the method in this embodiment, the width of the region is w pixels, the high-order bits are h pixels, the distance from the eight points to the center point is r pixels, the SRAM size is SRAM_SIZE, and the number of parallel computing units is N, where h is an integer multiple of N. The region Census transformation is performed using N region pixel data in each column as parallel access units.
[0058] Figure 10 This is a schematic diagram illustrating the computation process of a parallel computing method using the Census transform processor. (Example:) Figure 10 As shown, the values of region0, region1...region7 are compared with regionC in that order. Then, the results from the corresponding positions of the eight regions are concatenated to form an 8-bit number of the region size. To reduce memory usage, the output buffer is reused each time. The calculation process for each region and intermediate regions is as follows:
[0059] The data in region0 is calculated row by row. For example, first load vector00 from SRAM into vector register v0, and at the same time load vectorC0 from SRAM into another vector register v1. The data in the two registers are compared and the result is stored in another vector register v2. Then v2 is copied to v3, and then vector01 is retrieved to continue the above calculation. After the first row of data is calculated, the second row of data is retrieved to continue the above calculation until the calculation of region0 is completed.
[0060] The calculation for Region1 is similar to that for Region0. First, the vector10 in the first row is loaded from SRAM into vector register v0, and vectorC0 is loaded from SRAM into another vector register v1. v0 and v1 are compared and the result is stored in vector register v2. Then, the data in v3 is shifted left by one bit, and v2 and v3 are bitwise ORed and the result is stored in register v4. Finally, register v4 is copied to register v3, and the calculation of subsequent data is continued in the same way.
[0061] The calculation method for Regions 2-7 is the same as for Region 1. Finally, the census results for all eight regions can be calculated.
[0062] The method described in this embodiment can run efficiently on a DSP or vector processor, fully utilizing the hardware's parallel capabilities, and has the following advantages compared to other algorithms:
[0063] 1. If the hardware can calculate 32 int8 data at a time, this algorithm can ensure that the data load and store from SRAM to vector can load 32 int8 data at a time because the data in each row of the region is continuous. However, some algorithms still load the eight points around the current point. Since the eight points are not continuous, the data will be retrieved in a skipping manner, which makes the data loading efficiency very poor and it is difficult to improve the performance.
[0064] 2. Computational aspects: After being loaded into the vector register, the hardware can calculate the result of 32 int8 values at once, including comparisons and data concatenation. Some algorithms can only calculate 8 int8 values.
[0065] 3. Because memory reuse is used, data is read from the previous region's result each time, and then stored back into the current region after calculation. Therefore, the method in this embodiment does not consume more memory than other algorithms.
[0066] This embodiment's method is applied in technical fields such as visual stereo matching and visual odometry. It generates motion trajectories for unmanned / manned vehicles, drones, or other moving objects by using a camera as input.
[0067] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM).
[0068] The above description is only a preferred embodiment of the present invention. It should be noted that those skilled in the art can make several improvements and additions without departing from the principle of the present invention, and these improvements and additions should also be considered within the scope of protection of the present invention.
Claims
1. A parallel computing method for a Census transform processor, wherein the Census transform is used to compare the size of each pixel C in an image with eight neighboring pixels, the eight neighboring pixels being r pixels away from pixel C. If the comparison result is greater than or equal to the value of C, the output is 1; otherwise, the output is 0. The eight outputs of 0 or 1 are concatenated in numerical order to form an 8-bit value, the 8-bit value being the census value of pixel C. The processor includes SRAM, DDR, and N parallel computing units. The computing units directly retrieve data from a vector register for computation. When the processor executes a computation task, it first loads data from DDR into SRAM, then performs data computation by reading data from SRAM, outputs the result to SRAM after computation, and finally stores the data by storing the result from SRAM back into DDR. The method is characterized in that... Includes the following steps: S1. Compare the size of pixel C with the eight neighboring pixels, and convert it into the size of the corresponding pixels of the middle region regionC with the number of row pixels w and column pixels h. Then compare the size and census value of each pixel in the eight surrounding regions region0, region1, region2, region3, region4, region5, region6 and region7 one by one. The processor loads the pixel data of the middle region and the eight surrounding regions from DDR to SRAM at one time. S2, where w is an integer multiple of N, and the processor uses N pixels per row of the region as parallel access units; or where h is an integer multiple of N, and the processor uses N pixels per column of the region as parallel access units; the region consists of (w*h) / N parallel access units; the processor sequentially reads the parallel access units of the region, and the N parallel computing units perform one-to-one comparisons and concatenation of census values for the N pixels of the parallel access units, and output the corresponding parallel access unit census value sub-table; the process is repeated (w*h) / N times to obtain the census value table of the intermediate region C, and stored in SRAM; The specific steps of step S2, in which the N parallel computing units perform one-to-one comparisons of the size and census values of the N pixels in the parallel access unit and concatenate them, are as follows: S21. Calculate the size of the region0 pixel and initialize the census value. Load the region0 pixel from SRAM into vector register v0, and load the regionC pixel from SRAM into vector register v1. Compare the data in vector registers v0 and v1, and store the comparison result in vector register v4. S22: Calculate the size of the pixel in Region1 and shift and concatenate the census value. Load the pixel in Region0 from SRAM into vector register v0, and load the pixel in RegionC from SRAM into vector register v1. Load the data in vector register v4 into vector register v3. Compare the data in vector registers v0 and v1, store the comparison result in vector register v2, then shift the data in v3 left by one bit, and finally perform a bitwise OR operation between v2 and v3 and store the result in vector register v4. S23. Following the calculation method in step S22, compare and calculate the size of pixels from Region2 to Region7 and perform census value shifting and splicing to obtain the census value, and store it in SRAM.
2. The parallel computing method for a Census transform processor according to claim 1, characterized in that: The image stored in DDR is divided into a group and stored contiguously, with each group having a size of [missing information]. The image is divided into blocks, each block including the pixel data of the central region and eight surrounding regions. In step S1, the processor continuously reads the blocks to perform image Census transformation.
3. The parallel computing method for a Census transform processor according to claim 2, characterized in that: The SRAM is divided into an input SRAM ping-pong buffer and an output SRAM ping-pong buffer; the input SRAM ping-pong buffer includes inputbuffer0 and input buffer1, used to read blocks from DDR for the processor to calculate census values, and the size of inputbuffer0 and input buffer1 is equal to... The output SRAM ping-pong cache includes output buffer0 and output buffer1, used by the processor to store the census value table back to DDR after calculating the census value. The size of output buffer0 and output buffer1 is equal to... Total SRAM size .
4. The parallel computing method for a Census transform processor according to claim 3, characterized in that: The step S1, in which the processor continuously reads blocks to perform image Census transformation, is a pipelined arrangement of several sequentially executed Census transformation tasks. Each block Census transformation task first performs block loading, loading a block from DDR into the input SRAM ping-pong buffer each time. Then, it performs block computation, reading the block from the input SRAM ping-pong buffer, and storing the result in the output SRAM ping-pong buffer. Finally, it performs block storage, storing the result in the output SRAM ping-pong buffer back into DDR. The block computation time of this block Census transformation task masks the block loading time of subsequent block Census transformation tasks and the block storage time of earlier block Census transformation tasks.
5. The parallel computing method for a Census transform processor according to claim 4, characterized in that... The pipeline layout ensures that three Census transform tasks can work simultaneously at any given time. Specifically: The first block loads input buffer0; The first calculation result is stored in output buffer0, and the second result is loaded into input buffer1. The first block stores the data, the second block stores the calculation results in output buffer1, and the third block loads the data into input buffer0. The second block stores the results, the third block stores the calculation results in output buffer0, and the fourth block loads them into input buffer1. This process is repeated until the image undergoes a Census transformation.
6. A parallel computing method for a Census transform processor according to any one of claims 1 to 5, characterized in that: The processor is a DSP or a vector processor.
7. A parallel computing method for a Census transform processor according to any one of claims 1 to 5, characterized in that: Used for visual stereo matching or visual odometry.
Citation Information
Patent Citations
Method and circuitry for performing census transforms
US9905020B2
Binocular stereo matching method based on edge information
CN111833393A
Disparity map calculation method for high-resolution urban satellite stereo image
CN112435267A
