Image encoding device and image encoding method
Patent Information
- Application Number
- JP2024517319
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Filing Date
- 2024-10-23
- Publication Date
- 2025-01-15
AI Technical Summary
Conventional image encoding methods often result in image quality deterioration due to quantization errors, which can lead to increased code length and memory usage, causing transmission delays and increased memory requirements.
An image encoding device that acquires feature amounts for each image component, determines a target code amount based on these features, and performs frequency conversion and quantization to adjust the code amount, thereby reducing image quality degradation.
The solution effectively suppresses image quality deterioration by adjusting the code amount according to the feature amounts of each component, reducing memory requirements and transmission delays while maintaining high image quality.
Abstract
Description
Image encoding device and image encoding method
[0001] The present disclosure relates to an image encoding device and an image encoding method.
[0002] Patent Document 1 discloses a method for determining a quantization step and an encoding method for each group so that the code length of a block including multiple groups does not exceed a predetermined value, and for performing encoding processing based on the determined quantization step and encoding method to generate encoded data. Patent Document 2 discloses a method for compressing image data using either a first compression algorithm with a fixed scale factor or a second compression algorithm with an adjustable scale factor, and for determining whether the code amount is within a predetermined range.
[0003] Patent No. 6502739 Patent No. 4631629
[0004] Although the conventional techniques described in Patent Documents 1 and 2 control the code amount, there are cases where image quality is degraded.
[0005] The present disclosure provides an image coding device and an image coding method that can suppress deterioration in image quality.
[0006] An image encoding device according to one aspect of the present disclosure includes: a feature acquirer that acquires, for each of a plurality of components constituting a pixel of an image, a feature of data of the component in a block to be processed among a plurality of blocks of the image; a target code length determiner that determines, for each of the plurality of components, a target code length for the data of the component in accordance with the feature of the data of the component; a frequency converter that performs a frequency transform on the data of the component in accordance with the feature of the data of the component; a quantization processor that quantizes, for each of the plurality of components, the data of the component after frequency transform in accordance with the target code length for the data of the component; and an encoder that encodes, for each of the plurality of components, the data of the component after quantization.
[0007] In addition, an image encoding method according to one aspect of the present disclosure includes the steps of: for each of a plurality of components constituting a pixel of an image, acquiring a feature of the data of the component in a block to be processed among a plurality of blocks of the image; for each of the plurality of components, determining a target code size of the data of the component according to the feature of the data of the component; for each of the plurality of components, performing a frequency transform on the data of the component; for each of the plurality of components, quantizing the data of the component after frequency transform according to the target code size of the data of the component; and for each of the plurality of components, encoding the data of the component after quantization.
[0008] An image coding device and an image coding method according to an aspect of the present disclosure can suppress deterioration in image quality.
[0009] FIG. 1 is a block diagram showing the configuration of an image coding device in a reference example. FIG. 2 is a flowchart showing the operation of the image coding device in a reference example. FIG. 3 is a diagram showing a standard quantization table used for luminance data. FIG. 4 is a diagram showing a standard quantization table used for chrominance data. FIG. 5 is a conceptual diagram showing an example of compression of luminance data and chrominance data in a reference example. FIG. 6 is a conceptual diagram showing mosquito noise caused by quantization error. FIG. 1 is a block diagram showing the configuration of an image coding device in an embodiment. FIG. 1 is a flowchart showing the operation of an image coding device in an embodiment. FIG. 2 is a conceptual diagram showing an example of calculation of a feature amount of luminance data. FIG. 3 is a conceptual diagram showing an example of calculation of a feature amount of chrominance data. FIG. 4 is a flowchart showing the first method of determining a scale factor. FIG. 5 is a conceptual diagram showing the second method of determining a scale factor. FIG. 6 is a flowchart showing the second method of determining a scale factor. FIG. 7 is a conceptual diagram showing the third method of determining a scale factor. FIG. 7 is a flowchart showing the third method of determining a scale factor. FIG. 8 is a conceptual diagram showing the fourth method of determining a scale factor. FIG. 8 is a flowchart showing the fourth method of determining a scale factor. FIG. 9 is a conceptual diagram showing the fifth method of determining a scale factor. FIG. 9 is a flowchart showing the fifth method of determining a scale factor. FIG. FIG. 1 is a block diagram showing the configuration of an image compressor in an embodiment; FIG. 2 is a diagram showing a look-up table of complexity ratios and target code amounts; FIG. 3 is a graph showing the relationship between complexity ratios and compression rates; FIG. 4 is a flowchart showing the operation of an image compressor in an embodiment; FIG. 5 is a conceptual diagram showing a second compression example in an embodiment; FIG. 6 is a block diagram showing the configuration of an image decompressor in an embodiment; and FIG. 7 is a diagram showing image quality evaluation results.
[0010] In recent years, image resolution in image processing devices has been increasing. This has resulted in an increase in the amount of code for image data, which can lead to problems such as transmission delays and increased memory usage. Quantizing image data can reduce the amount of code for image data and mitigate these problems. However, quantizing image data can also result in quantization errors, which can lead to image quality degradation.
[0011] Therefore, for example, an image encoding device according to one aspect of the present disclosure includes a feature acquirer that acquires, for each of a plurality of components constituting a pixel of an image, a feature of the data of that component in a block to be processed among a plurality of blocks of the image; a target code length determiner that determines, for each of the plurality of components, a target code length for the data of that component in accordance with the feature of the data of that component; a frequency converter that performs frequency conversion on the data of that component in accordance with the target code length for the data of that component in accordance with the feature of the data of that component; a quantization processor that quantizes, for each of the plurality of components, the data of that component after frequency conversion in accordance with the target code length for the data of that component; and an encoder that encodes, for each of the plurality of components, the data of that component after quantization.
[0012] This allows the image coding device to adjust the target code amount of the data of each component according to the feature amount of the data of that component. Therefore, the image coding device can prevent a large loss of features. Therefore, the image coding device can prevent deterioration of image quality.
[0013] Furthermore, for example, the plurality of components includes two components, luminance and color difference.
[0014] This allows the image encoding device to adjust the target code amount for each of the luminance and chrominance components in accordance with the feature amount of the data of that component, thereby enabling the image encoding device to appropriately suppress image quality degradation for images with different feature amounts between luminance and chrominance.
[0015] Furthermore, for example, the plurality of components includes three components: red, green, and blue.
[0016] This allows the image encoding device to adjust the target code amount for each of the red, green, and blue components according to the feature amount of the data for that component, thereby enabling the image encoding device to appropriately suppress image quality degradation for images with different feature amounts between red, green, and blue.
[0017] Furthermore, for example, the plurality of components includes transparency.
[0018] This allows the image encoding device to reduce the memory capacity required to store transparency information when blending multiple images using RGBA, as well as the delay that occurs in transmitting that data.
[0019] Also, for example, the feature amount acquirer acquires, for each of the plurality of components, a statistical value of the absolute difference between adjacent pixels in the data of the component as the feature amount of the data of the component.
[0020] This allows the image coding device to acquire feature quantities corresponding to abrupt changes between adjacent pixels, etc. Therefore, the image coding device can appropriately adjust the target code amount according to the feature quantities corresponding to abrupt changes between adjacent pixels, etc.
[0021] Also, for example, the feature acquirer acquires the feature of the data of each of the plurality of components using a Hadamard transform.
[0022] This allows the image coding device to acquire feature quantities corresponding to the amount of edges, etc., obtained by the Hadamard transform, and therefore the image coding device can appropriately adjust the target code amount in accordance with the feature quantities corresponding to the amount of edges, etc.
[0023] Also, for example, the feature acquirer acquires the features of the data of each of the plurality of components by acquiring information indicating the features of the data of that component from a device external to the image encoding device.
[0024] This allows the image coding apparatus to acquire the feature amount without calculating the feature amount, thereby reducing the amount of calculation processing.
[0025] Also, for example, the encoder multiplexes an identification code indicating multiple target code amounts determined for the multiple components and multiple pieces of data encoded for the multiple components into a stream, and outputs the stream.
[0026] This allows the image coding device to indicate the target code amount for each component of data in the stream, thereby supporting the decoding of each component of data from the stream.
[0027] Also, for example, the quantization processor determines a scale factor that affects a quantization width for each of the plurality of components in accordance with the target code amount, and quantizes the data of the component in accordance with the scale factor.
[0028] This allows the image coding device to adjust the scale factor used to quantize the data of each component in accordance with the target code size for that component, thereby enabling the image coding device to appropriately adjust the code size for that component in accordance with the target code size for that component.
[0029] Also, for example, the quantization processor initially sets the scale factor, quantizes the data according to the scale factor, obtains a predicted code amount of the data according to the data quantized according to the scale factor, updates the scale factor according to a comparison result between the predicted code amount and the target code amount, and determines the scale factor by repeating the quantization of the data, obtaining the predicted code amount, and updating the scale factor until the predicted code amount matches the target code amount.
[0030] This allows the image coding device to search for and determine a scale factor that matches the predicted code amount with the target code amount, and therefore the image coding device can determine an appropriate scale factor for the target code amount.
[0031] Also, for example, the quantization processor initially sets the scale factor in accordance with the feature amount of the data.
[0032] This allows the image coding device to appropriately set the initial scale factor when searching for the scale factor, thereby reducing processing delays.
[0033] Also, for example, the quantization processor updates the initial value of the scale factor when the difference between the scale factor determined by repeatedly updating the scale factor and the initial value of the scale factor is greater than a threshold value, and does not update the initial value of the scale factor when the difference is equal to or less than the threshold value.
[0034] This allows the image encoding device to update the initial value of the scale factor determined in accordance with the feature based on the final scale factor to an optimal value, thereby reducing processing delays in subsequent processing.
[0035] Also, for example, the quantization processor counts up a count value when the difference between the scale factor determined by repeatedly updating the scale factor and the initial value of the scale factor is greater than a first threshold, does not count up the count value when the difference is equal to or less than the first threshold, updates the initial value of the scale factor when the count value is greater than a second threshold, and does not update the initial value of the scale factor when the count value is equal to or less than the second threshold.
[0036] This allows the image encoding device to update the initial value of the scale factor determined in accordance with the feature at an appropriate update frequency based on the final scale factor, thereby reducing processing delays in subsequent processing.
[0037] Also, for example, the quantization processor initially sets a first scale factor, quantizes the data according to the first scale factor, obtains a first predicted code amount of the data according to the data quantized according to the first scale factor, updates the first scale factor according to a result of comparing the first predicted code amount with the target code amount, determines the first scale factor by repeating the quantization of the data, obtaining the first predicted code amount, and updating the first scale factor until the first predicted code amount matches the target code amount, determines a second scale factor according to the feature of the data, quantizes the data according to the second scale factor, obtains a second predicted code amount of the data according to the data quantized according to the second scale factor, and determines one of the first scale factor and the second scale factor as the scale factor based on a result of comparing the first predicted code amount with the target code amount and a result of comparing the second predicted code amount with the target code amount.
[0038] This allows the image coding device to determine a scale factor using both the method of searching for a scale factor that matches the predicted code amount to the target code amount and the method of determining a scale factor based on a feature amount, thereby preventing the image coding device from determining a scale factor that corresponds to a local solution in the search as the final scale factor.
[0039] Also, for example, the quantization processor initially sets the first scale factor in accordance with the feature amount of the data.
[0040] This allows the image coding device to appropriately set the initial scale factor when searching for the scale factor, thereby reducing processing delays.
[0041] Also, for example, an image encoding method according to one aspect of the present disclosure includes the steps of: for each of a plurality of components constituting a pixel of an image, acquiring a feature of the data of the component in a block to be processed among a plurality of blocks of the image; for each of the plurality of components, determining a target code size of the data of the component in accordance with the feature of the data of the component; for each of the plurality of components, performing a frequency transform on the data of the component; for each of the plurality of components, quantizing the data of the component after frequency transform in accordance with the target code size of the data of the component; and for each of the plurality of components, encoding the data of the component after quantization.
[0042] This makes it possible to adjust the target code amount for the data of each component according to the feature amount of the data of that component, thereby preventing a significant loss of features and thus reducing deterioration in image quality.
[0043] Hereinafter, embodiments will be described with reference to the drawings. Note that the embodiments described below are all comprehensive or specific examples. The numerical values, shapes, materials, components, the arrangement and connection of the components, steps, the order of steps, and the like shown in the following embodiments are merely examples and are not intended to limit the scope of the claims.
[0044] FIG. 1 is a block diagram showing the configuration of an image coding device according to a reference example. The image coding device 100 shown in FIG. 1 codes an image block by block. Each image is composed of a plurality of pixels, and each block is also composed of a plurality of pixels. A block may be a unit of randomly accessible area called an MCU (Minimum Coded Unit). For example, an MCU of 16×8 pixels may be used as a block. The image coding device 100 performs fixed-length compression on each block of the image according to a target code amount.
[0045] Furthermore, an image pixel is composed of multiple components such as luminance and chrominance. When encoding an image block by block, the image encoding device 100 encodes the image block by component. For example, the image encoding device 100 encodes the luminance data and chrominance data of a block independently.
[0046] Specifically, the image coding device 100 includes a frequency transformer 110, a quantization processor 120, and an encoder 130. The quantization processor 120 includes a quantizer 121, a quantization table deriver 122, and a scale factor determiner 123. For example, these components are electric circuits.
[0047] The frequency transformer 110 performs a frequency transform on the data of each component constituting a pixel in the target block. For example, the frequency transform may use a discrete cosine transform (DCT). As a result, for each component, multiple pixel values of that component in the target block are transformed into multiple frequency coefficients of that component in the target block.
[0048] The quantization processor 120 quantizes the transformed data of each component in the target block according to a fixed target code amount that is the same for multiple components, thereby compressing the data.
[0049] Specifically, the scale factor determiner 123 determines a scale factor according to the target code amount, the converted data, and a fixed-length coding algorithm so that the code amount of the data matches the target code amount. The quantization table deriver 122 derives a quantization table according to the scale factor. The quantizer 121 quantizes the converted data according to the quantization table.
[0050] In the quantization table, a quantization width is defined for each frequency level. The scale factor affects the quantization width defined for each frequency level in the quantization table. For example, as the scale factor increases, the quantization width also increases. That is, the quantization width may have a monotonically increasing relationship with the scale factor in a narrow or broad sense. The quantization width may also be proportional to the scale factor. Note that a scale factor may be used such that the quantization width decreases as the scale factor increases.
[0051] The encoder 130 encodes, for each component, the quantized data of that component in the current block into a stream. Huffman coding may be used for encoding. The encoder 130 may also feed back the code amount to the scale factor determiner 123. The scale factor determiner 123 may then update the scale factor according to the code amount, thereby re-determining the scale factor. Then, the determination of the scale factor, the derivation of the quantization table, the quantization, and the encoding may be repeated.
[0052] As a result, the block to be processed is coded according to the target code amount. The target code amount may be a register setting value set in the image coding device 100. Specifically, a compression ratio of 50%, 25%, or the like may be used as the target code amount. The compression ratio is the ratio of the volume of compressed data to the volume of uncompressed data. In the reference example, the code amount of data for each component in each block of the image is controlled according to the same fixed target code amount.
[0053] For example, the code amount of luminance data and the code amount of chrominance data are controlled according to the same fixed target code amount. Specifically, a scale factor for the luminance data is determined according to the fixed target code amount. The luminance data is then quantized and coded according to the scale factor for the luminance data. Also, a scale factor for the chrominance data is determined according to the same fixed target code amount. The chrominance data is then quantized and coded according to the scale factor for the chrominance data.
[0054] 2 is a flowchart showing the operation of the image coding device 100 shown in FIG. First, an image is divided into a plurality of blocks (S101). This division process (S101) may be performed by a divider (not shown) of the image coding device 100, or may be performed by the frequency transformer 110. Then, a block-by-block loop process (S102 to S106) is performed.
[0055] In the block-by-block loop processing (S102 to S106), the frequency transformer 110 performs frequency transform on the data of each component in the current block (S102). The quantizer 120 then quantizes the transformed data of each component in the current block according to a scale factor (S103). The encoder 130 then encodes the quantized data of each component in the current block (S104).
[0056] If the amount of generated code for each component in the encoded data of the target block matches the target amount of code (Yes in S105), the processing of the target block ends. On the other hand, if the amount of generated code does not match the target amount of code (No in S105), the quantization processor 120 updates the scale factor (S106).
[0057] For example, if the generated code amount is larger than the target code amount, the quantization processor 120 increases the scale factor. If the generated code amount is smaller than the target code amount, the quantization processor 120 decreases the scale factor. Then, quantization (S103), encoding (S104), and updating of the scale factor (S106) are repeated until the generated code amount matches the target code amount.
[0058] As a result, the current block is coded according to the target code amount. The image coding device 100 also performs quantization (S103), coding (S104), and updating of the scale factor (S106) for each component. Meanwhile, the image coding device 100 controls the code amount for multiple components using the same fixed target code amount.
[0059] The quantization table deriving unit 122 may derive a quantization table by reflecting a scale factor on a standard quantization table, and the standard quantization table may be defined for each component.
[0060] FIG. 3A shows a standard quantization table used for luminance data. In the quantization table, a quantization width is defined for each frequency level. In FIG. 3A, the numerical values in the quantization table indicate the quantization width. In addition, in the quantization table, the upper left corresponds to low frequencies, and the lower right corresponds to high frequencies. Based on the fact that humans are insensitive to small changes, the quantization width is generally set small for low frequencies and large for high frequencies. This suppresses subjective deterioration in image quality and reduces the amount of code.
[0061] 3B is a diagram showing a standard quantization table used for chrominance data. As in FIG. 3A, the numerical values in the quantization table in FIG. 3B indicate quantization widths. Humans have different perceptions of luminance and chrominance. In accordance with the differences in human perception of luminance and chrominance, a quantization table different from the standard quantization table for luminance data is defined as the standard quantization table for chrominance data. Note that the standard quantization table used for luminance data may also be used for chrominance data.
[0062] 4 is a conceptual diagram showing an example of compression in a reference example. Specifically, an example of compression of luminance data and chrominance data in a 16x8 pixel MCU is shown. Here, the YUV422 format is used, and the 16x8 pixel MCU includes 16x8 Y values (luminance values), 8x8 Cb values (blue chrominance values), and 8x8 Cr values (red chrominance values). Furthermore, one Y value, one Cb value, and one Cr value are represented by 8 bits.
[0063] Therefore, the data volume of luminance data (Y) in an MCU before compression is 16 x 8 x 8 = 1024 bits. The code volume obtained by encoding this data at a compression rate of 25% is 1024 x 25% = 256 bits. Similarly, the data volume of chrominance data (Cb and Cr) in an MCU before compression is 16 x 8 x 8 = 1024 bits. The code volume obtained by encoding this data at a compression rate of 25% is 1024 x 25% = 256 bits.
[0064] In the reference example, the same fixed target code size (compression ratio) is used for luminance and chrominance data. That is, the compression ratio is controlled to be the same between luminance data (Y) and chrominance data (Cb and Cr), and the code size is also controlled to be the same.
[0065] Note that the 16x8 Y values in a 16x8 pixel MCU may be divided into two sets, each consisting of 8x8 Y values. Frequency transform, quantization, and encoding may then be performed in units of 8x8 values. Similarly, frequency transform, quantization, and encoding may also be performed in units of 8x8 values for the 8x8 Cb values and the 8x8 Cr values.
[0066] 5 is a conceptual diagram showing mosquito noise caused by quantization error. Image encoding and decoding processes involve frequency transform, quantization, inverse quantization, and inverse frequency transform. Specifically, image encoding involves frequency transform and quantization, while image decoding involves inverse quantization and inverse frequency transform. Here, an example is shown in which frequency transform, quantization, inverse quantization, and inverse frequency transform are performed on an 8x8 pixel block of an image.
[0067] First, in the encoding process, a frequency transform is performed on a block of an input image. Specifically, a plurality of pixel values constituting the block are decomposed into a plurality of frequency coefficients constituting the block according to a plurality of bases of the frequency transform.
[0068] Here, the pixel values of an 8x8 block are converted into 8x8 frequency coefficients that make up a block (lower left in Figure 5). As with the quantization tables shown in Figures 3A and 3B, in the converted data of the block, the upper left corresponds to low frequencies and the lower right corresponds to high frequencies. For example, if an edge exists in a block of an input image, non-zero frequency coefficients will exist not only in the low frequency region but also in the medium frequency region and high frequency region.
[0069] Next, the transformed data is quantized. Specifically, each frequency coefficient is quantized according to the corresponding quantization step in the quantization table. As a result, an 8x8 quantized frequency coefficient block is obtained (see the bottom center of Figure 5). This compresses the data. In particular, in the high-frequency region, the frequency coefficients are significantly compressed due to the large quantization step.
[0070] Then, during the decoding process, the quantized data is dequantized. Specifically, each quantized frequency coefficient is dequantized according to the corresponding quantization step in the quantization table. This results in an 8x8 block of frequency coefficients (see the bottom right of Figure 5). This decompresses the data.
[0071] The data of a block after quantization and dequantization is different from the data of the block before quantization and dequantization. The difference in data between these blocks is caused by the rounding of values by quantization and is called quantization error. The quantization error is particularly large in the high-frequency region, where a large quantization step is used.
[0072] The dequantized data is then subjected to an inverse frequency transform, whereby the frequency coefficients constituting the block are combined into pixel values constituting the block according to multiple bases of the frequency transform. Specifically, the 8x8 frequency coefficients constituting the block are transformed into 8x8 pixel values constituting the block. This results in a block of the reconstructed image.
[0073] In blocks of a reproduced image, quantization errors can cause mosquito noise, which can degrade image quality. Mosquito noise is particularly noticeable in flat areas around edges.
[0074] FIG. 6 is a block diagram showing the configuration of an image coding device according to this embodiment. The image coding device 200 shown in FIG. 6 codes an image block by block. Each image is made up of a plurality of pixels, and each block is also made up of a plurality of pixels. A block may be a unit of randomly accessible area called an MCU. For example, an MCU of 16×8 pixels may be used as a block. The image coding device 200 performs fixed-length or variable-length compression on each block of the image according to a target code amount.
[0075] Furthermore, an image pixel is composed of multiple components such as luminance and chrominance. When encoding an image block by block, the image encoding device 200 encodes the image block by component. The multiple components may be two components, luminance and chrominance, or three components, red, green, and blue, corresponding to RGB. The multiple components may also be four components, corresponding to RGBA (Red Green Blue Alpha), which are the three components, red, green, and blue, plus transparency (alpha).
[0076] Specifically, the image coding device 200 includes a frequency converter 210, a quantization processor 220, an encoder 230, a feature amount acquirer 240, and a target code amount determiner 250. The quantization processor 220 includes a quantizer 221, a quantization table deriving unit 222, and a scale factor determiner 223. For example, these components are electric circuits.
[0077] The feature amount acquirer 240 acquires, for each component constituting a pixel, a feature amount of data of that component in the block to be processed. The feature amount of data may correspond to the complexity of the data.
[0078] For example, the feature acquirer 240 may calculate, for each component, a statistical value of the absolute difference between adjacent pixels in the data of that component as the feature of the data of that component. The statistical value may be a sum or an average value. The average value of the absolute difference between adjacent pixels may also be expressed as activity.
[0079] Furthermore, the feature acquirer 240 may acquire, for each component, the feature of the data of that component using a Hadamard transform. For example, the feature acquirer 240 may acquire, for each component, the amount of edges obtained by applying a Hadamard transform to the data of that component as the feature of the data of that component.
[0080] Furthermore, for example, the feature acquirer 240 may acquire, for each component, information indicating the feature of the data of that component from a device external to the image encoding device 200. The external device may be a device that calculates the feature. Alternatively, the external device may be an imaging device that determines the feature based on imaging conditions. Alternatively, the external device may determine the feature according to the image type.
[0081] The target code amount determiner 250 determines the target code amount for each component in accordance with the feature amount of the data of that component in the processing target block. For example, the target code amount determiner 250 increases the target code amount as the feature amount increases.
[0082] Furthermore, the target code amount determiner 250 may determine the target code amount for each component according to the relationship between the feature amount of the data of that component and the feature amounts of the other components. Specifically, if the feature amount of the data of a first component is larger than the feature amount of the data of a second component, the first target code amount for the data of the first component may be larger than the second target code amount for the data of the second component.
[0083] Furthermore, the target code amount determiner 250 may maintain the total target code amount of data of a plurality of components in a plurality of blocks at a reference code amount, and adjust the ratio of the target code amounts between the components for each block according to the feature amount.
[0084] The frequency transformer 210 performs a frequency transform on the data of each component in the target block. For example, the frequency transform is performed using DCT. As a result, for each component, multiple pixel values of the component in the target block are transformed into multiple frequency coefficients of the component in the target block.
[0085] The quantization processor 220 quantizes the transformed data of each component in the target block according to the target code amount for the data of that component in the target block, thereby compressing the data.
[0086] Specifically, the scale factor determiner 223 determines a scale factor in accordance with the target code amount, the converted data, and a fixed-length coding algorithm so that the code amount of the data matches the target code amount. Here, the target code amount is the target code amount determined for each component as the target code amount for the data of that component in accordance with the feature amount of the data of that component.
[0087] The quantization table deriving unit 222 derives a quantization table for each component according to the scale factor for the data of that component. The quantizer 221 quantizes the transformed data of that component according to the quantization table for the data of that component.
[0088] In the quantization table, a quantization width is defined for each frequency level. The scale factor affects the quantization width defined for each frequency level in the quantization table. For example, as the scale factor increases, the quantization width also increases. That is, the quantization width may have a monotonically increasing relationship with the scale factor in a narrow or broad sense. The quantization width may also be proportional to the scale factor. Note that a scale factor may be used such that the quantization width decreases as the scale factor increases.
[0089] The encoder 230 encodes, for each component, the quantized data of that component in the current block into a stream, using Huffman coding.
[0090] The encoder 230 may also feed back the code amount of each component data to the scale factor determiner 223. Then, the scale factor determiner 223 may re-determine the scale factor for each component data by updating the scale factor for the component data in accordance with the code amount of the component data. Then, the determination of the scale factor, the derivation of the quantization table, the quantization, and the encoding may be repeated.
[0091] As a result, the target block is encoded according to the target code amount. Here, the target code amount is a target code amount determined for each component as the target code amount for the data of that component according to the feature amount of the data of that component. Specifically, for each component, the compression rate for the data of that component may be used as the target code amount for the data of that component. In particular, the code amount for each component data in each block of the image is controlled according to the target code amount for the data of that component in that block.
[0092] Alternatively, the reference target code amount may be set as a register setting value in the image encoding device 200. Then, the target code amount determiner 250 may determine the target code amount by applying a gain or an offset to the reference target code amount in accordance with the feature amount. The reference target code amount may be the same for multiple components or may be different for each component. Alternatively, the reference target code amount may correspond to the total target code amount described above.
[0093] Furthermore, for example, a feature amount of the luminance data in the target block and a feature amount of the chrominance data in the target block are acquired. Then, a target code amount of the luminance data and a target code amount of the chrominance data are determined according to the feature amount of the luminance data and the feature amount of the chrominance data, respectively. Then, a scale factor for the luminance data and a scale factor for the chrominance data are determined according to the target code amount of the luminance data and the target code amount of the chrominance data, respectively.
[0094] The luminance data and the chrominance data are then quantized and coded according to the scale factor for the luminance data and the scale factor for the chrominance data, respectively, so that the code amount for the luminance data and the code amount for the chrominance data are controlled according to separate, variable target code amounts.
[0095] Furthermore, a characteristic of general images, particularly natural images, is that changes in chrominance tend to be smaller than changes in luminance. Therefore, noise due to quantization errors is less likely to occur in chrominance. Furthermore, human visual characteristics are such that human vision is less sensitive to changes in chrominance than to changes in luminance. Therefore, noise due to quantization errors is less likely to be visible in chrominance. Considering these general image characteristics and human visual characteristics, it may be beneficial to increase the target code size for luminance data compared to chrominance data.
[0096] Therefore, luminance data may be actively protected in the above-described configuration of the image encoding device 200. Specifically, the target code amount determiner 250 may determine the target code amount for each of the luminance data and the chrominance data so that the target code amount for the luminance data is greater than the target code amount for the chrominance data.
[0097] Fig. 7 is a flowchart showing the operation of the image coding device 200 shown in Fig. 6. First, an image is divided into a plurality of blocks (S201). This division process (S201) may be performed by a divider (not shown) of the image coding device 200, or may be performed by the frequency transformer 210. Then, a block-by-block loop process (S202 to S208) is performed.
[0098] In the block-by-block loop (S202-S208), the feature acquirer 240 acquires the feature of the data of each component in the target block (S202). Next, the target code size determiner 250 determines the target code size of each component in the target block according to the feature of the data of that component in the target block (S203). The frequency transformer 210 performs frequency transform on the data of that component in the target block (S204).
[0099] The quantization processor 220 then quantizes the transformed data of each component in the target block according to the scale factor (S205), and the encoder 230 encodes the quantized data of each component in the target block (S206).
[0100] If the code size of the encoded data for each component in the target block matches the target code size for that component (Yes in S207), the processing for that block ends. On the other hand, if the code size does not match the target code size (No in S207), the quantization processor 220 updates the scale factor (S208).
[0101] For example, if the generated code amount is larger than the target code amount, the quantization processor 220 increases the scale factor to increase the quantization width. If the generated code amount is smaller than the target code amount, the quantization processor 220 decreases the scale factor to decrease the quantization width. Quantization (S205), encoding (S206), and updating of the scale factor (S208) are then repeated until the generated code amount matches the target code amount.
[0102] In the above operation, for each component, the following steps are performed: obtaining a feature value (S202), determining a target code size (S203), frequency transforming (S204), quantizing (S205), encoding (S206), and updating the scale factor (S208). That is, for each component, a feature value is obtained, and a target code size is determined according to the feature value. Then, the target block is encoded according to the target code size for each component.
[0103] FIG. 8A is a conceptual diagram showing an example of calculating a feature of luminance data. For example, the average value of the absolute difference between adjacent pixels of luminance data is calculated as the feature of luminance data. FIG. 8A shows an equation for calculating the average absolute difference between adjacent pixels of luminance data in a 16×8 pixel MCU in the YUV422 format. The feature acquirer 240 may calculate the average absolute difference between adjacent pixels of luminance data as the feature of luminance data according to the equation shown in FIG. 8A.
[0104] In the formula of Fig. 8A, for example, Yn(i, j) when n = 0 represents the Y value of the pixel located at (i, j) in the 8 x 8 pixels on the left, and Yn(i, j) when n = 1 represents the Y value of the pixel located at (i, j) in the 8 x 8 pixels on the right. act_y in Fig. 8A roughly, though not strictly, corresponds to the average absolute difference between the luminance data of adjacent pixels.
[0105] 8B is a conceptual diagram showing an example of calculating the feature of the color difference data. For example, the average value of the absolute difference between adjacent pixels of the color difference data is calculated as the feature of the color difference data. FIG. 8B shows an equation for calculating the average absolute difference between adjacent pixels of the color difference data in a 16×8 pixel MCU in the YUV422 format. The feature acquirer 240 may calculate the average absolute difference between adjacent pixels of the color difference data as the feature of the color difference data according to the equation shown in FIG. 8B.
[0106] In the formula of Fig. 8B, for example, Cb(i, j) represents the Cb value of the pixel located at (i, j) in the 8x8 pixels corresponding to Cb, and Cr(i, j) represents the Cr value of the pixel located at (i, j) in the 8x8 pixels corresponding to Cr. act_c in Fig. 8B roughly, though not strictly, corresponds to the average absolute difference between adjacent pixels in the luminance data.
[0107] 9 is a conceptual diagram showing a first method for determining a scale factor, in which the scale factor is determined by a search method.
[0108] Specifically, the frequency transformer 210 performs frequency transform on data in a target block of an image. The scale factor determiner 223 initializes a scale factor and quantizes the transformed data in accordance with the scale factor. The scale factor determiner 223 then predicts the code amount in accordance with the quantized data to obtain a predicted code amount.
[0109] If the target code amount and the predicted code amount do not match, the scale factor determiner 223 updates the scale factor and quantizes the converted data again in accordance with the scale factor. The scale factor determiner 223 then repeats quantization, code amount prediction, and scale factor update until the target code amount and the predicted code amount match, thereby determining the scale factor.
[0110] Fig. 10 is a flowchart showing the first determination method shown in Fig. 9. Fig. 10 particularly shows the operation of the scale factor determiner 223. Specifically, first, the scale factor determiner 223 initializes the scale factors (S301). For example, the scale factor determiner 223 may initialize the scale factors using an average scale factor as an initial value. This prevents an increase in the number of searches in the search method.
[0111] Then, the scale factor determiner 223 quantizes the transformed data in accordance with the scale factor (S302). Instead of the scale factor determiner 223, the quantizer 221 may quantize the transformed data in accordance with the scale factor.
[0112] Then, the scale factor determiner 223 predicts the code amount according to the quantized data, thereby obtaining the predicted code amount (S303). The scale factor determiner 223 may obtain the predicted code amount by applying Huffman coding to the quantized data.
[0113] Alternatively, the encoder 230 may encode the quantized data instead of the scale factor determiner 223. Then, the scale factor determiner 223 may predict the code amount by obtaining the code amount from the encoder 230.
[0114] Next, the scale factor determiner 223 calculates the target code amount minus the predicted code amount (S304). Then, the scale factor determiner 223 determines whether the target code amount minus the predicted code amount satisfies the polarity and convergence conditions (S305). These conditions correspond to the conditions for the target code amount and the predicted code amount to match.
[0115] If the target code amount - the predicted code amount does not satisfy the condition (No in S305), the scale factor determiner 223 updates the scale factor according to the polarity and magnitude of the target code amount - the predicted code amount (S306).Then, until the target code amount - the predicted code amount satisfies the condition, the scale factor determiner 223 repeats quantization (S302), code amount prediction (S303), calculation of the target code amount - the predicted code amount (S304), and updating of the scale factor (S306).
[0116] For example, the scale factor determiner 223 determines that the condition is met when the minus (target code amount) is a positive value that is equal to or smaller than a threshold value.
[0117] Alternatively, the scale factor determiner 223 may determine that the target code amount minus the predicted code amount satisfies the condition when the minus the target code amount is a positive value and the amount of change accompanying the update of the scale factor is equal to or less than a threshold value. Alternatively, the scale factor determiner 223 may determine that the target code amount minus the predicted code amount satisfies the condition when the minus the target code amount is a positive value and the scale factor has been updated the threshold number of times or more.
[0118] Furthermore, the scale factor determiner 223 may reduce the amount of change in the scale factor by half each time the scale factor is updated, and may update the scale factor until the amount of change in the scale factor reaches the minimum unit.
[0119] In updating the scale factor, if the (target code amount - predicted code amount) is a positive value, the scale factor determiner 223 may decrease the scale factor. If the (target code amount - predicted code amount) is a negative value, the scale factor determiner 223 may increase the scale factor. Furthermore, the scale factor determiner 223 may increase the amount of change in the scale factor as the absolute value of (target code amount - predicted code amount) increases.
[0120] If the target code amount minus the predicted code amount satisfies the condition (Yes in S305), the scale factor determiner 223 determines the scale factor at that time as the final scale factor.
[0121] 11 is a conceptual diagram showing a second method for determining a scale factor. In the second method, a scale factor is initially set according to the feature amount of data in a block of an image to be processed. Specifically, the scale factor determiner 223 acquires the feature amount of data in the block of an image to be processed and initially sets a scale factor according to the feature amount. The rest of the method is the same as the first method.
[0122] Figure 12 is a flow chart showing the second determination method shown in Figure 11. In particular, the operation of the scale factor determiner 223 is shown in Figure 12.
[0123] Specifically, first, the scale factor determiner 223 acquires the feature quantities of the data (S401). For example, the scale factor determiner 223 may acquire the feature quantities of the data in the same way as the feature quantity acquirer 240, or may acquire the feature quantities of the data from the feature quantity acquirer 240. Alternatively, the scale factor determiner 223 may acquire the feature quantities of the data using criteria and a method different from those of the feature quantity acquirer 240.
[0124] Next, the scale factor determiner 223 initializes the scale factor according to the feature of the data (S402). For example, the scale factor determiner 223 may initialize the scale factor by using a smaller value as the initial value of the scale factor as the feature is larger. This prevents an increase in the number of searches in the search method. Therefore, processing delays are reduced and throughput performance is improved.
[0125] The subsequent processes (S403 to S407) are the same as the corresponding processes (S302 to S306) in the first determination method.
[0126] 13 is a conceptual diagram illustrating a third method for determining a scale factor. In this method, the scale factor finally determined by updating the scale factor is compared with the initial value of the scale factor. If the difference between the two is greater than a predetermined threshold, the initial value of the scale factor corresponding to that feature is updated. On the other hand, if the difference is equal to or less than the threshold, the initial value of the scale factor is not updated. This initial value of the scale factor can be used for subsequent blocks having the same feature.
[0127] The initial value of the scale factor may be updated to the value of the finally determined scale factor, or may be updated to the intermediate value (average value) between the initial value before the update and the value of the finally determined scale factor. The rest is the same as in the second determination method.
[0128] Figure 14 is a flow chart showing the third determination method shown in Figure 13. In particular, the operation of the scale factor determiner 223 is shown in Figure 14.
[0129] Specifically, the scale factor determiner 223 performs the same processes (S501 to S507) as the corresponding processes (S401 to S407) in the second determination method until the scale factor is finally determined. After the scale factor is finally determined (Yes in S506), the scale factor determiner 223 compares the finally determined scale factor with the initial value of the scale factor, and compares the difference therebetween with a predetermined threshold (S508).
[0130] If the difference is greater than a predetermined threshold (Yes in S508), the scale factor determiner 223 updates the initial value of the scale factor corresponding to the feature (S509). If the difference is equal to or less than the predetermined threshold (No in S508), the scale factor determiner 223 does not update the initial value.
[0131] Furthermore, for example, even when it is determined that the difference is greater than a predetermined threshold, the scale factor determiner 223 may not immediately update the initial value, but may instead count up a count value corresponding to the number of times it has been determined that the difference is greater than the predetermined threshold. The scale factor determiner 223 may then update the initial value only when the count value exceeds the threshold corresponding to the predetermined number of times. The count value may be initialized to 0 when image encoding starts, when the threshold is exceeded, or the like.
[0132] This is expected to further reduce the number of searches in the search method for subsequent blocks to be processed that have equivalent features, thereby further reducing processing delays and further improving throughput performance compared to the second determination method.
[0133] In the other methods of determining a scale factor, the initial value of the scale factor may be updated according to the final value of the scale factor, as in the third determination method.
[0134] 15 is a conceptual diagram showing a fourth method for determining a scale factor. In an example of the fourth method, the scale factor determiner 223 includes a first scale factor determiner 310, a second scale factor determiner 320, and a scale factor selector 330. For example, these components are electric circuits.
[0135] The first scale factor determiner 310 determines the first scale factor by the same method as the first scale factor determination method. That is, the first scale factor determiner 310 determines the scale factor determined by the first scale factor determination method as the first scale factor. The first scale factor determiner 310 also obtains the code amount predicted according to the first scale factor as the first predicted code amount.
[0136] The second scale factor determiner 320 determines a second scale factor according to the feature amount of data in the target block of the image. Next, the scale factor determiner 223 quantizes the converted data according to the second scale factor. The scale factor determiner 223 then predicts the code amount of the quantized data according to the second scale factor to obtain a second predicted code amount.
[0137] The scale factor selector 330 determines the scale factor by selecting a scale factor from the first scale factor and the second scale factor according to the first predicted code amount and the second predicted code amount.
[0138] Fig. 16 is a flowchart showing the fourth determination method shown in Fig. 15. Fig. 16 particularly shows the operations of the first scale factor determiner 310, the second scale factor determiner 320, and the scale factor selector 330 in the scale factor determiner 223.
[0139] Specifically, the first scale factor determiner 310 performs the same processes (S601 to S606) as the processes (S301 to S306) in the first determination method, except that the scale factors and predicted code amounts in the first determination method are replaced with the first scale factors and first predicted code amounts.
[0140] Furthermore, the second scale factor determiner 320 acquires the feature quantities of the data (S607). For example, the second scale factor determiner 320 may acquire the feature quantities of the data in the same manner as the feature quantity acquirer 240, or may acquire the feature quantities of the data from the feature quantity acquirer 240. Alternatively, the second scale factor determiner 320 may acquire the feature quantities of the data using criteria and a method different from those of the feature quantity acquirer 240.
[0141] Next, the second scale factor determiner 320 determines the second scale factor according to the feature of the data (S608). For example, the second scale factor determiner 320 may determine a smaller value as the second scale factor as the feature is larger.
[0142] Then, the second scale factor determiner 320 quantizes the transformed data in accordance with the second scale factor (S609). Instead of the second scale factor determiner 320, the quantizer 221 may quantize the transformed data in accordance with the second scale factor.
[0143] Then, the second scale factor determiner 320 predicts the code amount according to the quantized data to obtain the second predicted code amount (S610). The second scale factor determiner 320 may obtain the code amount predicted by applying Huffman coding to the quantized data as the second predicted code amount.
[0144] Alternatively, the encoder 230 may encode the quantized data instead of the second scale factor determiner 320. Then, the second scale factor determiner 320 may predict the code amount by obtaining the code amount from the encoder 230.
[0145] Next, the scale factor selector 330 determines the scale factor by selecting a scale factor from the first scale factor and the second scale factor according to the first predicted code amount and the second predicted code amount (S611).
[0146] For example, the scale factor selector 330 selects the first scale factor when the first predicted code amount is closer to the target code amount than the second predicted code amount, and selects the second scale factor when the second predicted code amount is closer to the target code amount than the first predicted code amount. Here, it may be specified that the closer the predicted code amount is to the target code amount, the closer it is to the target code amount, while being equal to or smaller than the target code amount.
[0147] In the fourth determination method, a scale factor is selected from a first scale factor based on a search method and a second scale factor based on a feature amount, thereby preventing a scale factor corresponding to a local solution in the search method from being determined as the final scale factor.
[0148] 17 is a conceptual diagram showing a fifth method for determining a scale factor. In an example of the fifth method, similar to the example of the fourth method, the scale factor determiner 223 includes a first scale factor determiner 310, a second scale factor determiner 320, and a scale factor selector 330. In the fifth method, the first scale factor is initially set in accordance with the feature amount of data in a processing target block of an image. Specifically, the first scale factor determiner 310 initially sets the first scale factor in accordance with the feature amount acquired by the second scale factor determiner 320. The rest is the same as the fourth method.
[0149] Fig. 18 is a flowchart showing the fifth determination method shown in Fig. 17. Fig. 18 particularly shows the operations of the first scale factor determiner 310, the second scale factor determiner 320, and the scale factor selector 330 in the scale factor determiner 223.
[0150] Specifically, first, the second scale factor determiner 320 acquires the feature quantities of the data (S701). For example, the second scale factor determiner 320 may acquire the feature quantities of the data in the same manner as the feature quantity acquirer 240, or may acquire the feature quantities of the data from the feature quantity acquirer 240.
[0151] Next, the first scale factor determiner 310 initializes the first scale factor according to the feature of the data (S702). For example, the first scale factor determiner 310 may initialize the first scale factor by using a smaller value as the initial value of the first scale factor as the feature is larger. This prevents an increase in the number of searches in the search method. Therefore, processing delays are reduced and throughput performance is improved.
[0152] The subsequent processes (S703 to S711) are the same as the corresponding processes (S602 to S606 and S608 to S611) in the fourth determination method.
[0153] In the fifth determination method, the second scale factor and the second predicted code amount are the same as the initial first scale factor and the first predicted code amount in the search method.
[0154] Therefore, in the fifth determination method, the second scale factor may be interpreted as the initial first scale factor in the search method, and the second predicted code amount may be interpreted as the initial first predicted code amount in the search method.The process of selecting a scale factor in the fifth determination method may be interpreted as a process of selecting a scale factor from the initial first scale factor and the final first scale factor in accordance with the initial first predicted code amount and the final first predicted code amount.
[0155] Fig. 19 is a conceptual diagram showing a first compression example in this embodiment. Similar to the example in Fig. 4, Fig. 19 shows an example of compression of luminance data and chrominance data in a 16x8 pixel MCU. The overall compression rate is 25%, and the overall code amount is 512 bits. In other words, the overall compression rate and code amount are the same as those in Fig. 4.
[0156] 19, the compression rate of the luminance data (Y) is 37.5%, and the code amount of the luminance data (Y) is 384 bits. The compression rate of the color difference data (Cb and Cr) is 12.5%, and the code amount of the color difference data (Cb and Cr) is 128 bits. In other words, the compression rate and code amount of the luminance data (Y) are different from those of the color difference data (Cb and Cr).
[0157] In this embodiment, the compression rate and code size of the data vary according to the feature value of the data of each component in the target block. For example, the larger the feature value of the data of each component in the target block, the larger the target code size is set for the data of that component, and the larger the resulting compression rate and code size for the data of that component.
[0158] The target code amount determiner 250 may change the ratio of multiple target code amounts corresponding to multiple components depending on the block to be processed, and may maintain the total of the multiple target code amounts constant regardless of the block to be processed. Alternatively, the target code amount determiner 250 may make the target code amount for luminance data larger than the target code amount for chrominance data. The target code amount determiner 250 may then determine how much the target code amount for luminance data should be larger than the target code amount for chrominance data, based on the feature amounts of the luminance data and the feature amounts of the chrominance data.
[0159] Alternatively, the encoder 230 may encode the scale factor and include the encoded scale factor in the stream. For example, the image decoding device decodes the quantized data and the scale factor from the stream and performs inverse quantization on the quantized data in accordance with the scale factor. The image decoding device then restores the data by performing an inverse frequency transform on the inversely quantized data.
[0160] As described above, the image coding device 200 acquires a feature for each component and determines a target code amount according to the feature. Therefore, the image coding device 200 can suppress image quality degradation that accompanies image data compression. In other words, the image coding device 200 can reduce the code amount of image data while suppressing image degradation.
[0161] Therefore, the image encoding device 200 can reduce the memory capacity required to store image data. This allows devices that handle image data to be smaller, less expensive, and consume less power. Furthermore, this alleviates pressure on memory bandwidth when accessing image data, enabling playback of moving images with high image quality and a high frame rate.
[0162] Fig. 20 is a block diagram showing the configuration of an image processing device according to this embodiment. The image processing device 400 shown in Fig. 20 includes an image input device 401, image compressors 402 and 406, image decompressors 403 and 407, an image output device 404, a drawing processor 405, a memory controller 408, and a memory 409. For example, these components are electric circuits.
[0163] The image input unit 401 acquires an input image. For example, the image input unit 401 acquires an input image from a camera, an image sensor, or the like.
[0164] Each of the image compressors 402 and 406 corresponds to the image encoding device 200 and encodes an image for each block. In doing so, each of the image compressors 402 and 406 compresses data in the block to be processed.
[0165] The memory controller 408 controls access from each component to the memory 409 based on the bus protocol, and controls reading and writing of data from and to the memory 409 .
[0166] The memory 409 is a memory built into the image processing device 400. For example, the memory 409 stores compressed image data under the control of the memory controller 408. The compressed image data is read from the memory 409 and expanded (decompressed) by the image expanders 403 and 407.
[0167] Each of the image decompressors 403 and 407 decodes the image block by block, and in doing so, each of the image decompressors 403 and 407 decompresses the data in the block to be processed.
[0168] The drawing processor 405 renders the image, and may edit the image or generate a graphic image.
[0169] The image output device 404 outputs an image. For example, the image output device 404 outputs an image to a display device or the like. The image output device 404 may output a plurality of images in a superimposed manner.
[0170] Fig. 21 is a block diagram showing the configuration of each of the image compressors 402 and 406 shown in Fig. 20. Each of the image compressors 402 and 406 includes a local buffer 510, a pre-processor 520, coding engines 531 to 534, a post-processor 540, and a request buffer 550. The local buffer 510 also includes a local arbiter 511. For example, these components are electric circuits.
[0171] The feature amount acquirer 240 and target code amount determiner 250 of the image coding device 200 may be included in the pre-processor 520. Furthermore, the frequency transformer 210 and quantization processor 220 of the image coding device 200 may be included in the coding engines 531 to 534. Furthermore, the coder 230 of the image coding device 200 may be included in the coding engines 531 to 534 and the post-processor 540.
[0172] The coding engines 531 to 534 correspond to four streams corresponding to the four components that make up an image pixel. Of the four streams, two streams corresponding to luminance and chrominance are used here. Specifically, coding engine 533 is used for luminance, and coding engine 534 is used for chrominance.
[0173] An image to be compressed is input to the local buffer 510. The local arbiter 511 acquires control information and arbitrates access to the local buffer 510 in accordance with the control information. Specifically, it controls simultaneous parallel processing of luminance data (Y) and color difference data (C) in a block of the image to be processed.
[0174] The preprocessor 520 acquires the luminance data and the chrominance data from the local buffer 510. Then, the preprocessor 520 acquires the feature quantities of the luminance data and the feature quantities of the chrominance data according to the luminance data and the chrominance data. Then, the preprocessor 520 calculates a complexity ratio according to the feature quantities of the luminance data and the feature quantities of the chrominance data. Here, the complexity ratio is the ratio of the complexity of the luminance data to the complexity of the chrominance data.
[0175] Furthermore, the preprocessor 520 determines the target code amount of the luminance data and the target code amount of the chrominance data according to the complexity ratio. The preprocessor 520 may derive the target code amount of the luminance data and the target code amount of the chrominance data from the complexity ratio by referring to a reference table described later.
[0176] The encoding engine 533 acquires the luminance data and the target code amount of the luminance data from the preprocessor 520. Then, the encoding engine 533 performs frequency conversion on the luminance data, quantizes the converted luminance data in accordance with the target code amount of the luminance data, and encodes the quantized luminance data.
[0177] The encoding engine 534 acquires the chrominance data and the target code size of the chrominance data from the preprocessor 520. Then, the encoding engine 534 performs frequency conversion on the chrominance data, quantizes the converted chrominance data in accordance with the target code size of the chrominance data, and encodes the quantized chrominance data.
[0178] The post-processor 540 obtains the coded luminance data from the coding engine 533 and the coded chrominance data from the coding engine 534. The post-processor 540 also obtains the complexity ratio from the pre-processor 520 via the coding engine 533 or the coding engine 534. Alternatively, the post-processor 540 may obtain the complexity ratio directly from the pre-processor 520 without going through the coding engine 533 or the coding engine 534.
[0179] The post-processor 540 then inserts the complexity ratio identification code at the beginning of the encoded chrominance data. The post-processor 540 then concatenates the encoded chrominance data and the encoded luma data in this order. The post-processor 540 then packs the complexity ratio identification code, the encoded chrominance data, and the encoded luma data to generate a stream including these. That is, the post-processor 540 multiplexes the complexity ratio identification code, the encoded chrominance data, and the encoded luma data into a stream.
[0180] Then, the post-processor 540 stores the stream in the request buffer 550. The post-processor 540 also controls requests for the stream.
[0181] A stream in which the complexity ratio identification code, the encoded chrominance data, and the encoded luminance data are packed is stored in the request buffer 550. The stream stored in the request buffer 550 is output to the memory 409 or the like.
[0182] The operations performed by the pre-processor 520 may be performed by the feature acquirer 240 or the target code amount determiner 250 of the image coding device 200. The operations performed by the coding engines 531 to 534 may be performed by the frequency transformer 210 or the quantization processor 220 of the image coding device 200. The operations performed by the coding engines 531 to 534 and the post-processor 540 may be performed by the encoder 230 of the image coding device 200.
[0183] 22A is a diagram showing a lookup table of complexity ratios and target code amounts. In this example, a complexity ratio corresponding to the ratio of the complexity of luminance data to the complexity of chrominance data is used. For example, if the ratio of the complexity of luminance data to the complexity of chrominance data is less than 1, a complexity ratio of 0 is used.
[0184] Furthermore, if the ratio is 1 or greater and less than 2, a complexity ratio of 1 is used. If the ratio is 2 or greater and less than 3, a complexity ratio of 2 is used. If the ratio is 3 or greater and less than 4, a complexity ratio of 3 is used. If the ratio is 4 or greater and less than 5, a complexity ratio of 4 is used. If the ratio is 5 or greater and less than 6, a complexity ratio of 5 is used. If the ratio is 6 or greater and less than 7, a complexity ratio of 6 is used. If the ratio is 7 or greater, a complexity ratio of 7 is used.
[0185] The complexity ratio is then associated with a target code amount for the luminance data and a target code amount for the chrominance data. In this example, the larger the complexity ratio, the larger the target code amount for the luminance data and the smaller the target code amount for the chrominance data. The sum of the target code amount for the luminance data and the target code amount for the chrominance data is constant regardless of the complexity ratio. Furthermore, for any complexity ratio, the target code amount for the luminance data is larger than the target code amount for the chrominance data.
[0186] 4 and 19, the data amount of the uncompressed luminance data and the data amount of the uncompressed chrominance data are each 1024 bits, for a total of 2048 bits. In the look-up table of Fig. 22A, the ratio of the target code amount to the uncompressed data amount is shown as the compression rate.
[0187] In addition, in the reference table, only the target code amount expressed in bits for luminance or color difference may be associated with the complexity ratio, or only the compression rate for luminance or color difference may be associated with the complexity ratio as information indicating the target code amount.
[0188] Figure 22B is a graph showing the relationship between complexity ratio and compression ratio, which corresponds to the values shown in Figure 22A.
[0189] The greater the relative complexity of the luminance data, the greater the target code size (compression rate) for the luminance data and the smaller the target code size (compression rate) for the chrominance data. Furthermore, for any complexity ratio, the target code size for the luminance data is greater than the target code size for the chrominance data. The greater the relative complexity of the luminance data, the greater the difference between the target code size (compression rate) for the luminance data and the target code size (compression rate) for the chrominance data.
[0190] FIG. 23 is a flowchart showing the operation of each of the image compressors 402 and 406 shown in FIGS.
[0191] First, the preprocessor 520 sets a reference table in which the complexity ratio between components corresponds to the target code amount for each component (S801). The preprocessor 520 may set a reference table for each image. For example, the preprocessor 520 may set a reference table for each frame constituting a moving image.
[0192] Next, the preprocessor 520 acquires the feature of the luminance data (S802). In parallel, the preprocessor 520 acquires the feature of the chrominance data (S803). Then, the preprocessor 520 calculates a complexity ratio, which is the ratio of the complexity of the luminance data to the complexity of the chrominance data, according to the feature of the luminance data and the feature of the chrominance data (S804). Then, the preprocessor 520 determines the target code size for the luminance data and the target code size for the chrominance data according to the complexity ratio (S805).
[0193] Next, the encoding engine 533 encodes the luminance data in accordance with the target code amount of the luminance data (S806). Specifically, the encoding engine 533 performs frequency conversion on the luminance data, quantizes the converted luminance data in accordance with the target code amount of the luminance data, and encodes the quantized luminance data.
[0194] In parallel, the encoding engine 534 encodes the chrominance data according to the target code length of the chrominance data (S807). Specifically, the encoding engine 534 performs frequency transform on the chrominance data, quantizes the transformed chrominance data according to the target code length of the chrominance data, and encodes the quantized chrominance data. Then, the post-processor 540 inserts an identification code of the complexity ratio into the encoded chrominance data (S808).
[0195] Thereafter, the post-processor 540 concatenates the coded chrominance data and the coded luminance data in this order (S809).
[0196] Fig. 24 is a conceptual diagram showing a second compression example in this embodiment. Similar to the example in Fig. 19, Fig. 24 shows an example of compression of luminance data and chrominance data in a 16x8 pixel MCU. The overall compression rate is 25%, and the total code amount is 512 bits. In other words, the overall compression rate and code amount are the same as those in the example in Fig. 19.
[0197] On the other hand, in the example of Fig. 24, a 3-bit identification code is inserted into the chrominance data. This further compresses the chrominance data by 3 bits. For example, 3 bits of data in the high frequency range of the chrominance data may be deleted. The luminance data follows the chrominance data into which the identification code has been inserted.
[0198] The complexity ratio identification code indicates the target code size for each of the luminance data and the chrominance data. When the generated code size for each of the luminance data and the chrominance data matches the target code size, the identification code can indicate a position in the stream that corresponds to a boundary between the luminance data and the chrominance data. Therefore, in this case, it is easy to separate the luminance data and the chrominance data from the stream during decoding (decompression).
[0199] In the encoding process (compression process), if the generated code amount is less than the target code amount, the generated code amount may be adjusted to match the target code amount by padding or the like.
[0200] Fig. 25 is a block diagram showing the configuration of each of the image decompressors 403 and 407 shown in Fig. 20. Each of the image decompressors 403 and 407 includes a request buffer 610, a preprocessor 620, decoding engines 631 and 632, a postprocessor 640, and a local buffer 650. The local buffer 650 also includes a local arbiter 651. For example, these components are electric circuits.
[0201] The decoding engines 631 and 632 are configured with a decoder, an inverse quantizer, an inverse frequency converter, etc., to decode the stream coded by the image coding device 200 corresponding to the image compressors 402, 406, etc., and convert it into each component of the image. The decoder may be, for example, a component that decodes stream data that has been Huffman coded in accordance with a target code amount when coded by the image coding device 200.
[0202] The inverse quantizer may be a component that inversely quantizes the output of the decoder according to the scale factor (header information in the Huffman code) used when the image was encoded by the image encoding device 200. The inverse frequency transformer may use, for example, an IDCT (Inverse Discrete Cosine Transform). This allows the inverse frequency transformer to perform an inverse orthogonal transform on the inversely quantized frequency coefficients, thereby restoring pixel data corresponding to each component of the image before encoding.
[0203] The decoding engines 631 and 632 correspond to two series of luminance data and chrominance data in order to decode a stream in which a complexity ratio identification code, encoded chrominance data, and encoded luminance data are packed by, for example, the post-processor 540 shown in Fig. 21. Specifically, the decoding engine 631 is used for the luminance data, and the decoding engine 632 is used for the chrominance data. These parallel processes enable a reduction in the delay time until image output.
[0204] Note that the chrominance data and luminance data may be processed serially using the decoding engine 631, such that the luminance data is processed after the chrominance data is processed. Note that the processing order of the luminance data and chrominance data may be reversed. Furthermore, the preprocessor 620 may efficiently allocate each stream output from the request buffer 610 to the decoding engines 631 and 632 according to the priority of each stream, and perform decoding. Note that the system may be configured with one or more decoding engines. The number of decoding engines may be determined within an allowable range for the delay time until image output.
[0205] In the request buffer 610, for example, a stream in which an identification code of a complexity ratio, coded chrominance data, and coded luminance data are packed is transferred from the memory 409 and stored.
[0206] That is, streams in which data of multiple components constituting an image, such as luminance, chrominance, red, green, blue, and transparency, are encoded are stored in the request buffer 610. At this time, the preprocessor 620 performs request control based on control information input to the local buffer 650 to prioritize the streams of each component required to generate an output image and store them in the request buffer 610.
[0207] The stream stored in the request buffer 610 is input to the preprocessor 620. For example, a stream in which an identification code of a complexity ratio, encoded chrominance data, and encoded luminance data are packed is input to the preprocessor 620. In this case, the preprocessor 620 determines the target code amount of the luminance data and the target code amount of the chrominance data according to the identification code of the complexity ratio by code separation shown in FIG.
[0208] For example, the target code amount of luminance data and the encoded luminance data are input to a decoding engine 631. Furthermore, the target code amount of chrominance data and the encoded chrominance data are input to a decoding engine 632. The pre-processor 620 (code separation) may derive the target code amount of luminance data and the target code amount of chrominance data from the identification code of the complexity ratio by, for example, referring to a look-up table such as that shown in FIG. 22A. Then, the decoding engines 631 and 632 decode (expand) the data of each component corresponding to the image before encoding and input it to a post-processor 640.
[0209] The post-processor 640 converts the data of each component of the decompressed image into an arbitrary transfer unit and stores it in the local buffer 650 .
[0210] As described above, data for each component of the decompressed image is input to the local buffer 650. The local arbiter 651 acquires control information, arbitrates access to the local buffer 650 in accordance with the control information, and generates and outputs an image to be output for each block.
[0211] The series of processes performed by the image decompressors 403 and 407 makes it possible to efficiently decompress the compressed stream and convert it into an image.
[0212] Fig. 26 shows the image quality evaluation results. Fig. 26 shows the average PSNR and worst PSNR of multiple blocks in each of 12 types of images when the target code amount is fixed and when the target code amount is variable and determined according to feature amounts. PSNR is the peak signal-to-noise ratio, and a higher PSNR indicates less noise. In Fig. 26, underlined values correspond to PSNRs of less than 30 dB.
[0213] The feature values of the luminance data and the feature values of the chrominance data differ depending on the type of image and the block. Therefore, by determining the target code amount in accordance with the feature values, extreme deterioration of image quality is suppressed. In particular, by determining the target code amount in accordance with the feature values, the worst PSNR for luminance is improved. Accordingly, although the worst PSNR for chrominance deteriorates, it is maintained at 27 dB or higher, which is an acceptable level based on the characteristics of human vision.
[0214] Therefore, by determining the target code amount in accordance with the feature amount, noise such as mosquito noise is suppressed, and subjective deterioration of image quality is suppressed.
[0215] Here, two components, luminance and chrominance, are primarily used as the multiple components that make up a pixel, but three components, red, green, and blue, corresponding to RGB, may also be used. Furthermore, in addition to the three components, red, green, and blue, a transparency (alpha) component may also be used to blend multiple images. The four components, red, green, blue, and transparency, correspond to RGBA. Even in such cases, determining the target code amount according to the feature amount can prevent significant loss of features.
[0216] Furthermore, the feature amount typically corresponds to the complexity, but may also correspond to the magnitude of the feature, not limited to the complexity.
[0217] As described above, the image coding device 200 includes the feature amount extractor 240 , the target code amount determiner 250 , the frequency converter 210 , the quantizer 220 , and the coder 230 .
[0218] The feature amount acquirer 240 acquires, for each component constituting a pixel of an image, a feature amount of data of that component in a target block among a plurality of blocks of the image. The target code amount determiner 250 determines, for each component, a target code amount of data of that component in accordance with the feature amount of the data of that component.
[0219] The frequency transformer 210 performs frequency transform on the data of each component. The quantization processor 220 quantizes the data of each component after frequency transform according to a target code amount for the data of that component. The encoder 230 encodes the quantized data of each component.
[0220] This allows the image coding device 200 to adjust the target code amount of the data of each component in accordance with the feature amount of the data of that component. Therefore, the image coding device 200 can prevent a large loss of features. Therefore, the image coding device 200 can prevent deterioration in image quality.
[0221] For example, the multiple components constituting the pixels of an image may include two components: luminance and chrominance. This allows the image encoding device 200 to adjust the target code amount for each of the luminance and chrominance components according to the feature amount of the data of that component. Therefore, the image encoding device 200 can appropriately suppress image quality degradation for an image in which the feature amounts differ between luminance and chrominance.
[0222] Furthermore, for example, the multiple components constituting the pixels of an image may include three components: red, green, and blue. This allows the image encoding device 200 to adjust the target code amount for each of the red, green, and blue components according to the feature amount of the data of that component. Therefore, the image encoding device 200 can appropriately suppress image quality degradation for an image in which the feature amounts differ between red, green, and blue.
[0223] Furthermore, for example, the multiple components constituting an image pixel may include a transparency component. This allows the image encoding device to adjust the target code size of the transparency component (information) data when blending multiple images using RGBA, according to the feature value of the component data. Therefore, the image encoding device 200 can appropriately suppress image quality degradation when blending multiple images. Furthermore, it is possible to suppress the memory capacity required to store the transparency component and the delay that occurs in transmitting that data.
[0224] Furthermore, for example, the feature acquirer 240 may acquire, for each component, a statistical value of the absolute difference between adjacent pixels in the data of that component as a feature of the data of that component. This allows the image encoding device 200 to acquire a feature corresponding to, for example, an abrupt change between adjacent pixels. Therefore, the image encoding device 200 can appropriately adjust the target code amount according to the feature corresponding to, for example, an abrupt change between adjacent pixels.
[0225] Furthermore, for example, the feature acquirer 240 may acquire the feature of the data of each component using a Hadamard transform. This allows the image encoding device 200 to acquire the feature corresponding to the amount of edges, etc., obtained by the Hadamard transform. Therefore, the image encoding device 200 can appropriately adjust the target code amount according to the feature corresponding to the amount of edges, etc.
[0226] Furthermore, for example, the feature acquirer 240 may acquire, for each component, information indicating the feature of the data of that component from a device external to the image encoding device 200. The feature acquirer 240 may then acquire the feature of the data of each component. This allows the image encoding device 200 to acquire the feature without calculating it. Therefore, the image encoding device 200 can reduce the amount of calculation processing.
[0227] Furthermore, for example, the encoder 230 may multiplex, into a stream, an identification code indicating multiple target code amounts determined for multiple components and multiple pieces of data encoded for the multiple components. The encoder 230 may then output the stream. This allows the image encoding device 200 to indicate the target code amount for the data of each component in the stream. Therefore, the image encoding device 200 can support decoding of the data of each component from the stream.
[0228] Furthermore, for example, the quantization processor 220 may determine a scale factor that affects the quantization width for each component according to the target code amount, and then quantize the data of each component according to the scale factor.
[0229] This allows the image coding device 200 to adjust the scale factor used for quantizing the data of each component in accordance with the target code size for that component, thereby enabling the image coding device 200 to appropriately adjust the code size for that component in accordance with the target code size for that component.
[0230] Furthermore, for example, in determining the scale factor, the quantization processor 220 may first initialize the scale factor. Then, the quantization processor 220 may quantize the data according to the scale factor. Then, the quantization processor 220 may obtain a predicted code amount of the data according to the data quantized according to the scale factor. Then, the quantization processor 220 may update the scale factor according to the result of comparing the predicted code amount with the target code amount.
[0231] The quantization processor 220 may then determine the scale factor by repeating the quantization of data, acquisition of the predicted code amount, and update of the scale factor until the predicted code amount matches the target code amount.
[0232] This allows the image coding device 200 to search for and determine a scale factor that matches the predicted code amount with the target code amount, and therefore the image coding device 200 can determine an appropriate scale factor for the target code amount.
[0233] Furthermore, for example, the quantization processor 220 may initially set the scale factor in accordance with the feature of the data, which allows the image encoding device 200 to appropriately initially set the scale factor in the scale factor search, thereby reducing processing delay.
[0234] Furthermore, for example, the quantization processor 220 may update the initial value of the scale factor if the difference between the scale factor determined by repeated updating of the scale factor and the initial value of the scale factor is greater than a threshold. Furthermore, the quantization processor 220 may not need to update the initial value of the scale factor if the difference is equal to or less than the threshold. This allows the image encoding device 200 to update the initial value of the scale factor determined in accordance with the feature amount to an optimal value based on the final scale factor, thereby suppressing processing delays in subsequent processing.
[0235] Furthermore, for example, the quantization processor 220 may increment the count value when the difference between the scale factor determined by repeatedly updating the scale factor and the initial value of the scale factor is greater than a first threshold value, and the quantization processor 220 may not increment the count value when the difference is equal to or less than the first threshold value.
[0236] Furthermore, the quantization processor 220 may update the initial value of the scale factor when the count value is greater than the second threshold value, and may not update the initial value of the scale factor when the count value is equal to or less than the second threshold value.
[0237] This allows the image encoding device 200 to update the initial value of the scale factor determined according to the feature at an appropriate update frequency based on the final scale factor, thereby reducing processing delays in subsequent processing.
[0238] Furthermore, for example, in determining the scale factor, the quantization processor 220 may first initially set a first scale factor. Then, the quantization processor 220 may quantize the data according to the first scale factor. Then, the quantization processor 220 may obtain a first predicted code amount of the data according to the data quantized according to the first scale factor. Then, the quantization processor 220 may update the first scale factor according to a result of comparing the first predicted code amount with a target code amount.
[0239] The quantization processor 220 may then determine the first scale factor by repeating the quantization of data, obtaining the first predicted code amount, and updating the first scale factor until the first predicted code amount matches the target code amount.
[0240] The quantization processor 220 may also determine a second scale factor in accordance with the feature amount of the data. Then, the quantization processor 220 may quantize the data in accordance with the second scale factor. Then, the quantization processor 220 may obtain a second predicted code amount of the data in accordance with the data quantized in accordance with the second scale factor.
[0241] The quantization processor 220 may then determine one of the first scale factor and the second scale factor as the scale factor based on the comparison result between the first predicted code amount and the target code amount and the comparison result between the second predicted code amount and the target code amount.
[0242] This allows the image coding device 200 to determine a scale factor using both the method of searching for a scale factor that matches the predicted code amount to the target code amount and the method of determining a scale factor based on a feature amount. Therefore, the image coding device 200 can prevent a scale factor corresponding to a local solution in the search from being determined as the final scale factor.
[0243] Furthermore, for example, the quantization processor 220 may initially set the first scale factor in accordance with the feature of the data, thereby enabling the image encoding device 200 to appropriately initially set the scale factor in the scale factor search, thereby reducing processing delays.
[0244] Although the image coding device has been described above in accordance with the embodiments, the image coding device is not limited to the embodiments. Modifications conceivable by those skilled in the art may be applied to the embodiments, and multiple components in the embodiments may be combined in any manner.
[0245] For example, a process performed by a specific component in an embodiment may be performed by another component instead of the specific component. Furthermore, the order of multiple processes may be changed, or multiple processes may be performed in parallel. Furthermore, multiple modified examples may be combined and applied. Furthermore, ordinal numbers such as "first" and "second" used in the description may be changed, removed, or newly added as appropriate. These ordinal numbers do not necessarily correspond to a meaningful order, and may be used to identify elements.
[0246] Furthermore, the image coding method including the steps performed by each component of the image coding device may be executed by any device or system. For example, a part or all of the image coding method may be executed by a computer including a processor, a memory, an input / output circuit, etc. In this case, the image coding method may be executed by the computer executing a program for causing the computer to execute the image coding method.
[0247] The above program may also be recorded on a non-transitory computer-readable recording medium such as a CD-ROM.
[0248] Furthermore, each component of the image encoding device may be configured with dedicated hardware, or may be configured with general-purpose hardware that executes the above-mentioned programs, or may be configured with a combination of these. Furthermore, the general-purpose hardware may be configured with a memory in which the programs are recorded and a general-purpose processor that reads and executes the programs from the memory, etc. Here, the memory may be a semiconductor memory or a hard disk, etc., and the general-purpose processor may be a CPU, etc.
[0249] Furthermore, the dedicated hardware may be configured with a memory, a dedicated processor, etc. For example, the dedicated processor may execute the image coding method described above by referring to a memory for recording data.
[0250] Furthermore, each component of the image encoding device may be an electric circuit. These electric circuits may form a single electric circuit as a whole, or each may be a separate electric circuit. Furthermore, these electric circuits may correspond to dedicated hardware, or may correspond to general-purpose hardware that executes the above-mentioned program, etc.
[0251] The present disclosure is useful, for example, in encoding devices that encode images, and is applicable to digital cameras, digital video cameras, digital video recorders, image processing systems, and the like.
[0252] 100, 200 Image encoding device 110, 210 Frequency converter 120, 220 Quantization processor 121, 221 Quantizer 122, 222 Quantization table deriver 123, 223 Scale factor determiner 130, 230 Encoder 240 Feature amount acquirer 250 Target code amount determiner 310 First scale factor determiner 320 Second scale factor determiner 330 Scale factor selector 400 Image processing device 401 Image input device 402, 406 Image compressor 403, 407 Image decompressor 404 Image output device 405 Drawing processor 408 Memory controller 409 Memory 510, 650 Local buffer 511, 651 Local arbiter 520, 620 Preprocessor 531, 532, 533, 534 Encoding engines 540, 640 Post-processors 550, 610 Request buffers 631, 632 Decoding engines
Claims
1. a feature amount acquirer that acquires, for each of a plurality of components constituting a pixel of an image, a feature amount of data of the corresponding component in a processing target block among a plurality of blocks of the image; a target code amount determiner that determines a target code amount of the data of each of the plurality of components in accordance with the feature amount of the data of the component; a frequency converter that performs a frequency conversion on the data of each of the plurality of components; a quantization processor that quantizes the data of each of the plurality of components after frequency conversion in accordance with the target code amount of the data of the corresponding component; and an encoder for encoding the data of each of the plurality of components after quantization. Image encoding device.
2. The plurality of components includes two components, luminance and chrominance. The image encoding device according to claim 1 .
3. The plurality of components includes three components: red, green, and blue. The image encoding device according to claim 1 .
4. The plurality of components includes a transparency component. The image encoding device according to claim 1 .
5. The feature amount acquirer acquires, for each of the plurality of components, a statistical value of an absolute difference between adjacent pixels in the data of the component as the feature amount of the data of the component. The image encoding device according to any one of claims 1 to 4.
6. The feature amount acquirer acquires the feature amount of the data of each of the plurality of components by using a Hadamard transform. The image encoding device according to any one of claims 1 to 4.
7. The feature amount acquirer acquires, for each of the plurality of components, information indicating the feature amount of the data of the component from an external device of the image encoding device, thereby acquiring the feature amount of the data of the component. The image encoding device according to any one of claims 1 to 4.
8. The encoder multiplexes an identification code indicating a plurality of target code amounts determined for the plurality of components and a plurality of pieces of data encoded for the plurality of components into a stream, and outputs the stream. The image encoding device according to any one of claims 1 to 4.
9. The quantization processor determines a scale factor that affects a quantization width for each of the plurality of components in accordance with the target code amount, and quantizes the data of the component in accordance with the scale factor. The image encoding device according to any one of claims 1 to 4.
10. The quantization processor includes: Initializing the scale factor; quantizing said data according to said scale factor; obtaining a predicted code amount of the data according to the data quantized according to the scale factor; updating the scale factor according to a comparison result between the predicted code amount and the target code amount; The scale factor is determined by repeating the quantization of the data, the acquisition of the predicted code amount, and the update of the scale factor until the predicted code amount matches the target code amount. The image encoding device according to claim 9.
11. The quantization processor initially sets the scale factor in accordance with the feature amount of the data. The image encoding device according to claim 10.
12. The quantization processor updates the initial value of the scale factor when a difference between the scale factor determined by repeatedly updating the scale factor and an initial value of the scale factor is greater than a threshold value, and does not update the initial value of the scale factor when the difference is equal to or less than the threshold value. The image encoding device according to claim 11.
13. The quantization processor includes: when a difference between the scale factor determined by repeatedly updating the scale factor and an initial value of the scale factor is greater than a first threshold, a count value is incremented, and when the difference is equal to or less than the first threshold, the count value is not incremented; When the count value is greater than a second threshold value, the initial value of the scale factor is updated, and when the count value is equal to or less than the second threshold value, the initial value of the scale factor is not updated. The image encoding device according to claim 11.
14. The quantization processor includes: Initialize a first scale factor; quantizing the data according to the first scale factor; obtaining a first predicted code amount of the data according to the data quantized according to the first scale factor; updating the first scale factor according to a comparison result between the first predicted code amount and the target code amount; determining the first scale factor by repeating the quantization of the data, the acquisition of the first predicted code amount, and the update of the first scale factor until the first predicted code amount matches the target code amount; determining a second scale factor according to the features of the data; quantizing the data according to the second scale factor; obtaining a second predicted code amount of the data according to the data quantized according to the second scale factor; determining one of the first scale factor and the second scale factor as the scale factor based on a comparison result between the first predicted code amount and the target code amount and a comparison result between the second predicted code amount and the target code amount; The image encoding device according to claim 9.
15. The quantization processor initially sets the first scale factor in accordance with the feature amount of the data. The image encoding device according to claim 14.
16. acquiring, for each of a plurality of components constituting pixels of an image, a feature amount of data of the corresponding component in a processing target block among a plurality of blocks of the image; determining a target code amount of the data of each of the plurality of components in accordance with the feature amount of the data of the component; for each of the plurality of components, performing a frequency transform on the data for that component; quantizing the data of each of the plurality of components after frequency conversion in accordance with the target code amount of the data of the corresponding component; and for each of the plurality of components, encoding the data of the component after quantization. Image encoding method.