This application is based on and claims priority under 35 USC 119 from Japanese Patent Application No. 2014-191520 filed Sep. 19, 2014.
(i) Technical Field
The present invention relates to a data processing apparatus, a data processing method, and a non-transitory computer readable medium.
(ii) Related Art
There are data processing apparatuses that perform data processing, for example, image processing, on data. Some apparatuses related to data processing such as image processing have hitherto been proposed.
According to an aspect of the invention, there is provided a data processing apparatus including a determination unit and a selection unit. The determination unit determines whether or not it is necessary to regulate an amount of data in accordance with a condition related to a data storage margin. The selection unit selects data processing for regulating from among plural data processing candidates by comparing amounts of data resulting from the plural data processing candidates with one another in a case where it is necessary to regulate an amount of data.
An exemplary embodiment of the present invention will be described in detail based on the following figures, wherein:
The data processing apparatus 100 illustrated in
Specific examples of data processing performed by the data processing apparatus 100 illustrated in
As for image processing performed on processing-target image data (e.g., data of an intermediate language), the data processing apparatus 100 illustrated in
A raster/vector selection unit 20 selects raster image processing or vector image processing as processing to be used in the image processing performed on image data obtained from the loading buffer 10.
A memory margin determination unit 30 determines whether or not it is necessary to regulate an amount of data by referring to a margin (hereinafter, also referred to as a memory margin) of a memory in which image data that has undergone the image processing is stored.
A memory margin calculation unit 40 calculates a memory margin on the basis of memory information regarding the memory in which image data that has undergone the image processing is stored.
In the case where raster image processing is applied to image data, a rasterization unit 50 rasterizes the image data into raster data. A raster image processing unit 60 performs raster image processing on the raster data, which has been rasterized from the image data, and obtains resulting image data. The resulting image data obtained by the raster image processing unit 60 is then sent to the storage buffer 90 via a selector 80.
In the case where vector image processing is applied to image data, a vector image processing unit 70 performs vector image processing on the image data and obtains resulting image data. Specific examples of the vector image processing performed by the vector image processing unit 70 include processing for converting data in accordance with a predetermined rule, for example, data processing based on the Joint Photographic Experts Group (JPEG) standard, the Huffman coding, or the run-length vector. The resulting image data obtained by the vector image processing unit 70 is then sent to the storage buffer 90 via the selector 80.
Image data is merely one specific example that may be suitably processed by the data processing apparatus 100 illustrated in
The data processing apparatus 100 illustrated in
For example, functions of the data processing apparatus 100 illustrated in
The overview of the data processing apparatus 100 illustrated in
In the raster image processing (A1), image data is rasterized into raster data. For example, as in a specific example illustrated in (A1), image data is rasterized into raster data constituted by multiple pixel data items arranged in the order of “AAAAABBB”.
In the raster image processing (A1), image processing is performed on the multiple pixel data items that constitute the raster data on a pixel-data-item basis. For example, in the specific example of the raster data illustrated in (A1), image processing is performed for eight pixels.
In contrast, in the vector image processing (A2), image data is not rasterized into raster data. Instead, vector data including a run data item of “5” which corresponds to a pixel data item of “A” and a run data item of “3” which corresponds to a pixel data item of “B” is processed in a specific example illustrated in (A2), for example. A run data item indicates a length of a run of a pixel data item (i.e., a run length). For example, the specific example of the vector data illustrated in (A2) indicates that the image data item of “A” is consecutively arranged for five pixels and the image data item of “B” is consecutively arranged for three pixels. That is, the vector data of (A2) and the raster data of (A1) correspond to identical image data.
In the vector image processing (A2), image processing is performed on each of the pixel data items that constitute the vector data and the results of the image processing are utilized as many times as the run lengths indicated by the run data items for the pixel data items. For example, in the specific example of the vector data illustrated in (A2), image processing is performed for two pixels, that is, the pixel data items of “A” and “B”. The result obtained through the image processing on the pixel data item of “A” is copied for five pixels and the result obtained through the image processing on the pixel data item of “B” is copied for three pixels.
As described above, in the specific example illustrated in
In the raster image processing (B1), image data is rasterized into raster data. For example, as in a specific example illustrated in (B1), image data is rasterized into raster data constituted by multiple pixel data items arranged in the order of “ABCDEFGH”. For example, when an amount of data for each pixel data item is equal to 1 byte, an amount of data for the raster data is equal to 8 bytes in the specific example illustrated in (B1).
In contrast, in the vector image processing (B2), vector data constituted by each pixel data item and its corresponding run data item is used. For example, as in a specific example illustrated in (B2), vector data constituted by multiple pixel data items arranged in the order of “ABCDEFGH” and run data items each corresponding to one of the pixel data items is processed. The vector data of (B2) and the raster data of (B1) correspond to identical image data. For example, when an amount of data for one pixel data item is equal to 1 byte and an amount of data for one run data item is equal to 2 bytes, an amount of data for the vector data is equal to 24 bytes in the specific example illustrated in (B2).
In the specific example illustrated in
As described above, the vector image processing may be superior to the raster image processing in terms of processing performance (i.e., processing speed) but may increase the amount of data in some cases.
Accordingly, the data processing apparatus 100 illustrated in
If the vector image processing is selected in the processing in units of lines, the entire image data that constitutes one line is converted into vector data (i.e., pixel data items and run data items) and the vector image processing is performed on the vector data. If the raster image processing is selected in the processing in units of lines, the entire image data that constitutes one line is rasterized into raster data and the raster image processing is performed on the raster data. In the specific example illustrated in
In the specific example illustrated in
A storage capacity of the memory (i.e., a memory capacity) is set equal to an amount of image data for one image, for example. Specifically, the memory capacity is set equal to a capacity that enables storage of data obtained if raster image processing were performed on the entire image data.
Image processing is performed on image data sequentially from the first line to the last line. For example, in the specific example illustrated in
The amount of accumulated data is an amount of data that has been subjected to image processing and that is stored in the memory. That is, the amount of accumulated data is an amount of resulting data of image processing performed on the processed lines in the image data. An allowable memory capacity is a capacity available for processing up to the line being processed and is equal to an amount of data obtained if raster image processing were performed on all the processed lines, that is, an amount of data obtained if rasterization were performed.
Specifically, let “LD” denote an amount of data obtained when image data of one line is rasterized into raster data. The allowable memory capacity after image processing has been finished up to the line being processed is calculated by multiplying the “line-being-processed No.” by “LD” (the “line-being-processed No.”×the “LD”).
As described in detail later, the data processing apparatus 100 illustrated in
Referring back to
Depending on the results of determinations performed regarding the memory margin in S402 and S403, one of steps S404, S405, and S406 is selected. If the memory margin is less than or equal to the first threshold (Margin≦β×LD), the processing in units of lines is performed on the line being processed, that is, the line indicated by the “line-being-processed No.” (S406).
In the processing in units of lines, the raster/vector selection unit 20 calculates an amount of vector data (VecD) obtained if vector image processing were performed on the entire data of the line being processed and an amount of raster data (RasD) obtained if raster image processing were performed on the entire data of the line (S601).
Then, the raster/vector selection unit 20 compares the amount of vector data (VecD) with the amount of raster data (RasD) (S602), and selects one of the vector image processing and the raster image processing that produces the smaller amount of data. Specifically, if the amount of vector data (VecD) is smaller than the amount of raster data (RasD), the vector image processing is selected, and the vector image processing unit 70 performs vector image processing on the line being processed (S603). If the amount of raster data (RasD) is smaller than the amount of vector data (VecD), the raster image processing is selected, and the raster image processing unit 60 performs raster image processing (S605) after the rasterization unit 50 rasterizes the line being processed into raster data (S604). If the amount of raster data (RasD) is equal to the amount of vector data (VecD), it is desirable to select vector image processing; however, raster image processing may be selected.
Referring back to
Then, the data processing apparatus 100 determines whether the image processing has been finished for all lines of the image data (S411). If the image processing has not been finished for all lines (NO in S411), the data processing apparatus 100 updates the “object-being-processed No.” and the “memory margin” to prepare for image processing for the next line (S412). The data processing apparatus 100 further updates the “line-being-processed No.” (S413). If the image processing has been finished for all lines of the image data (YES in S411), the image processing for the image data is terminated.
If it is determined that the memory margin is greater than the first threshold (Margin>β×LD) and is less than or equal to the second threshold (Margin≦α×LD) in the determinations performed regarding the memory margin in S402 and S403, the processing in units of objects is performed (S405).
In the processing in units of objects, the raster/vector selection unit 20 calculates an amount of vector data (VecD) obtained if vector image processing were performed on the entire data of the object being processed and an amount of raster data (RasD) obtained if raster image processing were performed on the entire data of the object (S701).
Then, the raster/vector selection unit 20 compares the amount of vector data (VecD) with the amount of raster data (RasD) (S702), and selects one of the vector image processing and the raster image processing that produces the smaller amount of data. Specifically, if the amount of vector data (VecD) is smaller than the amount of raster data (RasD), the vector image processing is selected, and the vector image processing unit 70 performs the vector image processing on the object being processed (S703). If the amount of raster data (RasD) is smaller than the amount of vector data (VecD), the raster image processing is selected, and the raster image processing unit 60 performs raster image processing (S705) after the rasterization unit 50 rasterizes data of the object being processed into raster data (S704). If the amount of raster data (RasD) is equal to the amount of vector data (VecD), it is desirable to select the vector image processing; however, the raster image processing may be selected.
Referring back to
Then, the data processing apparatus 100 determines whether or not the end of the line indicated by the “line-being-processed No.” which indicates the target being processed has been reached (S409). If the end of the line has not been reached (NO in S409), the “object-being-processed No.” and the “memory margin” are updated to prepare for image processing for the next object in the line (S410). If the end of the line has been reached (YES in S409), it is determined whether or not image processing has been finished for all lines of the image data (S411).
If it is determined that the memory margin is greater than the first threshold (Margin>β×LD) and is greater than the second threshold (Margin>α×LD) in the determinations performed regarding the memory margin in S402 and S403, it is determined that the amount of data need not be regulated. Thus, the vector image processing unit 70 performs the vector image processing as the image processing (S404). That is, if the memory margin is greater than the second threshold (Margin>α×LD), the processing performance (e.g., the processing speed) is prioritized over the amount of data, and thus the vector image processing is selected.
After the processing in S404 has been finished, that is, the vector image processing has been finished for the object indicated by the “object-being-processed No.” which indicates the target being processed, the data processing apparatus 100 calculates the amount of accumulated data (S407). Specifically, the amount of data (ObjD) for one object obtained as a result of the vector image processing performed in S404 is added to the amount of accumulated data (SumD) that has been obtained prior to the processing in S404. In this way, the amount of accumulated data (SumD) is updated.
Then, the data processing apparatus 100 determines whether or not the end of the line indicated by the “line-being-processed No.” which indicates the target being processed has been reached (S409). If the end of the line has not been reached (NO in S409), the data processing apparatus 100 updates the “object-being-processed No.” and the “memory margin” to prepare for image processing for the next object within the line (S410). If the end of the line has been reached (YES in S409), it is determined whether or not image processing has been finished for all lines of the image data (S411).
After the image processing has been finished for all lines of the image data (YES in S411) through the process described above, the image processing on the image data ends.
A first comparative example illustrated in
A second comparative example illustrated in
It is assumed that a run length (i.e., a length of a sequence of pixel data items indicated by a run data item) of vector data in the vector image processing 1 is equal to 300 and the number of vector data items is 1. It is also assumed that a run length of vector data in the vector image processing 2 is equal to 2 and the number of vector data items is 350.
It is further assumed that an amount of data for each pixel data item that constitutes the vector data is equal to 1 byte and an amount of data for each run data item is equal to 2 bytes. That is, an amount of data for one vector data item is equal to 3 bytes. It is also assumed that the processing time taken for image processing on one vector data item is equal to 1 clock (clk). In this case, the amount of data obtained from the vector image processing 1 on the area 1 is equal to 3 bytes and the processing time is equal to 1 clock (clk). The amount of data obtained from the vector image processing 2 on the area 2 is equal to 1050 bytes and the processing time is equal to 350 clocks (clk).
Accordingly, the amount of data obtained for the entire image data in the second comparative example illustrated in
In contrast, the exemplary embodiment illustrated in
It is assumed that a run length of vector data in the vector image processing 1 is equal to 300 and the number of vector data items is 1. It is also assumed that a run length of vector data in the vector image processing 2 is equal to 2 and the number of vector data items is 250.
It is further assumed that an amount of data for each pixel data item that constitutes the vector data is equal to 1 byte and an amount of data for each run data item is equal to 2 bytes. That is, an amount of data for one vector data item is equal to 3 bytes. It is also assumed that the processing time taken for image processing on one vector data item is equal to 1 clock (clk). In this case, the amount of data obtained from the vector image processing 1 on the area 1 is equal to 3 bytes and the processing time is equal to 1 clock (clk). The amount of data obtained from the vector image processing 2 on the area 2 is equal to 750 bytes and the processing time is equal to 250 clocks (clk). Suppose that the amount of data of each pixel that constitutes the raster data is equal to 1 byte and the processing time taken for each pixel of raster data is equal to 1 clock (clk). The amount of data obtained in raster image processing on the area 3 is equal to 200 bytes and the processing time is equal to 200 clocks (clk).
Accordingly, the amount of data obtained for the entire image data in the exemplary embodiment illustrated in
As described above, the data processing apparatus 100 illustrated in
While the exemplary embodiment of the present invention has been described above, the above-described exemplary embodiment is merely illustrative in all respects and does not limit the scope of the present invention. The present invention encompasses various modifications made within the scope not departing from the spirit thereof.
The foregoing description of the exemplary embodiment of the present invention has been provided for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise forms disclosed. Obviously, many modifications and variations will be apparent to practitioners skilled in the art. The embodiment was chosen and described in order to best explain the principles of the invention and its practical applications, thereby enabling others skilled in the art to understand the invention for various embodiments and with the various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims and their equivalents.
Number | Date | Country | Kind |
---|---|---|---|
2014-191520 | Sep 2014 | JP | national |