Abstract:
A distributed digital imaging processing system having a number of processing units and circular FIFO buffers connected together using data transforming streams. Processing units read data from buffers using a transforming read streams. These read streams reorder the buffer data to form patches representing neighborhood pixels and may provide the same data multiple times. After processing a patch, a processing unit writes the resultant patch into a buffer using a transforming write stream which reorders the data into the storage format of the buffer. Several buffers can feed a single processor and one processor can feed several buffers. All the details of each data stream (buffer, current buffer location, patch size, access pattern) are stored in a table entry, along with a pointer to the data stream that it must follow in the buffer to avoid the hazards of reading and writing data out of order. In the case where a buffer has multiple read streams, requiring read streams to maintain a particular order reduces the work necessary to check for either a write or read hazard to comparing the location of a stream with it&#39;s leader. A single state machine computes from each table entry all addresses for all data transfers between the processors and buffers, and updates the table entry after each cycle. Since table entries define the streams which link processors to memory, communication paths between processors is completely under software control.

Description:
BACKGROUND OF THE INVENTION 
     This invention is a method for controlling the delivery of data to multiple hardware processing units, which perform document image processing. The processing units (PU&#39;s) communicate with each other by accessing a shared memory via streams. Each memory access transfers a two dimensional patch of data. Avoidance of shared memory hazards is simplified by the stream ring linked list data structure. 
     In a typical digital image processing system, a main memory originally contains the source image, and several individual processing units may be needed to process the data in discrete steps before the output image can be printed. In the typical case each processor would have its own process, such as image enhancement, color space transformation, color correction, etc. It would calculate the location of the data in memory, access the data, process the data and then calculate the location in memory that the data must be loaded back into. The processors would also have to prevent memory hazards, such as not allowing data to be fetched by a next processing unit before it has been written by the previous one. Each processing unit is burdened by the computational overhead, and the complexity of the processors is increased. 
     SUMMARY OF THE INVENTION 
     In this system, a number of sections of main memory are separated into circular image FIFO buffers, each buffer is associated with one write stream into the buffer and one or more read streams out of the buffer. Each stream is either a write stream or a read stream and provides a sequence of data in the form of small blocks called patches to or from a processing unit from or to a buffer. A single stream control unit (SCU) is used to control all streams. A processor may utilize one or more read streams, and send data out using one or more write streams. A buffer may provide data to one or more processors, but the system is normally limited to having only one stream of data being written into each buffer from one processor. Conceptually, the SCU contains a table of stream descriptions, one entry per stream. Each entry contains all the static and dynamic state associated with a particular stream. This descriptor specifies the patch size and shape, the data source and destination, and a pointer to the location in the buffer where the current data transfer is taking place. The SCU also contains a state machine for executing a process based on this data. As each data transfer is processed, the descriptor line is updated. 
     To avoid hazards, the SCU has to ensure that, for example, old data is not over-written by new data before it is used. This is accomplished by providing the parameter line of each stream with a pointer identifying the parameter line of the stream that it must follow. For example, if a first PU is loading data into a buffer, and then that data is being sent to a second PU, the reader must not access data until the writer has put the current data into the buffer. Likewise, the writer must not load new data over old data in the circular FIFO buffer that has not been used yet. To prevent this, the write point is forced to follow the read point and the read point is forced to follow the write point. To prevent one from overtaking the other, each of the two stream parameter lines contain pointers to the other line and either stream will be stalled if stepping forward would overtake the other. For the case where there are several readers of a single buffer, each is assigned a relative position, each parameter line is provided with a pointer to the reader or writer that is leading it, and a stream will be stalled if necessary to prevent any one from overtaking any other. 
     This system simplifies the process by having a central stream control unit handle all of the overhead, which results in two advantages. The first is a saving of time. The SCU is fast enough to process all of the memory computations in real time, so that the pipelined PU&#39;s can process data without interruption. They simply request a data transfer and will be allowed to receive or send. The second is a saving in hardware. The single SCU needs only one copy of the hardware that otherwise would have to be provided in all PU&#39;s. Because of these advantages, the SCU and PU&#39;s can be constructed on a single device. 
     An additional advantage of this arrangement is that since each control parameter is in the form of a table entry, the entire system is under software control, so that every aspect of the process, such as patch size and data path, can be changed in real time. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is an overall block diagram of the invention with Stream Control connections. 
     FIG. 2 is a conceptual diagram of PU&#39;s and Stream Buffers for a given operation. 
     FIG. 3 is an example of a stream ring. 
     FIG. 4 shows and example of reordering of a write patch. 
     FIG. 5 shows overlapped stepping, reordering and pixel replication for a read patch. 
     FIG. 6 is an example of edge pixel fill in for a read patch on the edge of the buffer. 
     FIG. 7 shows a more typical example of a read patch scanning sequence with only vertical overlaps an extra patches between scans to reinitialize PU state. 
     FIG. 8 is an example of a write patch edge overlap. 
     FIG. 9 shows a read patch wrapping around the end of a circular buffer. 
     FIG. 10 shows a Queue Check fail condition. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     Document image processing typically requires a sequence of steps in which different algorithms are used to ultimately produce the final document output. It is advantageous to divide up the processing steps among multiple hardware processing units, each of which has a specific processing task. Typically the processing units form a directed acyclic graph with multiple branches that fork and join. Each unit reads in, processes, and then outputs small chunks of two-dimensional data. The small chunks of data are called patches, and different processing units can use different size patches. Due to the two dimensional nature of the image processing, which often requires multiple image lines to be stored to generate vertical context, the amount of memory required to store data from intermediate processing steps is too large to exist on the same chip as the hardware processing units. Therefore the data is stored in an external memory which is shared by the hardware processing units. 
     Using shared external memory allows centralized control of that memory. Centralized control of the external memory allows centralized control of memory hazards as well as centralized format conversion. A memory hazard occurs when a processing unit tries to read data that has not yet been written or to overwrite data that some other processing unit has not yet to read. Format conversion is required to convert buffer data to/from patches. The hardware unit which controls memory hazards and format conversion is called the Stream Control Unit. 
     The Stream Control Unit provides a mechanism for hazard and format control through the stream facility, which is analogous to the stream or pipe facility in UNIX. The streams in this image processing system have the extra functionality of converting buffer data to/from two dimensional patch data and are referred to as transformation streams. 
     Employing this model makes it possible for image processing units to be much simpler. Units can read and write data without knowing what memory locations they are accessing, what part of the image they are working on, or anything about the other units involved in the processing tree. The Stream Control Unit&#39;s stream facility keeps track of memory addresses and all shared data dependencies between the various processing units in a manner that is invisible to the processing units. 
     Shared data is located in sections of memory called stream buffers. Although an entire image must be processed, typically only a small portion of the image is stored at any one time. That portion is stored in a stream buffer. As time goes on, the portion of the image which is stored in the stream buffer changes; the stream buffer acts as a circular image buffer or image FIFO. For ease of address calculation, every pixel in an image maps to a particular location in a stream buffer. Transforming write streams move data from PU&#39;s to stream buffers and transforming read streams move data from buffers to PU&#39;s. Each processing unit accesses stream buffer data by sending a stream request to the Stream Control Unit, which is simply a request to access the next piece of data. The Stream Control Unit keeps track of all outstanding processing unit stream requests, and checks each request to insure that it can be executed without violating shared data synchronization. When the Stream Control Unit finds that a request can be fulfilled, it issues the corresponding memory request(s) to the memory system. Using a programmable descriptor table in this shared unit allows the imaging pipeline to be easily reconfigured through software. In addition, it allows the various processing tasks to be prioritized as needed. 
     FIG. 1 shows an example of the overall system with the Stream Control Unit connected with five processing units (PU&#39;s). Typically, there would be many more processing units. The processing units inform the Stream Control Unit that they are ready to perform a memory transfer by asserting their stream request lines. There is one stream request line for each stream processed by a processing unit. A processing unit can have any number of stream request lines, which can all access the same buffer or any mix of different buffers. the controller inspects the corresponding line in the table to determine if the request can be granted, calculates the addresses required to access the buffer and supplies them to the memory system which executes the specified patch transfer on the data bus. The data flows between the memory system and the processing unit without further Stream Control Unit involvement. 
     Each stream request signals a need to access a portion of a stream buffer. The portion accessed is called a patch. The patch can be thought of as a moving window looking into a small portion of the stream buffer. A processing unit can read or write the piece of stream buffer data which is in the current patch. Upon issuing a memory request for a stream, the Stream Control Unit moves the stream&#39;s patch position to the next location in the stream buffer that the stream will need to access. The size of each patch is set to match the requirements of each processing unit. Different patch sizes for the different streams accessing the same stream buffer may be mixed freely; there are no restrictions. The patch size stays constant as the patch position moves through the buffer. A patch is defined in terms of a rectangular array of pixels. 
     A stream buffer is circular in the sense that a patch cycles through it many times. A patch starts at the beginning of the stream buffer, then traverses through the entire buffer, and one step at a time. Upon completing its traverse, it jumps back to the beginning position in the stream buffer for its next cycle through the buffer 
     Every time a processing unit is granted access to a patch in a stream buffer, the Stream Control Unit changes the location of the patch associated with the stream request. The patch is moved from the location of the data the processing unit is currently being allowed to access to the location that the processing unit will access with its next request. Thus the patch is always positioned where the processing unit&#39;s next request will be located. This allows a processing unit to read or write a whole stream buffer, one contiguous piece at a time. The Stream Control Unit keeps track of the location of each patch in the buffer. It uses this information to decide when a stream request is allowed to proceed without generating a memory hazard. A read stream waits until the data in its patch&#39;s current location is available (has been written). A write stream waits until the data in its patch&#39;s current location is empty (has been read by every stream that requires that data.) If a stream request cannot proceed, the Stream Control Unit stores that request until it detects that the request can be honored. A stream may have only one request outstanding at a time. 
     FIG. 2 shows an example of how the five processing units from FIG. 1 might be connected (via the Stream Control Unit) to form an imaging pipeline for a digital copier. A directed line that points to a stream buffer represents a write stream and a directed line that points away from a stream buffer represents a read stream. The stream buffers store some intermediate portion of the image being processed. They act as a conduit through which processing units are virtually connected. 
     Pixels originate from the scanner, flow through the processing units, and are forwarded to the printer. Most stream buffers in this example have only one write stream and one read stream. The exception is Stream Buffer  0  which has two read streams going to PU 1  and PU 2 . These two processing units each get a copy of the image written by PU 0 . Processing units which have multiple read streams combine images (e.g. pixels &amp; tags). Processing units which have multiple write streams produce several versions of the same image (e.g. grey scale and full color). 
     Each stream is associated with only one stream buffer. The stream descriptors in the SCU are set up so that all the streams connected to a particular stream buffer are ordered and doubly-linked to form a stream ring. A stream ring consists of one write stream and one or more read streams grouped together in an arrangement analogous to a write pointer and one or more read pointers of a FIFO. Each stream has a single leader (which it must be behind in the stream buffer) and a single follower (which it must precede in the stream buffer.) In the case of multiple read streams, it is not desirable to have all read streams share the write stream as their leader because the write stream would then have to have all the read streams not only as its followers, but also as its leaders, so that multiple tests would be required to see if the write stream patch could move without generating a memory hazard. The write stream is special and is called the first stream—it accesses the buffer first and gets the chain started. 
     FIG. 3 shows an example stream ring with one write stream and three read streams. The directed lines represent the linked list pointers and the rectangles represent the stream data structures. Only the link to the leader is required for normal operation. The link to the follower provides a way to accelerate access to streams which have been blocked by the current stream. 
     The stream ring simplifies the process of preventing memory hazards. Before a stream accesses a particular location in a stream buffer, the stream&#39;s leader must access that location. If the stream&#39;s leader has already accessed the image area in the stream&#39;s patch and will not access any of that area again until its next cycle through the stream buffer, then the stream can access memory without generating a memory hazard. Thus the only test required to determine if it is safe for a stream to proceed is to compare the position of the stream&#39;s patch to the position of its leader&#39;s patch. The process of determining if a stream can access a stream buffer location is called Queue Check. 
     Depending on the processing unit&#39;s function, a patch may have context, i.e., a patch position for a given stream may have some overlap with another patch that occurs later for the same stream. This is required if the function needs to have access to the same pixels more than once, as is the case for say a 3 by 3 filter. This must be taken into account when performing Queue Check. This means that Queue Check must not only insure that the leader stream&#39;s patch has traversed the area occupied by the current stream&#39;s patch, but must also make sure that the leader stream&#39;s patch will not occupy any part of that area again until its next cycle through the stream buffer. In some cases, where the leaders patch movement is more complex, two positions could be provided. One is for use by the follower stream and describes the last pixel in the buffer which is free to be used. The second location is for internal use of the stream itself and describes the actual position of the patch. 
     Some memory systems allow out of order execution of memory access commands in order to improve efficiency. If this is the case, then Queue Check must compare the position of the current stream&#39;s patch to the previous position of its leader&#39;s patch. Only if it can be reliably determined that the leader stream&#39;s last memory access. has already been executed can the leader stream&#39;s current patch position be used by Queue Check. 
     FIG. 4 shows the movement of a 2×2 write patch through a buffer. Typically, write patches do not overlap in either x or y and step through the buffer with a step size equal to their width. The figure shows the reordering of pixels which occurs when pixels in the patch arrive at the buffer. 
     FIG. 5 shows the movement of a read patch through a buffer and how pixels are reordered into the patch from the buffer. This also shows the same pixels being sent in multiple patches for the stream in the same pass. Note that for read stream, the patch step size does not necessarily equal the patch size. 
     FIG. 6 shows a read patch near the edge of a buffer where 3 of the pixels have been filled in by copying corresponding edge pixels. The SCU provides special controls to the memory system describing how to fill in missing pixels at all four edges of the image. The combination of reordering buffer pixels into patches and automatically providing missing pixels greatly simplifies the design of PU&#39;s. 
     FIG. 7 shows the movement of a read patch through a buffer showing more typical example in which there is no overlap in the x direction and only pixels which overlap in the y direction are sent multiple times. This also shows an extra patch (C) generated using edge replication as the fill function which is sent to the PU to reinitialize internal state prior to beginning the next scan line. 
     FIG. 8 shows a write patch at the edge of a image where only two of the four pixels of the patch data is reordered into the buffer. The other two pixels in the patch are ignored. 
     FIG. 9 shows ther reordering which occurs as a read patch wraps around at the end of a buffer. The SCU is programmed with the size of the overall image and can tell the memory system to replicate, or set to a fixed value, top and bottom pixels in the image if the patch is currently overlapping the first or last scan line. 
     A graphical illustration of the application of Queue Check is shown in FIG. 10 for a stream ring with just two streams. The patches for a write stream and a read stream are shown. Because there are only two streams, the write stream is the read stream&#39;s leader and the read stream is the write stream&#39;s leader. The patches are located where the next data accesses will occur. Executing Queue Check for the write stream will fail since pixel  9  has not yet been read. 
     While the invention has been described with reference to a specific embodiment, it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted for elements thereof without departing from the true spirit and scope of the invention. In addition, many modifications may be made without departing from the essential teachings of the invention.