Method and apparatus for processing picture having picture height not evenly divisible by slice height and/or slice width not evenly divisible by pixel group width
10523938 ยท 2019-12-31
Assignee
Inventors
Cpc classification
H04N19/115
ELECTRICITY
H04N21/4302
ELECTRICITY
H04N19/184
ELECTRICITY
H04N19/119
ELECTRICITY
H04N19/174
ELECTRICITY
H04N19/44
ELECTRICITY
H04N19/463
ELECTRICITY
H04N5/08
ELECTRICITY
H04N19/46
ELECTRICITY
International classification
H04N19/119
ELECTRICITY
H04N19/44
ELECTRICITY
H04N19/174
ELECTRICITY
H04N21/43
ELECTRICITY
H04N19/184
ELECTRICITY
H04N19/463
ELECTRICITY
Abstract
An image processing method includes: combining a padding region with a picture, wherein any padding pixel included in the padding region is assigned with a predetermined pixel value; and encoding the picture having the padding region combined therewith. For example, the padding region is directly below a bottom edge of the picture. For another example, all of padding pixels included in the padding region have the same pixel value.
Claims
1. An image processing method, comprising: using a first padding rule for setting first padding pixels beyond a right edge of a picture, wherein the first padding rule defines that a pixel value of each padding pixel that is directly to the right of the right edge of the picture depends on a pixel value of a pixel located at the right edge of the picture; using a second padding rule for setting second padding pixels beyond a bottom edge of the picture, wherein the second padding rule is different from the first padding rule, and the second padding rule defines that a pixel value of each padding pixel that is directly below the bottom edge of the picture does not depend on a pixel value of a pixel located at the bottom edge of the picture; encoding the picture having the first padding pixels and the second padding pixels combined therewith; and after a bitstream is generated from encoding a slice of the picture, padding a predetermined bit pattern to the bitstream to ensure that a sum of a size of the bitstream and a size of the predetermined bit pattern is equal to a bit budget allocated to the slice, wherein the slice comprises padding pixels each being one of the second padding pixels.
2. The image processing method of claim 1, wherein any of the second padding pixels is assigned with a predetermined pixel value.
3. The image processing method of claim 2, wherein the predetermined pixel value includes a midpoint sample value for each color component.
4. The image processing method of claim 1, wherein all of the second padding pixels have a same pixel value.
5. An image processing method, comprising: using a first padding rule for setting first padding pixels beyond a right edge of a picture; generating a bitstream from encoding the picture having the first padding pixels combined therewith; using a second padding rule for setting a first predetermined bit pattern and padding the first predetermined bit pattern to the bitstream, wherein the first predetermined bit pattern stands for an encoding result of at least a portion of second padding pixels beyond a bottom edge of the picture, the first predetermined bit pattern is not generated from actually encoding said at least a portion of the second padding pixels, and the second padding rule is different from the first padding rule; and after a specific bitstream generated from encoding a slice of the picture is generated, padding a second predetermined bit pattern to the specific bitstream to ensure that a sum of a size of the specific bitstream and a size of the second predetermined bit pattern is equal to a bit budget allocated to the slice, wherein the slice comprises padding pixels each being one of the second padding pixels.
6. The image processing method of claim 5, wherein any of the second padding pixels is assigned with a predetermined pixel value.
7. The image processing method of claim 6, wherein the predetermined pixel value includes a midpoint sample value for each color component.
8. The image processing method of claim 5, wherein all of the second padding pixels have a same pixel value.
9. An image processing apparatus, comprising: a padding circuit, configured to use a first padding rule for setting first padding pixels beyond a right edge of a picture, and use a second padding rule for setting second padding pixels beyond a bottom edge of the picture, wherein the second padding rule is different from the first padding rule, the first padding rule defines that a pixel value of each padding pixel that is directly to the right of the right edge of the picture depends on a pixel value of a pixel located at the right edge of the picture, and the second padding rule defines that a pixel value of each padding pixel that is directly below the bottom edge of the picture does not depend on a pixel value of a pixel located at the bottom edge of the picture; and an encoding circuit, configured to encode the picture having the first padding pixels and the second padding pixels combined therewith; wherein after a bitstream is generated from encoding a slice of the picture, the encoding circuit is further configured to pad a predetermined bit pattern to the bitstream to ensure that a sum of a size of the bitstream and a size of the predetermined bit pattern is equal to a bit budget allocated to the slice, where the slice comprises padding pixels each being one of the second padding pixels.
10. An image processing apparatus, comprising: a padding circuit, configured to use a first padding rule for setting first padding pixels beyond a right edge of a picture; and an encoding circuit, configured to generate a bitstream from encoding the picture having the first padding pixels combined therewith; wherein the padding circuit is further configured to use a second padding rule for setting a first predetermined bit pattern and pad the first predetermined bit pattern to the bitstream; the first predetermined bit pattern stands for an encoding result of at least a portion of second padding pixels beyond a bottom edge of the picture; the first predetermined bit pattern is not generated from actually encoding said at least a portion of the second padding pixels; and the second padding rule is different from the first padding rule; and wherein after a specific bitstream generated from encoding a slice of the picture is generated, the encoding circuit is further configured to pad a second predetermined bit pattern to the specific bitstream to ensure that a sum of a size of the specific bitstream and a size of the second predetermined bit pattern is equal to a bit budget allocated to the slice, where the slice comprises padding pixels each being one of the second padding pixels.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1)
(2)
(3)
(4)
(5)
(6)
DETAILED DESCRIPTION
(7) Certain terms are used throughout the description and following claims to refer to particular components. As one skilled in the art will appreciate, manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following description and in the claims, the terms include and comprise are used in an open-ended fashion, and thus should be interpreted to mean include, but not limited to . . . . Also, the term couple is intended to mean either an indirect or direct electrical connection. Accordingly, if one device is coupled to another device, that connection may be through a direct electrical connection, or through an indirect electrical connection via other devices and connections.
(8) The present invention proposes applying data compression to a picture and then transmitting a compressed picture over a transmission interface. As the data size/data rate of the compressed picture is smaller than that of the original un-compressed picture, the power consumption of the transmission interface is reduced correspondingly. With regard to the data compression, the present invention proposes adjusting a slice width to a value which is an integer multiple of a pixel group width (e.g., a group size of a one-dimensional group of pixels) and/or assigning a predetermined value to each of padding pixels beyond a picture edge (e.g., a bottom edge of a picture). By way of example, but not limitation, the proposed slice width determination method and/or the proposed padding method may be employed by a coding standard, such as a Video Electronics Standards Association (VESA) display stream compression (DSC), to simply the encoding operation in the encoder side. Further, since each padding pixel beyond the picture edge is assigned with a predetermined value, a bitstream (i.e., a bit pattern) generated from encoding at least a portion (i.e., part or all) of the padding pixels can be known and obtained beforehand. In one exemplary design, no encoding operations (e.g., predictive mode of coding (P-mode) or indexed color history (ICH) coding) are actually applied to at least a portion of the padding pixels, and a predetermined bit pattern generated in advance is directly padded to a bitstream generated from encoding the picture to act as an encoding result of at least a portion of the padding pixels. In another exemplary design, no pixel padding is actually applied to the picture for adding padding pixels beyond the picture edge, and a predetermined bit pattern standing for an encoding result of at least a portion of the padding pixels is directly padded to a bitstream generated from encoding the picture. Further details of the proposed image processing design will be described as below.
(9)
(10) The image processing apparatuses 102 and 104 may be implemented in different chips. Hence, the image processing apparatus 102 generates a bitstream BS to the image processing apparatus 104 through a transmission interface 101. Specifically, the output interface 118 of the image processing apparatus 102 communicates with the input interface 122 of the image processing apparatus 104 according to a protocol of the transmission interface 101.
(11) In one exemplary implementation, the image processing apparatus 102 may be implemented in a camera module, and the image processing apparatus 104 may be implemented in an image signal processor (ISP). The ISP may be part of an application processor (AP). A picture IMG to be processed by the proposed image processing apparatus 102 may be derived from an output of a camera sensor in the camera module. In addition, the transmission interface 101 may be a camera serial interface (CSI) standardized by a Mobile Industry Processor Interface (MIPI).
(12) In another exemplary implementation, the image processing apparatus 100 may be implemented in an application processor (AP), and the image processing apparatus 104 may be implemented in a display driver integrated circuit (DDIC). The picture IMG to be processed by the proposed image processing apparatus 102 may be generated in the AP. In addition, the transmission interface 101 may be a display serial interface (DSI) standardized by a Mobile Industry Processor Interface (MIPI).
(13) The image processing apparatus 102 employs the proposed slice width determination method to determine a final slice width W.sub.S referenced for partitioning the picture IMG into slices to be encoded by the encoding circuit 116. All of the slices in the picture IMG have the same size defined by a slice height H.sub.S and a slice width W.sub.S. Specifically, the picture IMG is partitioned into a plurality of slice rows according to the slice height H.sub.S, where the slice rows are arranged vertically in the picture IMG, and the slice height H.sub.S decides the number of lines (i.e., pixel rows) included in each slice row. Each of the slice rows is partitioned into a plurality of slices according to the slice width W.sub.S, where the slices are arranged horizontally in the slice row. Based on a group size (i.e., a size of a pixel group composed of pixels), each slice is divided into a plurality of pixel groups, each acting as a basic compression unit processed by the encoding circuit 116. For example, each pixel group may be an mn pixel block, where m represents a pixel group height, n represents a pixel group width, and m and n are positive integers. When m=1, each pixel group is a one-dimensional pixel block. When m>1, each pixel group is a two-dimensional pixel block.
(14) In this embodiment, the slice width determination circuit 112 is responsible for calculating the final slice width W.sub.S based on a picture width W.sub.P of the picture IMG, a target number of slices in a slice row NS, and a pixel group width n of each pixel group in each slice. The slice width determination circuit 112 evenly divides the picture width W.sub.P by the target number of slices in one slice row NS to generate an initial slice width W.sub.S (i.e., W.sub.S=W.sub.P/NS). Next, the slice width determination circuit 112 checks if the initial slice width W.sub.S is an integer multiple of the pixel group width n. It should be noted that, when the pixel group is one-dimensional, the pixel group width is a group size of the one-dimensional pixel group.
(15) Consider a case where the initial slice width W.sub.S is an integer multiple of the pixel group width n. The slice width determination circuit 112 sets the final slice width W.sub.S by the initial slice width W.sub.S (i.e., W.sub.S=W.sub.S). When the slice width W.sub.S is used for partitioning the picture IMG into slices, no pixel padding is needed at the right edge of each slice due to the fact that the slice width of each slice is evenly divisible by the pixel group width.
(16) Consider another case where the initial slice width W.sub.S is not an integer multiple of the pixel group width n. If the final slice width W.sub.S is set by the initial slice width W.sub.S and then used for partitioning the picture IMG into slices, pixel padding is needed at the right edge of each slice due to the fact that the slice width of each slice is not evenly divisible by the pixel group width.
(17) To reduce the frequency of performing the pixel padding and simplify the encoding operation, the slice width determination circuit 112 is configured to determine the final slice width W.sub.S by adjusting the initial slice width W.sub.S. For example, when the initial slice width W.sub.S has a first value which is not an integer multiple of the pixel group width n, the slice width determination circuit 112 determines the final slice width W.sub.S by extending the initial slice width W.sub.S to a second value which is an integer multiple of the pixel group size n. The computation of the final slice width W.sub.S may be expressed using the following equation.
(18)
(19) In above equation (1), represents a ceiling function used to find a smallest integer that is not smaller than
(20)
(21) When the final slice width W.sub.S is referenced for partitioning the picture IMG into slices, pixel padding is only needed at the right edge of the last slice (i.e., rightmost slice) in each slice row due to the fact that the slice width of each slice is properly controlled to have a value evenly divisible by the pixel group width.
(22) When the proposed slice width determination method is employed, only the rightmost slice (e.g., Slice_2 in
(23) Besides padding pixel beyond a right edge of a slice/picture, the encoding operation of the picture may need to pad pixel beyond a bottom edge of the picture. All of the slices in the same picture are required to have the same slice height. When a picture height is not evenly divisible by the slice height, padding pixels will be added beyond the bottom edge of the picture.
(24) It is possible that the slice width W.sub.S is not evenly divisible by the pixel group width (e.g., a group size of a one-dimensional group of pixels). Hence, pixel padding is needed at a right edge of such a slice. For example, when the slice SL is one of the slices Slice(H2, V1)-Slice(H2, V4), the right edge of the slice SL is also a right edge of the picture IMG. The rightmost pixel in each line (i.e., pixel row) of the picture IMG is repeated, resulting in padding pixels appended to rightmost slices in slice rows. For another example, when the slice SL is one of the slices Slice(H1, V1)-Slice(H1, V4), the right edge of the slice SL is not the right edge of the picture IMG, and the methods of setting the padding pixels beyond the right edge of the slice SL depend on coding modes of last pixel groups in pixel group rows of the slice SL. Specifically, concerning each line (i.e., pixel row) of the slice SL, one or more padding pixels may be added to the right of the rightmost pixel based at least partly on a coding mode (e.g., P-mode or ICH-mode) of a pixel group to which the rightmost pixel belongs. If the last pixel group is coded in ICH-mode, the index used for the rightmost pixel shall be duplicated to pad the entropy coding unit to have 3 indices. If the last pixel group is coded in P-mode, any residuals that correspond with pixels beyond the right edge of the slice shall be set to zero.
(25) As mentioned above, it is possible that a picture width of the picture IMG is not evenly divisible by a slice height. For clarity and simplicity, the padding pixels beyond the right edge of the picture IMG are not illustrated in
(26) The second padding rule used for setting padding pixels beyond the bottom edge of the picture is different from the first padding rule used for setting padding pixels beyond the right edge of the picture. As mentioned above, the first padding rule defines setting the padding pixels by replicating pixels located at the picture edge (e.g., pixels located at the rightmost/last pixel column of the picture). By way of example, the second padding rule defines using at least one predetermined pixel value (i.e., at least one pre-defined pixel value that is generated in advance) to set the padding pixels. It should be noted that, when the second padding rule is employed, pixel values of padding pixels do not depend on pixel values of pixels located at the picture edge (e.g., pixels located at the bottommost/last pixel row of the picture). It should be noted that the predetermined pixel value would be adjusted according to the bit depth for each color component. For example, the predetermined pixel value would be set as different values for 8-bit and 10-bit color component. Hence, the image processing apparatus 102 may set the padding pixels according to a bit depth indicator. For example, the bit depth indicator may be implemented as a register or implemented by other hardware-based means. In one exemplary implementation, all of padding pixels set by the second padding rule may have the same pixel value. For example, each of the padding pixels included in the padding region 402 may be set by a white pixel. For another example, each of the padding pixels included in the padding region 402 may be set by a black pixel. For yet another example, each of the padding pixels included in the padding region 402 may be set by using a midpoint sample value for each color component. Taking the YCoCg color space for example, each padding pixel with an 8-bit depth for each color component may have the pseudo luminance value Y=0x80, the orange chrominance value Co=0x100, and the green chrominance value Cg=0x100. It should be noted that the midpoint sample value for each color component would be adjusted when the bit depth for each color component changes. Further, different color spaces may have different settings of midpoint sample values for color components. Hence, the image processing apparatus 102 may set the padding pixels according to a color space indicator. For example, the color space indicator may be implemented as a register or implemented by other hardware-based means.
(27) In the present invention, the slice height determination circuit 113 is configured to set the slice height H.sub.S. For example, the slice height H.sub.S may be determined based on a compression ratio CR of a compressed picture generated from encoding the picture IMG, where
(28)
In a case where the picture height H.sub.P is an integer multiple of
(29)
the slice height H.sub.S may be set by an integer multiple of
(30)
Hence, the picture height H.sub.P is still kept as an integer multiple of the slice height H.sub.S. For example, when CR=, the slice height H.sub.S is set by a value 3*K, where K is a positive integer. Consider another case where the picture height H.sub.P is not an integer multiple of
(31)
If pixel padding beyond a bottom edge of a picture is preferred, the slice height H.sub.S may be set by an integer multiple of
(32)
Hence, due to the pixel padding, the extended picture height H.sub.P would be an integer multiple of the slice height H.sub.S. If pixel padding beyond a bottom edge of a picture is not preferred, the picture height H.sub.P is kept as an integer multiple of the slice height H.sub.S. For another example, the slice height H.sub.S may be set based on a condition that
(33)
is an integer.
(34) When a padding region is determined, the padding circuit 114 is configured to assign a predetermined pixel value to any padding pixel included in the padding region. The padding region is beyond a picture edge and added to the picture to ensure that all slices have the same size. For example, the padding region is directly below a bottom edge of the picture IMG. In one preferred embodiment, all of padding pixels included in the padding region have the same pixel value (i.e., the same predetermined pixel value).
(35) With regard to the example shown in
(36) The encoding circuit 116 is configured to encode the picture IMG having padding pixels combined therewith. For example, the padding pixels may include first padding pixels and second padding pixels, where the first padding pixels are located beyond the right edge of the picture IMG and set by the first padding rule, and the second padding pixels are located beyond the bottom edge of the picture IMG and set by the second padding rule. Since the padding region 402 is composed of padding pixels each having a predetermined pixel value, the encoding result of at least a portion (i.e., part or all) of the padding region 402 can be known in advance. In one exemplary design, the encoding circuit 116 directly outputs a predetermined bitstream as an encoding result of at least a portion of the padding region 402, without actually performing the coding operations (e.g., P-mode coding or ICH coding) upon at least the portion of the padding region 402. For example, the predetermined bitstream can be calculated in advance. For another example, the predetermined bitstream is copied from a preceding bitstream generated from actually performing the coding operations (e.g., P-mode coding or ICH coding) upon a preceding portion of the padding region 402. In accordance with the encoding order, the preceding portion of the padding region 402 is processed before at least the portion of the padding region 402.
(37) In a case where all of the padding pixels in the padding region 402 have the same predetermined value, it is easier to compress the padding region 402. The rate controller 117 may apply bit rate control to each compression/encoding operation to ensure that encoded data of a slice satisfies a bit budget allocated to the slice. Hence, the rate controller 117 may allocate less bit budget to the padding region 402 compared to the original picture region. For example, the rate controller 117 may determine a bit budget of one true pixel group line based on a bit budget allocated to the picture IMG and the number of true pixel group lines originally included in the picture IMG. The bit budget of one true pixel group line may be calculated according to the following equation.
(38)
(39) In above equation (2), BB.sub.GL represents the bit budget of one true pixel group line, BB.sub.PIC represents the bit budget allocated to the picture IMG, and N.sub.GL represents the number of true pixel group lines.
(40) The bottommost/last slice row includes true pixel group line(s) originally included in the picture IMG and padding pixel group line(s) in the padding region 402. The bit budget of the bottommost/last slice row may be set according to according to the following equation.
BB.sub.LASTSG=BB.sub.GLN.sub.SGGL+OFFSET;(3)
(41) In above equation (3), BB.sub.LASTSG represents the bit budget of the bottommost/last slice row, N.sub.SGGL represents the number of true pixel group lines in the bottommost/last slice row, and OFFSET represents a bit budget allocated for the padding region 402. It should be noted that the value OFFSET depends on the padding region 402.
(42) Regarding a slice row that is not the bottommost/last slice row, it includes true pixel group lines only, where the number of true pixel group lines is equal to the slice height H.sub.S. The bit budget of a slice row that is not the bottommost/last slice row may be set according to according to the following equation.
BB.sub.SG=BB.sub.GLH.sub.S;(4)
(43) In above equation (4), BB.sub.SG represents the bit budget of a slice that is not the bottommost/last slice row.
(44) Moreover, the encoding circuit 116 may employ a third padding rule for padding a predetermined bit pattern (e.g., 0's) to a specific bitstream generated from encoding a slice of the picture IMG to ensure that a sum of the size of the specific bitstream and a size of the predetermined bit pattern is equal to a bit budget allocated to the slice by the rate controller 117.
(45) The output interface 118 generates the bitstream BS, including at least a first bitstream BS.sub.1 of encoded data of the picture IMG and a second bitstream BS.sub.2 of encoded data of the padding region 402, to the image processing apparatus 104 via the transmission interface 101. For example, the transmission interface 101 may be a display interface or a camera interface. In addition, the image processing apparatus 102 may further transmit information of the slice height H.sub.S and the first picture height (i.e., the original picture height H.sub.P of the picture IMG) to the image processing apparatus 104 via the bitstream BS. The input interface 122 receives the bitstream BS from the transmission interface 101. Hence, the decoding circuit 124 can derive information of the slice height H.sub.S and the first picture height (i.e., the original picture height H.sub.P of the picture IMG) from the bitstream BS received by the input interface 122. When the first picture height is not an integer multiple of the slice height, the decoding circuit 124 determines a second picture height (e.g., the extended picture height H.sub.P of the picture IMG) to be an integer multiple of the slice height, and identifies the second bitstream BS.sub.2 from the bitstream BS according to at least the slice height and the second picture height. Furthermore, the decoding circuit 124 may identify the second bitstream BS.sub.2 with position information. The position information may be determined by pixel coordination information. When decoding process reaches the picture height Hp, then the remaining bitstream is identified as the second bitstream BS.sub.2. Alternatively, when finding that decoding process reaches the last slice row, the decoding circuit 124 identifies decoding process reaches the pixel coordination difference HpHp, and then treats the remaining bitstream as the second bitstream BS.sub.2. The padding region 402 will not be displayed on a display screen. In this embodiment, the decoding circuit 124 is configured to ignore decoding of at least a portion (i.e., part or all) of the second bitstream BS.sub.2 identified from the bitstream BS, thus simplifying the decoding operation in the decoder side.
(46) If there are more than one slice in a slice row, the decoding circuit 124 may have different slice decoding circuit for each slice in a slice row. The bitstream BS is demultiplexed and bitstream portion of each slice is transferred into each slice decoding circuit. Then each slice decoding circuit identifies its own BS.sub.2 portion. In the case that decoding circuit 124 has a slice decoding circuit for decoding more than one slice (i.e., time sharing way). The slice decoding circuit identifies bitstream BS.sub.2 of each slice. In some cases, only bitstream portion of the last slice of the last slice row is identified to simplify the design complexity of the decoding circuit 124.
(47) The bitstream BS may further include a third bitstream of encoded data of another padding region different from the aforementioned padding region directly below the bottom edge of the picture. For example, the another padding region may include padding pixels beyond a right edge of a picture (or a right edge of a slice). The decoding circuit 124 is configured to further identify the third bitstream from the bitstream BS, and decode at least a portion of the third bitstream.
(48) In the exemplary embodiment shown in
(49)
(50) When the picture height H.sub.p of the picture IMG is not evenly divisible by the slice height H.sub.S determined by the slice height determination circuit 113, the padding circuit 514 determines location and size of the padding region 402 beyond the bottom edge of the picture IMG, without actually combining the padding region 402 with the picture IMG. Hence, no padding region beyond the bottom edge of the picture IMG is fed into the encoding circuit 516. As mentioned above, the present invention proposes using the padding region 402 filled with padding pixels each having a predetermined pixel value. The encoding result of at least a portion (i.e., part or all) of the padding region can be known in advance. Hence, the padding circuit 514 employs the second padding rule for setting the predetermined bit pattern (which stands for the encoding result of at least the portion of the padding region), wherein the second padding rule is different from the first padding rule which replicates pixels located at the picture edge (e.g., pixels located at the rightmost/last pixel column of the picture). For example, the predetermined bit pattern that stands for a bitstream of encoded data of a pixel group that each of the pixels has a midpoint sample value for each color component, and the pixel group is encoded by the ICH coding. For another example, the predetermined bit pattern that stands for a bitstream of encoded data of a pixel group that each of the pixels has a midpoint sample value for each color component, and the pixel group is encoded by the P-mode coding. The same objective of generating the bitstream BS, including at least the first bitstream BS.sub.1 of encoded data of the picture IMG and the second bitstream BS.sub.2 of encoded data of the padding region 402, to the image processing apparatus 104 via the transmission interface 101 is achieved.
(51) Similarly, the encoding circuit 516 may employ the aforementioned third padding rule for padding another predetermined bit pattern (e.g., 0's) to a specific bitstream generated from encoding a slice of the picture IMG to ensure that a sum of the size of the specific bitstream and a size of the another predetermined bit pattern is equal to a bit budget allocated to the slice by the rate controller 117.
(52) Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.