CROSS-REFERENCE TO RELATED APPLICATIONS 
     This application claims priority to Japanese Patent Application No. 2008-084156. The entire disclosure of Japanese Patent Application No. 2008-084156 is hereby incorporated herein by reference. 
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to an image processor, and more particularly, to an encoder in a predictive coding system. 
     2. Description of the Background Art 
       FIG. 13  is a block diagram showing a configuration of an encoder  101  in a predictive coding system. The encoder  101  includes a quantization unit  102 , a prediction unit  103 , and an encoding unit  104 . Data D 100  is inputted from a preceding processing block (not shown) to the quantization unit  102 . The quantization unit  102  quantizes the data D 100 , so as to output data D 101 . The data D 101  is inputted from the quantization unit  102  to the prediction unit  103 . Meanwhile, data which was previously processed has been inputted to the prediction unit  103  as prediction data D 102 . The prediction unit  103  outputs a difference value between the data D 101  and the prediction data D 102  as data D 103 . The data D 103  is inputted from the prediction unit  103  to the encoding unit  104 . The encoding unit  104  performs entropy coding on the data D 103 , so as to output coded data D 104 . 
     Microsoft Corporation has recently proposed HD Photo (or JPEG XR) as a still image file format that offers higher image quality than JPEG while requiring more simple circuit configuration and computation than JPEG 2000. 
       FIG. 14  is a block diagram showing a configuration of an encoder  201  for HD Photo. The encoder  201  includes a color conversion unit  202 , a pre-filter  203 , a frequency transform unit  204 , a quantization unit  205 , a prediction unit  206 , and an encoding unit  207 . 
     A pixel signal D 200  of RGB color space is inputted from an imaging element, such as a CCD or CMOS image sensor, to the color conversion unit  202 . The color conversion unit  202  converts the pixel signal D 200  into a pixel signal D 201  of, for example, YUV color space, and outputs the same. The pixel signal D 201  is inputted from the color conversion unit  202  to the pre-filter  203 . The pre-filter  203  performs prefiltering to reduce block artifacts on the pixel signal D 201 , and outputs a pixel signal D 202 . The pixel signal D 202  is inputted from the pre-filter  203  to the frequency transform unit  204 . The frequency transform unit  204  performs predetermined frequency transform (PCT: HD Photo Core Transform) on the pixel signal D 202 , and outputs data D 203  after frequency transform. In HD Photo, the data D 203  includes highpass, lowpass, and direct current components. 
     The data D 203  is inputted from the frequency transform unit  204  to the quantization unit  205 . The quantization unit  205  quantizes the data D 203 , so as to output data D 204 . The data D 204  is inputted from the quantization unit  205  to the prediction unit  206 . Meanwhile, data which was previously processed has been inputted to the prediction unit  206  as prediction data. The prediction unit  206  outputs a difference value between the data D 204  and the prediction data as data D 205 . The data D 205  is inputted from the prediction unit  206  to the encoding unit  207 . The encoding unit  207  performs entropy coding on the data D 205 , so as to output coded data D 206 . 
     The details of HD Photo are disclosed in, for example, “HD Photo—Photographic Still Image File Format”, [online], 7 Nov. 2006, Microsoft Corporation, [searched in the Internet on 10 Oct. 2007], &lt;URL: http://www.microsoft.com/whdc/xps/hdphotodpk.mspx&gt;. The details of JPEG XR are disclosed in, for example, “Coding of Still Pictures—JBIG JPEG”, [online], 19 Dec. 2007, ISO/IEC JTC 1/SC 29/WG1 N 4392, [searched in the Internet on 4 Mar. 2008], &lt;URL: http://www.itscj.ipsj.orjp/sc29/open/29view/29n9026t.doc&gt;. 
     In the encoders  101  and  201  shown in  FIGS. 13 and 14 , the values of data after prediction (data D 103  and D 205 ) inputted to the encoding units  104  and  207  are preferably as small as possible, in order that an amount of code of the coded data D 104  and D 206  outputted from the encoding units  104  and  207  is reduced. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide an image processor that reduces an amount of code of coded data, by making a value of data after prediction inputted to an encoding unit small. 
     According to an aspect of the present invention, an image processor includes a quantization unit receiving first data before quantization and outputting second data after quantization, a prediction unit obtaining a difference value between the second data and third data being prediction data and outputting the difference value as fourth data, and an encoding unit encoding the fourth data. The quantization unit includes a first processing unit dividing the first data by a quantization coefficient, so as to obtain fifth data including a fraction as a result of division and a second processing unit rounding up or rounding off the fraction such that a value of the fourth data becomes smaller based on comparison between the third data and the fifth data, so as to obtain the second data. 
     The second processing unit rounds up or rounds off the fraction such that the value of the fourth data becomes smaller based on comparison between the third and the fifth data. Consequently, since the value of the data to be encoded by the encoding unit becomes smaller, reduction of an amount of code of the data after encoding is achieved. 
     Preferably, in the image processor, the encoding unit includes a third processing unit splitting the fourth data into a first partial data in a first digit range on an upper side and a second partial data in a second digit range on a lower side, and a fourth processing unit encoding only the first partial data between the first and second partial data. The fraction is data of a specific digit and a lower digit in a third digit range equivalent to the second digit range in the fifth data. 
     Since the value of the first partial data to be encoded by the fourth processing unit becomes smaller, reduction of an amount of code of the data after encoding is achieved. Furthermore, only the first partial data on the upper side is encoded, rather than the whole fourth data, and effect of reduction of an amount of code is achieved by encoding this first partial data on the upper side. Thus effect of reduction of an amount of code is more prominent than when the whole fourth data is encoded. 
     Preferably in the image processor, the specific digit is set arbitrarily within a range of the most significant and lower digits in the third digit range. 
     One can set a specific digit for defining the fraction of the fifth data at an arbitrary digit within the range of the most significant and a lower digit in the third digit range. Setting the specific digit at an upper side enhances the effect of reduction of an amount of code, while setting at a lower side improves image quality. This allows setting in accordance with preferences of a user. 
     Preferably in the image processor, the first digit range is a Normal Bit in HD Photo, and the second digit range is a Flex Bit in HD Photo. 
     Reduction of an amount of code of the data after entropy coding is achieved with respect to a Normal Bit on which entropy coding is performed in HD Photo. 
     Thus an amount of code of coded data is reduced. 
     These and other objects, features, aspects and advantages of the present invention will become more apparent from the following detailed description of the present invention when taken in conjunction with the accompanying drawings. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  is a block diagram showing a configuration of an image processor according to a first preferred embodiment of the present invention. 
         FIG. 2  is a block diagram showing a configuration of a quantization unit shown in  FIG. 1 . 
         FIG. 3  shows data. 
         FIGS. 4A to 4F  illustrate processing of processing units shown in  FIG. 2 . 
         FIG. 5  is a block diagram showing a configuration of an image processor according to a second preferred embodiment of the present invention. 
         FIG. 6  is a block diagram showing a configuration of an encoding unit shown in  FIG. 5 . 
         FIG. 7  shows data. 
         FIG. 8  is a block diagram showing a configuration of a quantization unit shown in  FIG. 5 . 
         FIG. 9  shows data. 
         FIGS. 10A to 10F  illustrate a first example of processing of processing units and a digit-setting unit shown in  FIG. 8 . 
         FIGS. 11A to 11F  illustrate a second example of processing of processing units and a digit-setting unit shown in  FIG. 8 . 
         FIG. 12  is a block diagram showing a configuration of pre-filters and frequency transform units in an encoder for HD Photo. 
         FIG. 13  is a block diagram showing a configuration of an encoder in a predictive coding system. 
         FIG. 14  is a block diagram showing a configuration of an encoder for HD Photo. 
     
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Preferred embodiments of the present invention are described in detail below referring to the drawings. It should be noted that identical reference numerals throughout the drawings indicate identical or equivalent elements. 
     First Preferred Embodiment 
       FIG. 1  is a block diagram showing a configuration of an image processor  1 A according to a first preferred embodiment of the present invention. The image processor  1 A is applicable not only to an encoder in HD Photo, but also to a general encoder in a predictive coding system. 
     The image processor  1 A includes a quantization unit  2 , a prediction unit  3 , and an encoding unit  4 . Data D 1  before quantization is inputted from a preceding processing block (not shown. a frequency transform unit, for example) to the quantization unit  2 . The quantization unit  2  outputs data D 2  after quantization. The data D 2  is inputted from the quantization unit  2  to the prediction unit  3 . Meanwhile, data which was previously processed (data in the former process, for example) has been inputted to the prediction unit  3  as prediction data D 3 . The prediction unit  3  outputs a difference value between the data D 2  and the prediction data D 3  as data D 4 . Depending on a condition, the prediction unit  3  does not perform prediction. In such a case, data having a value “0” is employed as the prediction data D 3 . The data D 4  is inputted from the prediction unit  3  to the encoding unit  4 . The encoding unit  4  performs entropy coding on the data D 4 , so as to output coded data D 10 . 
       FIG. 2  is a block diagram showing a configuration of the quantization unit  2  in  FIG. 1 . The quantization unit  2  includes processing units  5  and  6 . The data D 1  is inputted to the processing unit  5 . The processing unit  5  divides the data D 1  by a quantization coefficient Q, so as to output data D 5  including a fraction as a result of division. The data D 5  is inputted from the processing unit  5  to the processing unit  6 . Meanwhile, the prediction data D 3  has been inputted to the processing unit  6 . The processing unit  6  compares the data D 5  with the data D 3 , and based on the comparison, rounds up or rounds off the fraction of data D 5  such that the value of the data D 4  becomes smaller, so as to output the data D 2 . 
       FIG. 3  shows the data D 5 . The data D 5  has an integer part P 1  and a fractional part P 2 . Let the bit width of the integer part P 1  be H, the bit width of the fractional part P 2  be G, and the least significant digit of the fractional part P 2  be the 0th digit. Then the most significant digit of the fractional part P 2  is the (G−1)th digit, the least significant digit of the integer part P 1  is the G-th digit, and the most significant digit of the integer part P 1  is the (H+G−1)th digit. For example, when the bit width H is 8 bits and the bit width G is 4 bits, the most significant digit of the fractional part P 2  is the 3rd digit, the least significant digit of the integer part P 1  is the 4th digit, and the most significant digit of the integer part P 1  is the 11th digit. 
       FIGS. 4A to 4F  illustrate processing of the processing units  5  and  6  shown in  FIG. 2 . In  FIGS. 4A to 4F , it is assumed that the bit width of the data D 1  is 8 bits and the value of the quantization coefficient Q is “8”, by way of example. 
     As shown in  FIG. 4A , the data D 1  having a value, for example, “10110101” is inputted to the processing unit  5 . 
     The processing unit  5  divides the data D 1  by “8”, so as to output the data D 5  including a fraction as a result of division. Specifically, as shown in  FIG. 4B , the data D 1  is shifted 3 bit positions to the right, and the data D 5  including the integer part P 1  having a value “00010110” and the fractional part P 2  having a value “101” is outputted. The fractional part P 2  is the fraction in the data D 5 . The data D 5  is inputted to the processing unit  6 . 
     The prediction data D 3  has been inputted to the processing unit  6 . 
     Here, it is assumed as a first case that the prediction data D 3  having a value, for example, “00001010” has been inputted to the processing unit  6 , as shown in  FIG. 4C . The processing unit  6  compares the data D 5  with the data D 3 . In this first case, the data D 5  is larger than the data D 3 . In such a case, the processing unit  6  outputs the D 2  data having a value “00010110” obtained by rounding off the fractional part P 2  of the data D 5 , as shown in  FIG. 4D . When the data D 5  is larger than the data D 3 , the value of the data D 2  approaches the value of the data D 3  by rounding off the fractional part P 2  of the data D 5 . Consequently, referring to  FIG. 1 , since the data D 4 , which is a difference value between the data D 2  and the data D 3 , becomes smaller, an amount of code of the coded data D 10  is reduced. 
     In contrast, it is assumed as a second case that the prediction data D 3  having a value, for example, “00111010” has been inputted to the processing unit  6 , as shown in  FIG. 4E . The processing unit  6  compares the data D 5  with the data D 3 . In this second case, the data D 5  is smaller than the data D 3 . In such a case, the processing unit  6  outputs the data D 2  having a value “00010111” obtained by rounding up the fractional part P 2  of the data D 5 , as shown in  FIG. 4F . When the data D 5  is smaller than the data D 3 , the value of the data D 2  approaches the value of the data D 3  by rounding up the fractional part P 2  of the data D 5 . Consequently, referring to  FIG. 1 , since the data D 4 , which is a difference value between the data D 2  and the data D 3 , becomes smaller, an amount of code of the coded data D 10  is reduced. 
     As described above, according to the image processor  1 A of the first preferred embodiment, the processing unit  6  rounds up or rounds off the fraction included in the data D 5  (fractional part P 2 ) such that the value of the data D 4  becomes smaller, based on the comparison between the data D 3  and D 5 . Consequently, since the value of the data D 4  to be encoded by the encoding unit  4  becomes smaller, reduction of an amount of code of the coded data D 10  is achieved. 
     Second Preferred Embodiment 
       FIG. 5  is a block diagram showing a configuration of an image processor  1 B according to a second preferred embodiment of the present invention. The image processor  1 B is applicable to an encoder whose target data of encoding includes a part to be encoded and a part not to be encoded, such as an encoder in HD Photo, for example. Coded data D 11  and data D 12  that is not encoded are outputted from the encoding unit  4 . The rest of the configuration is the same as in  FIG. 1 . 
       FIG. 6  is a block diagram showing a configuration of the encoding unit  4  shown in  FIG. 5 . The encoding unit  4  includes processing units  7  to  9 . The data D 4  is inputted from the prediction unit  3  shown in  FIG. 5  to the processing unit  7 . The processing unit  7  splits the data D 4  to output partial data D 4 U and D 4 L. The partial data D 4 U is inputted from the processing unit  7  to the processing unit  8 . The processing unit  8  performs entropy coding on the partial data D 4 U, so as to output the coded data D 11 . The partial data D 4 L is inputted from the processing unit  7  to the processing unit  9 . The processing unit  9  generates data D 12  to be outputted based on the data D 4 L. For example, the processing unit  9  rounds off lower (i.e. less significant) bits defined as Trim Bits in the data D 4 L, so as to generate the data D 12  to be outputted. 
       FIG. 7  shows the data D 4 . The processing unit  7  splits the data D 4  into the partial data D 4 U in a digit range R 1  on the upper (i.e. more significant) side and the partial data D 4 L in a digit range R 2  on the lower side. The digit ranges R 1  and R 2  are respectively equivalent to Normal Bits and Flex Bits in HD Photo. Let the bit width of the digit range R 1  be N, the bit width of the digit range R 2  (Model Bits) be M, and the least significant digit of the digit range R 2  be the 0th digit. Then the most significant digit of the digit range R 2  is the (M−1)th digit, the least significant digit of the digit range R 1  is the M-th digit, and the most significant digit of the digit range R 1  is the (N+M−1)th digit. In HD Photo, the bit width M is adaptively variable. 
       FIG. 8  is a block diagram showing a configuration of the quantization unit  2  shown in  FIG. 5 . The quantization unit  2  includes processing units  5  and  6  and a digit-setting unit  10 . The data D 1  is inputted to the processing unit  5 . The processing unit  5  divides the data D 1  by a quantization coefficient Q, so as to output data D 5  including a fraction as a result of division. The data D 5  is inputted from the processing unit  5  to the processing unit  6 . Meanwhile, the prediction data D 3  has been inputted to the processing unit  6 . The processing unit  6  compares the data D 5  with the data D 3 , and based on the comparison, rounds up or rounds off the fraction of the data D 5  such that the value of the data D 4  becomes smaller, so as to output the data D 2 . One can variably set a digit range in the data D 5  to be handled as a fraction, by data D 13  inputted from the digit-setting unit  10  to the processing unit  6 . 
       FIG. 9  shows the data D 5 . The data D 5  includes an integer part P 1  and a fractional part P 2 . The digit range R 3  on the lower side in the integer part P 1  is equivalent to the digit range R 2  (Flex Bit) shown in  FIG. 7 . Let the most significant digit of the fractional part P 2  be the digit A0th. Then the least significant digit of the digit range R 3  is the digit A 1 , and the most significant digit of the digit range R 3  is the digit AM. The digit-setting unit  10  select one digit from the digits A 0  to AM to be inputted to the processing unit  6  as data D 13 . When the digit A 1  is selected, for example, the range of the digit A 1  and the lower digits (the range indicated by oblique lines) is set as a fraction in the data D 5 . 
       FIGS. 10A to 10F  illustrate a first example of processing of the processing units  5  and  6  and the digit-setting unit  10  shown in  FIG. 8 . In  FIGS. 10A to 10F , it is assumed that the bit width of the data D 1  is 8 bits and the value of the quantization coefficient Q is “8”, by way of example. 
     As shown in  FIG. 10A , the data D 1  having a value, for example, “11111101” is inputted to the processing unit  5 . 
     The processing unit  5  divides the data D 1  by “8”, so as to output the data D 5  including a fraction as a result of division. Specifically, as shown in  FIG. 10B , the data D 1  is shifted 3 bit positions to the right, and the data D 5  including the integer part P 1  having a value “00011111” and the fractional part P 2  having a value “101” is outputted. The data D 5  is inputted to the processing unit  6 . Here, the data D 13  specifying the digit A 0  has been inputted from the digit-setting unit  10  to the processing unit  6 , and accordingly, the fractional part P 2  has been set as a fraction Z in the data D 5 . 
     The prediction data D 3  has been inputted to the processing unit  6 . 
     Here, it is assumed as a first case that the prediction data D 3  having a value, for example, “00001010” has been inputted to the processing unit  6 , as shown in  FIG. 10C . The processing unit  6  compares the data D 5  with the data D 3 . In this first case, the data D 5  is larger than the data D 3 . In such a case, the processing unit  6  outputs the data D 2  having a value “00011111” obtained by rounding off the fraction Z of the data D 5 , as shown in  FIG. 10D . When the data D 5  is larger than the data D 3 , the value of the data D 2  approaches the value of the data D 3  by rounding off the fraction Z of the data D 5 . Consequently, referring to  FIG. 5 , since the data D 4 , which is a difference value between the data D 2  and D 3 , becomes smaller, and referring to  FIG. 6 , since the partial data D 4 U to be encoded by the processing unit  8  also becomes smaller, an amount of code of the coded data D 11  is reduced. 
     In contrast, it is assumed as a second case that the prediction data D 3  having a value, for example, “00111010” has been inputted to the processing unit  6 , as shown in  FIG. 10E . The processing unit  6  compares the data D 5  with the data D 3 . In this second case, the data D 5  is smaller than the data D 3 . In such a case, the processing unit  6  outputs the data D 2  having a value “00100000” obtained by rounding up the fraction Z of the data D 5 , as shown in  FIG. 10F . When the data D 5  is smaller than the data D 3 , the value of the data D 2  approaches the value of the data D 3  by rounding up the fraction Z of the data D 5 . Consequently, referring to  FIG. 5 , since the data D 4 , which is a difference value between the data D 2  and D 3 , becomes smaller, and referring to  FIG. 6 , since the partial data D 4 U to be encoded by the processing unit  8  also becomes smaller, an amount of code of the coded data D 11  is reduced. 
       FIGS. 11A to 11F  illustrate a second example of processing of the processing units  5  and  6  and the digit-setting unit  10  shown in  FIG. 8 . In  FIGS. 11A to 11F , it is assumed that the bit width of the data D 1  is 8 bits and the value of the quantization coefficient Q is “8”, by way of example. 
     As shown in  FIG. 11A , the data D 1  having a value, for example, “11010111” is inputted to the processing unit  5 . 
     The processing unit  5  divides the data D 1  by “8”, so as to output the data D 5  including a fraction as a result of division. Specifically, as shown in  FIG. 1B , the data D 1  is shifted 3 bit positions to the right, and the data D 5  including the integer part P 1  having a value “00011010” and the fractional part P 2  having a value “111” is outputted. The data D 5  is inputted to the processing unit  6 . Here, the data D 13  specifying the digit AM has been inputted from the digit-setting unit  10  to the processing unit  6 , and accordingly, the fractional part P 2  and the lower 4 bits of the integer part P 1  have been set as a fraction Z in the data D 5 . 
     The prediction data D 3  has been inputted to the processing unit  6 . 
     Here, it is assumed as a first case that the prediction data D 3  having a value, for example, “00001010” has been inputted to the processing unit  6 , as shown in  FIG. 11C . The processing unit  6  compares the data D 5  with the data D 3 . In this first case, the data D 5  is larger than the data D 3 . In such a case, the processing unit  6  outputs the data D 2  having a value “00010000” obtained by rounding off the fraction Z of the data D 5 , as shown in  FIG. 11D . When the data D 5  is larger than the data D 3 , the value of the data D 2  approaches the value of the data D 3  by rounding off the fraction Z of the data D 5 . Consequently, referring to  FIG. 5 , since the data D 4 , which is a difference value between the data D 2  and D 3 , becomes smaller, and referring to  FIG. 6 , since the partial data D 4 U to be encoded by the processing unit  8  also becomes smaller, an amount of code of the coded data D 11  is reduced. 
     In contrast, it is assumed as a second case that the prediction data D 3  having a value, for example, “00111010” has been inputted to the processing unit  6 , as shown in  FIG. 11E . The processing unit  6  compares the data D 5  with the data D 3 . In this second case, the data D 5  is smaller than the data D 3 . In such a case, the processing unit  6  outputs the data D 2  having a value “00100000” obtained by rounding up the fraction Z of the data D 5 , as shown in  FIG. 11F . When the data D 5  is smaller than the data D 3 , the value of the data D 2  approaches the value of the data D 3  by rounding up the fraction Z of the data D 5 . Consequently, referring to  FIG. 5 , since the data D 4 , which is a difference value between the data D 2  and D 3 , becomes smaller, and referring to  FIG. 6 , since the partial data D 4 U to be encoded by the processing unit  8  also becomes smaller, an amount of code of the coded data D 11  is reduced. 
     As described above, according to the image processor  1 B of the second preferred embodiment, since the value of the partial data D 4 U to be encoded by the processing unit  8  becomes smaller, reduction of an amount of code of the coded data D 11  is achieved. Furthermore, only the partial data D 4 U on the upper side is encoded, rather than the whole data D 4 , and effect of reduction of an amount of code is achieved by encoding this partial data D 4 U on the upper side. Thus effect of reduction of an amount of code is more prominent than when the whole data D 4  is encoded. 
     Moreover, according to the image processor  1 B of the second preferred embodiment, one can set a specific digit for defining the fraction of the data D 5  at an arbitrary digit within the range of the most significant and lower digits A 0  to AM in the digit range R 3 , as shown in  FIG. 9 . Setting the specific digit at an upper side enhances the effect of reduction of an amount of code, while setting at a lower side improves image quality. This allows setting in accordance with preferences of a user. 
       FIG. 12  is a block diagram showing a configuration of pre-filters  51  and  52  and frequency transform units  53  and  54  in an encoder for HD Photo. As shown in  FIG. 12 , the encoder for HD Photo includes the pre-filter  51  and the frequency transform unit  53  of a first stage, and the pre-filter  52  and the frequency transform unit  54  of a second stage. 
     A pixel signal D 50  is inputted to the pre-filter  51 . The pre-filter  51  performs prefiltering on the pixel signal D 50  and outputs a pixel signal D 51  after prefiltering. The pixel signal D 51  is inputted to the frequency transform unit  53 . The frequency transform unit  53  performs frequency transform (PCT) on the pixel signal D 51 , and outputs data D 1 HP of highpass component and data D 52  of direct current component in the first stage. The data D 52  is inputted to the pre-filter  52 . The pre-filter  52  performs prefiltering on the data D 52  and outputs data D 53  after prefiltering. The data D 53  is inputted to the frequency transform unit  54 . The frequency transform unit  54  performs frequency transform (PCT) on the data D 53 , and outputs data D 1 LP of lowpass component and data D 1 DC of direct current component. 
     The data D 1 HP, D 1 LP, and D 1 DC outputted from the frequency transform units  53  and  54  are inputted to the quantization unit  2  as the data D 1  shown in  FIG. 5 . Similarly, the data D 4  inputted to the encoding unit  4  includes data of highpass, lowpass, and direct current components. 
     The present invention according to the second preferred embodiment is applicable to any of the highpass, lowpass, and direct current components in HD Photo. 
     While the invention has been described in detail, the foregoing description is in all aspects illustrative and not restrictive. It is understood that numerous other modifications and variations can be devised without departing from the scope of the invention.
An image processor includes a quantization unit receiving first data before quantization and outputting second data after quantization, a prediction unit obtaining a difference value between the second data and third data being prediction data and outputting the difference value as fourth data, and an encoding unit encoding the fourth data. The quantization unit includes a first processing unit dividing the first data by a quantization coefficient, so as to obtain fifth data including a fraction as a result of division and a second processing unit rounding up or rounding off the fraction such that a value of the fourth data becomes smaller based on comparison between the third data and the fifth data, so as to obtain the second data.