Patent ID: 12200210

DETAILED DESCRIPTION

In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the disclosed embodiments. It will be apparent, however, that one or more embodiments may be practiced without these specific details. In other instances, well-known structures and devices are schematically shown in order to simplify the drawing.

FIG.1Aillustrates an encoder according to an exemplary embodiment of the present disclosure.

Referring toFIG.1, an encoder110includes a flag setting module112, a palette table establishing module114, an index map establishing module116, an encoding module118, a storage circuit130and a processor circuit140.

In the present exemplary embodiment, the storage circuit130is configured to store various data, program codes, images for processing, or images being processed. For example, the storage circuit130may be a memory or a hard disk drive (HDD), but the present disclosure is not limited thereto. The processor circuit140is configured to control overall operations of the encoder110. For example, the processor circuit140may be a central processing unit (CPU), a micro-processor, or an embedded controller, which are not particularly limited in the present disclosure. The processor circuit140is coupled to the storage circuit130, and configured to control the flag setting module112, the palette table establishing module114, the index map establishing module116, and the encoding module118to perform an encoding operation.

Under the H.265/HEVC standard, one coding tree unit (CTU) is used as the maximum processing block for encoding the coding unit (CU). The size of the coding tree unit may be set to a 64×64 block. The coding unit block may be less than or equal the block size of the coding tree unit. For instance, the coding unit block is a block of a square having the size of 64×64, 32×32, 16×16 or 8×8. Further, the coding unit block in the exemplary embodiment of the present disclosure has a plurality of pixels, where the unit size of the coding unit block is the pixel. In the present exemplary embodiment, for illustrative convenience, descriptions are made below by using the coding unit block with the block size of 4×4.

In the present exemplary embodiment, the flag setting module112is configured to set a flag for the coding unit block in a palette mode. For example, when colors of the pixels of the coding unit block are all represented by one or more major colors of the coding unit block, the flag setting module112sets the flag corresponding to the coding unit block as a first state value. Otherwise, when the color of at least one pixel among the pixels of the coding unit block is not represented by the one or more major colors of the coding unit block, the flag setting module112sets the flag corresponding to the coding unit block as a second state value. As another example, when the coding unit block does not include an escape pixel, the flag setting module112sets the flag of the coding unit block as the first state value. Otherwise, when the coding unit block includes the escape pixel(s), the flag setting module112sets the flag of the coding unit block as the second state value. It should be noted that, the color as mentioned in the present disclosure is not limited only to be a color composed of one component element but may also refer to a corresponding color composed of multiple component elements, such as a color composed of three component elements as corresponding to a YUV format or a RGB format. The YUV format is configured to compile a color space, in which “Y” represents a luminance (or Luma) component, U and V represent chrominance (Chroma) components, and Y, Cb and Cr are used to describe the component elements thereof. The RGB format is an additive color model configured to add color light of three primary colors (read, green, and blue) in different ratios so as to generate various color light, and R, G, and B are used to describe the component elements thereof.

The palette table establishing module114is configured to establish a palette table corresponding to the coding unit block.

The index map establishing module116is configured to generate an index map corresponding to the coding unit block according to the palette table corresponding to the coding unit block and the colors of the pixels of the coding unit block.

The encoding module118is configured to encode the flag, the palette table, and index map which are corresponding to the coding unit block. An encoding method used by the encoding module118may be completed by using a bypass mode of a context-based adaptive binary arithmetic coding (CABAC) or a context mode of the CABAC.

The encoder110may transmit the encoded flag, the encoded palette table, and the encoded index map to a decoder, or may directly transmit the flag, the palette table, and the index map without encoding to the decoder. In other words, the encoder110may transmit the encoded flag, the encoded palette table, and the encoded index map, or transmit the flag, the palette table, and the index map, which are not encoded, to the decoder. In an exemplary embodiment, the flag, the palette table, and the index map may be transmitted to the decoder by the encoding module118through the bypass mode. In another exemplary embodiment, the flag, the palette table, and the index map are compressed through the context mode before transmitting to the decoder. The encoder110may also encode a bit number of an index value and a pixel value of the escape pixel before transmitting to the decoder, or the encoder110may transmit the bit number of the index value in the palette table and the pixel value of the escape pixel, which are not encoded, to the decoder. In another exemplary embodiment, the flag, the palette table, and the index map may also be encoded through different encoding modes respectively. For example, the encoding module118encodes the flag by using the bypass mode and encodes the palette table and the index map by using the context mode, and the encoder110transmits the encoded flag, the encoded palette table, and the encoded index map to the decoder. In addition, the encoder110may be implemented in an image sending terminal, the decoder may be implemented in an image receiving terminal, and the encoder and the decoder may communicate with each other in a wired or a wireless manner.

FIG.1Billustrates a decoder according to an exemplary embodiment of the present disclosure.

Referring toFIG.1B, a decoder120includes a receiving module122, a flag state determining module124, a decoding module126, a storage circuit150, and a processor circuit160.

The storage circuit150is configured to store various data, program codes, images for processing, or images being processed. For example, the storage circuit150may be a memory or a hard disk, but the present disclosure is not limited thereto. The processor circuit160is configured to control overall operations of the decoder120. In the present exemplary embodiment, the processor circuit160controls the receiving module122, the flag state determining module124, and the decoding module126to complete a decoding operation. For example, the processor circuit160may be a central processing unit, a micro-processor, or an embedded controller, which are not particularly limited in the present disclosure.

Corresponding to the encoder110, the receiving module122of the decoder120, in the palette mode, is configured to receive the flag and the palette table corresponding to the coding unit block transmitted by the encoder110. The decoding module126of the decoder120receives the index map corresponding to the coding unit block. The flag, the palette table, and the index map corresponding to the coding unit block transmitted from the encoder110may be the flag, the palette table, and the index map which are encoded by the CABAC, or may be the flag, the palette table, and the index map corresponding to the coding unit block which are not encoded by the CABAC. Therefore, the receiving module122determines whether the flag corresponding to the coding unit block and the palette table corresponding to the coding unit block are compressed by using the CABAC, and the decoding module126determines whether the index map corresponding to the coding unit block is compressed by using the CABAC. In the present exemplary embodiment, the receiving module122of the decoder120receives the flag and the palette table corresponding to the coding unit block first, and determines whether the flag corresponding to the coding unit block and the palette table corresponding to the coding unit block are compressed by using the CABAC. If the receiving module122determines that the received flag corresponding to the coding unit block and the received palette table corresponding to the coding unit block are compressed by using the CABAC, the receiving module122performs a CABAC decoding on the flag and the palette table, which are encoded by the CABAC, in order to obtain the maximum value of indexes of the palette table. Thereafter, the decoding module126of the decoder120receives the index map. If the decoding module126determines that the index map corresponding to the coding unit block is compressed by using the CABAC, the decoding module126performs the CABAC decoding on the index map corresponding to the coding unit block, which is encoded by the CABAC, according to said maximum value of the indexes. However, the present disclosure is not limited thereto. For example, in another exemplary embodiment, while the receiving module122is receiving the flag and the palette table corresponding to the coding unit block, the decoding module126also receives the index map corresponding to the coding unit block. Therefore, the receiving module122and the decoding module126perform the CABAC decoding on the flag, the palette table, and the index map corresponding to the coding unit block encoded by the CABAC respectively. In another exemplary embodiment, while the receiving module122is performing the CABAC decoding on the flag and the palette table, the decoding module126of the decoder120receives the index map. Later, after the flag and the palette table are decoded by the receiving module122, the decoding module126of the decoder120decodes the received index map.

Herein, similar to the method for encoding used by the encoding module118, the receiving module122and the decoding module126may decode the received flag, the received palette table, and the received index map corresponding to the coding unit block by using the bypass mode of the CABAC or the context mode of the CABAC. In another exemplary embodiment, the receiving module122may also receive the bit number of the index value in the palette table and the pixel value of the escape pixel transmitted by the encoder110. Similarly, if the received data are data encoded by the CABAC, the CABAC decoding is performed. Further, as described above, it is possible that the flag, the palette table, and the index map may be encoded by the different encoding modes, respectively. Therefore, if the flag encoded by using the bypass mode and the palette table encoded by using the context mode are received by the receiving module122and the index map encoded by using the context mode is received by the decoding module126, the receiving module122decodes the received flag by using the bypass mode and decodes the received palette table by using the context mode, and the decoding module126decodes the received index map by using the context mode.

The flag state determining module124is configured to receive the flag corresponding to the coding unit block from the receiving module122, and determine a state value of the received flag corresponding to the coding unit block. For example, when the received flag is the first state value, the flag state determining module124determines that the coding unit block does not include the escape pixel. Accordingly, it can be known that the amount of the indexes of the palette table corresponding to the coding unit block is an amount of the one or more major colors of the coding unit block. Otherwise, when the received flag is the second state value, the flag state determining module124determines that the coding unit block includes the escape pixel. Accordingly, it can be known that the amount of the indexes of the palette table corresponding to the coding unit block is the amount of the one or more major colors of the coding unit block plus one.

As described above, in the present exemplary embodiment, the decoding module126is configured to receive the index map, and the index map transmitted from the encoder110may be the index map encoded by the CABAC or the index map not encoded by the CABAC. If the index map encoded by the CABAC is received by the decoding module126, the decoding module126performs the CABAC decoding on the index map encoded by the CABAC according to the amount of the indexes of the palette table corresponding to the coding unit block determined by the flag state determining module124so as to decode the indexes of the index map. Herein, the decoding module126may perform the decoding by using the bypass mode of the CABAC or using the context mode of the CABAC. In addition, the decoding module126reconstructs the pixels of the coding unit block according to the colors of the pixels of the coding unit block in the palette table and the index values of the index map, so as to restore the coding unit block.

The encoder and the decoder may be implemented in different terminals and the data required by each other may be transmitted via a network, but the present disclosure is not limited thereto. In another exemplary embodiment, the encoder and the decoder may be implemented in the same chip, terminal, or system.

FIG.1Cillustrates an encoding/decoding chip according to an exemplary embodiment of the present disclosure.

Referring toFIG.1C, an encoding/decoding chip100(also known as a system for encoding/decoding) includes a storage circuit102, a processor circuit104, a buffer memory106, the encoder110, and the decoder120.

The storage circuit102is configured to store various data, program codes, images for processing, or images being processed. For example, the storage circuit102may be a memory or a hard disk, but the present disclosure is not limited thereto.

The processor circuit104is configured to control overall operations of the encoding/decoding chip100. For example, the processor circuit104transmits commands to the storage circuit102in order to execute encoding and decoding operation of the encoder110and the decoder120for images. For example, the processor circuit104may be a central processing unit, a micro-processor, or an embedded controller, which are not particularly limited in the present disclosure.

The buffer memory106is coupled to the processor circuit104and configured to temporarily store data. In another exemplary embodiment, the buffer memory106is a static random access memory (SRAM) or other memories, but the present disclosure is not limited thereto. In another exemplary embodiment, the buffer memory106may be a dynamic random access memory (DRAM) or other memories. In another exemplary embodiment, the encoding/decoding chip100may share use of the storage circuit102, the processor circuit104, and/or the buffer memory106with other systems.

The storage circuit102is coupled to the processor circuit104and the buffer memory106. Operations of the encoder110and the decoder120are similar to those of the encoder and the decoder depicted inFIG.1AandFIG.1B. For example, the encoder110includes the flag setting module112, the palette table establishing module114, the index map establishing module116, and the encoding module118. The decoder120includes the receiving module122, the flag state determining module124, and the decoding module126.

The encoder and the decoder in the present disclosure may be implemented by software modules or program codes. For example, the storage circuit102stores the flag setting module112, the palette table establishing module114, the index map establishing module116, the encoding module118, the receiving module122, the flag state determining module124, and the decoding module126as mentioned above. When the encoding/decoding chip100is enabled, the software program codes are loaded from the storage circuit102into the buffer memory106and executed by the processor circuit104in order to run functions of the flag setting module112, the palette table establishing module114, the index map establishing module116, the encoding module118, the receiving module122, the flag state determining module124, and the decoding module126. However, the present disclosure is not limited thereto. For example, in another exemplary embodiment of the present disclosure, the encoding/decoding chip, the encoder, and the decoder may be implemented by hardware circuits. For example, the flag setting module112, the palette table establishing module114, the index map establishing module116, the encoding module118, the receiving module122, the flag state determining module124and the decoding module126may be implemented by hardware circuits to become a flag setting circuit, a palette table establishing circuit, an index map establishing circuit, an encoding circuit, a receiving circuit, a flag state determining circuit, and a decoding circuit. In another exemplary embodiment of the present disclosure, the encoder and the decoder may be implemented by hardware circuits as one chip. In another exemplary embodiment of the present disclosure, the encoder and the decoder may be implemented by hardware circuits as an encoding chip and a decoding chip respectively.

In order to describe the operations of the encoder110, the decoder120, and the encoding/decoding chip100more clearly, an exemplary embodiment is further provided below with reference to the encoding/decoding chip100ofFIG.1C.

FIG.2AandFIG.2Bare schematic diagrams illustrating operations of encoding image according to an exemplary embodiment of the present disclosure. For illustrative convenience, following descriptions are made by using a coding unit block200with the block size of 4×4.

Referring toFIG.2A, in a palette mode, the encoder110searches for one or more major colors to represent pixels within the coding unit block200currently under encoding, and uses indexes corresponding to the one or more major colors to perform index numbering for the pixels within the coding unit block.

For instance, the palette table establishing module114establishes a palette table corresponding to the coding unit block200so that the index map establishing module116may generate an index map corresponding to the coding unit block according to the palette table corresponding to the coding unit block200and the colors of the pixels of the coding unit block. In the operation of establishing the palette table corresponding to the coding unit block200, the palette table establishing module114selects the one or more major colors corresponding to the coding unit block200according to the colors of the pixels of the coding unit block200. In the present exemplary embodiment, colors corresponding to pixel values (i.e., “10”, “11”, “100”, “200”, and “255”) from each of original pixels of the coding unit block200are represented by a color C1, a color C2, a color C3, a color C4, and a color C5, respectively. In one embodiment, a value of the color C1 is the pixel value “10”, and similarly, values of the color C2, the color C3, the color C4, and the color C5 are the pixel values “11”, “100”, “200”, and “255”, respectively; whereas in another embodiment, the color C1, the color C2, the color C3, the color C4, and the color C5 may be obtained by encoding the pixel values “10”, “11”, “100”, “200”, and “255” based on actual requirements. Because the colors of the color C1 and the color C2 are similar (e.g., a difference between the pixel values of the pixels of the color C1 and color C2 is less than a color difference threshold (e.g., the color difference threshold is set to be 5)), the palette table establishing module114only selects the color C1 as the major color corresponding to the pixels with the pixel value being “10” and the pixels with the pixel value being “11”. Lastly, the major colors corresponding to the coding unit block200selected by the palette table establishing module114are the color C1, the color C3, the color C4, and the color C5.

Referring toFIG.2B, subsequently, the palette table establishing module114sets the index values corresponding to the major colors. For example, the palette table establishing module114uses numbers 0, 1, 2, and 3 as the index values corresponding to the major colors C1, C3, C4, and C5 respectively according to the previously selected major colors C1, C3, C4, and C5.

In the present exemplary embodiment, because the colors of the pixels of the coding unit block200may all be represented by the major colors of the coding unit block200without including the escape pixel, the flag setting module112sets the flag corresponding to the coding unit block200as the first state value. For example, the first state value is represented by the Boolean value, and the flag setting module112sets the first state value as “0”. Accordingly, the palette table establishing module114may determine that the coding unit block200does not include the escape pixel according to the first state value of the flag, and set the amount of the indexes of the palette table corresponding to the coding unit block200as an amount of the major colors of the coding unit block200.

FIG.3is a schematic diagram illustrating a palette table according to an exemplary embodiment of the present disclosure.

Referring toFIG.3, in the present exemplary embodiment, as described above, the colors of the pixels of the coding unit block200may all be represented by the major colors of the coding unit block200. Accordingly, the palette table establishing module114sets the amount of the indexes of the palette table corresponding to the coding unit block200as the amount of the one or more major colors of the coding unit block200. For example, the amount of the major colors of the coding unit block200is four (i.e., the major colors C1, C3, C4, and C5). Therefore, as shown inFIG.3, the palette table establishing module114sets the amount of the indexes of a palette table300corresponding to the coding unit block200as an exact size for recording the four major colors. Further, the palette table establishing module114records the major colors (i.e., the major colors C1, C3, C4, and C5, and the pixel values thereof are “10”, “100”, “200”, and “255”, respectively) and the index values (i.e., 0 to 3) corresponding to the major colors into a color field304and an index value field302respectively.

In the present exemplary embodiment, the maximum value (i.e., 3) among the index values of the major colors in the palette table300is the amount of the major colors corresponding to the coding unit block200minus one. Further, the amount of the major colors corresponding to the coding unit block200is equal to a total number of the index values of the major colors recorded in the palette table300. In other words, when the colors of the pixels of the coding unit block200may all be represented by the major colors of the coding unit block200, it indicates that the coding unit block200currently under encoding does not include the escape pixel. Thus, in this case, the palette table300established by the palette table establishing module114does not reserve fields for an escape index corresponding to the escape pixel in order to reduce the encoded bit number of the index value, such that a redundant bit transmission may be avoided to reduce unnecessary waste during the transmission of the indexes. In the present exemplary embodiment, for clear descriptions, the color field304is represented in a manner of “the major color: the pixel value” (e.g., C1:10, C3:100, C4:200, and C5:255). In one embodiment, the color field304includes the pixel values “10”, “100”, “200”, and “255”.

FIG.4illustrates an example for establishing an index map according to an exemplary embodiment of the present disclosure.

Referring toFIG.4, thereafter, the index map establishing module116may perform the index numbering on the pixels in the coding unit block200according to the index values “0”, “1”, “2”, and “3” corresponding to the major colors C1, C3, C4, and C5 in order to generate an index map400. In other words, in the index map400, the colors of the pixels of the coding unit block200are represented by the index values “0”, “1”, “2”, and “3” corresponding to the major colors C1, C3, C4, and C5.

Subsequently, the encoding module118encodes the flag, the palette table300and the index map400corresponding to the coding unit block200by the CABAC before transmitting to the decoder120, or directly transmits the flag, the palette table300and the index map400corresponding to the coding unit block200to the decoder120.

Specifically, in the present exemplary embodiment, the palette table establishing module114is not forced to reserve the fields for the escape index, and there are four index values since the amount of the major colors of the coding unit block200is four. Herein, it is assumed that a fixed length encoding method is used in the present exemplary embodiment, and thus only two bits are required to encode the four index values. For example, with the index values corresponding to the major colors C1, C3, C4, and C5 being “0”, “1”, “2”, and “3” respectively, the index map establishing module116may use “00”, “01”, “10”, and “11” in binary numeral system to encode the four index values, and record “00”, “01”, “10”, and “11” in binary numeral system into the index map. In view of the above, in the situation where the escape index is forced to be reserved, because the amount of the index values is increased to five, three bits are required to encode the five index values. Accordingly, the method for encoding of the present exemplary embodiment is capable of saving one bit each time when the index value of one pixel is transmitted. In the present embodiment, because the size of the coding unit block200is 4×4, the size of the index map400corresponding to the coding unit block200is also 4×4. In the case where the compression and other processes are not performed, a transmission amount of sixteen bits may be saved while transmitting the index values of a 4×4 number of pixels.

FIG.5is a flowchart illustrating an encoding method according to an exemplary embodiment of the present disclosure.

Referring toFIG.5, in step S501, the encoder110sets a flag for a coding unit block in a palette mode.

In step S503, the encoder110determines whether colors of pixels of the coding unit block are all represented by one or more major colors of the coding unit block.

In step S505, if the colors of the pixels of the coding unit block are all represented by the one or more major colors of the coding unit block, the encoder110sets the flag corresponding to the coding unit block as a first state value. Otherwise, in step S507, if the color of at least one pixel among the pixels of the coding unit block is not represented by the one or more major colors of the coding unit block, the flag corresponding to the coding unit block is set as a second state value.

Subsequently, in step S509, the encoder110establishes a palette table corresponding to the coding unit block according to a state value of the flag and the one or more major colors.

In step S511, the encoder110generates an index map corresponding to the coding unit block according to the palette table corresponding to the coding unit block and the colors of the pixels of the coding unit block.

Thereafter, in step S513, the encoder110compresses the flag corresponding to the coding unit block, the palette table corresponding to the coding unit block, and the index map corresponding to the coding unit block by using a CABAC, and transmits the compressed flag corresponding to the coding unit block, the compressed palette table corresponding to the coding unit block, and the compressed index map to a decoder of the decoding end, or the decoder120of the encoding/decoding chip100. Alternatively, the encoder110transmits the non-compressed flag corresponding to the coding unit block, the non-compressed palette table corresponding to the coding unit block, and the non-compressed index map corresponding to the coding unit block to the decoder of the decoding end or the decoder120of the encoding/decoding chip100. Herein, the CABAC compressing may be performed by using the bypass mode of the CABAC or the context mode of the CABAC. In another exemplary embodiment, the encoder110compresses the flag corresponding to the coding unit block, the palette table corresponding to the coding unit block, and the index map corresponding to the coding unit block by using the CABAC before transmitting to a storage medium for storage. Alternatively, the encoder110transmits the non-compressed flag corresponding to the coding unit block, the non-compressed palette table corresponding to the coding unit block, and the non-compressed index map corresponding to the coding unit block to the storage medium for storage. The storage medium may be the storage circuit130of the encoder110, the storage circuit102of the encoding/decoding chip100, another storage medium at the encoding end (e.g., a hard disk), or even another storage medium not at the encoding end (i.e., a cloud hard disk).

In the present exemplary embodiment, when the flag corresponding to the coding unit block200and the palette table300corresponding to the coding unit block200are received by the receiving module122of the decoder120, if the received flag corresponding to the coding unit block200and the palette table300corresponding to the coding unit block200are data encoded by the CABAC, the receiving module122performs the CABAC decoding first. For example, if the received flag corresponding to the coding unit block200is compressed by using the bypass mode of the CABAC or the context mode of the CABAC, the receiving module122correspondingly uses the bypass mode of the CABAC or the context mode of the CABAC in order to decompress the flag corresponding to the coding unit block200; and similarly, if the received palette table300corresponding to the coding unit block200is compressed by using the bypass mode of the CABAC or the context mode of the CABAC, the receiving module122correspondingly uses the bypass mode of the CABAC or the context mode of the CABAC in order to decompress the palette table300corresponding to the coding unit block200. Thereafter, the flag state determining module124determines the state value of the flag corresponding to the coding unit block200. For example, in the present exemplary embodiment, the flag state determining module124determines that the received flag is set as the first state value (e.g., “0”). Accordingly, the flag state determining module124may determine that the coding unit block200does not include the escape pixel, and determine that the amount of the indexes of the palette table300corresponding to the coding unit block200is the amount of the major colors of the coding unit block. In another embodiment, the flag state determining module124may determine that the received flag is set as the second state value (e.g., “1”). Accordingly, the flag state determining module124may determine that the coding unit block200includes the escape pixel, and determine that the amount of the indexes of the palette table300corresponding to the coding unit block200is the amount of the major colors of the coding unit block plus one.

Subsequently, the decoding module126receives the index map400. If the received index map400is encoded by the CABAC, the decoding module126performs the CABAC decoding first. For example, if the received index map400corresponding to the coding unit block200is compressed by using the bypass mode of the CABAC or the context mode of the CABAC, the decoding module126correspondingly uses the bypass mode of the CABAC or the context mode of the CABAC to decompress the index values of the index map400corresponding to the coding unit block200according to the amount of the indexes of the palette table300corresponding to the coding unit block200. Thereafter, the decoding module126reconstructs the coding unit block200. Specifically, the decoding module126searches the palette table300according to the index values of the pixels of the index map400(e.g., by using a look-up table), and the pixel value represented by the major color corresponding to the matched index value is the pixel value of the pixel in the coding unit block200. For example, if the index value of one of the pixels in the index map400is “0”, in the palette table300, the major color corresponding to the index value being “0” is C1, and the pixel value thereof is “10”. Therefore, the decoding module126reconstructs that pixel value of the coding unit block200as “10”. And then, by analogy, the decoding module126reconstructs the pixels of the coding unit block200one by one, so as to reconstruct the coding unit block200. In the present exemplary embodiment, the decoder120receives the flag, the palette table300, and the index map400transmitted from the encoder110of the encoding/decoding chip100or the encoder of the encoding end. In another exemplary embodiment, the decoder120may receive the flag, the palette table300, and the index map400transmitted from a storage medium. The storage medium may be the storage circuit150of the decoder120, the storage circuit102of the encoding/decoding chip100, another storage medium at the decoding end (e.g., a hard disk), or even another storage medium not at the decoding end (i.e., a cloud hard disk).

FIG.6Aillustrates a program code for decoding the flag corresponding to the coding unit block, the palette table corresponding to the coding unit block, and the index map corresponding to the coding unit block by using the CABAC according to an exemplary embodiment of the present disclosure. Referring toFIG.6A, in this exemplary embodiment, it is assumed that the decompressing method used for the flag, the palette table, and the index map currently under decoding is the bypass mode of the CABAC. Herein, as shown inFIG.6A, the bypass mode is represented by a parameter “decodeBinEP”, an action for performing the CABAC decoding is represented by “parse”, the palette mode is represented by a parameter “PLTMode”, the amount of the major colors and the major colors are represented by parameters “PLTSize” and “PLT” respectively, the maximum value of the indexes of the palette table is represented by a parameter “uiIndexMaxSize”, and the flag is represented by a parameter “uiSignalEscape”.

Referring back toFIG.6A, in a process601, the decoder120confirms whether a current decoding mode is the palette mode. If it is determined that the palette mode is currently used, the decoder120decodes the amount of the major colors and the major colors by using the CABAC in a process602. Subsequently, in a process603, a value of the variable “uiIndexMaxSize” is set as the amount of the major colors.

In a process604, the decoder120decodes the flag by using the bypass mode of the CABAC. Herein, if the decoder120determines that the state value of the flag corresponding to the coding unit block200is “1” in a process605, the decoder120may determine that the coding unit block currently under decoding includes the escape pixel. Therefore, in a process606, the decoder120further sets the amount of indexes (i.e., “uiIndexMaxSize”) of the palette table corresponding to the coding unit block as the amount of the major colors of the coding unit block plus one. In this case, the index values that fall within a range from “0” to “uiIndexMaxSize minus 2” are all the indexes of the major colors, and the index value being “uiIndexMaxSize minus one” is the index of the escape pixel.

Thereafter, in a process607, the decoder120decodes the indexes within the index map. In this exemplary embodiment, because the coding block unit currently under decoding includes the escape pixel, the decoder120decodes the pixel value of the escape pixel in a process608. Accordingly, the decoder120may reconstruct the coding unit block by decoding and reconstructing each of the pixels in the coding unit block currently under decoding.

FIG.6B-1andFIG.6B-2are a flowchart illustrating a method for decoding according to an exemplary embodiment of the present disclosure.

Referring toFIG.6B-1andFIG.6B-2, in step S601, the decoder120receives a flag corresponding to a coding unit block and a palette table corresponding to the coding unit block.

In step S603, the decoder120determines whether the flag corresponding to the coding unit block and the palette table corresponding to the coding unit block are compressed by using a CABAC.

If the received flag corresponding to the coding unit block and the received palette table corresponding to the coding unit block are compressed by using the CABAC, the decoder120decompresses the flag and the palette table corresponding to the coding unit block by using the bypass mode of the CABAC or the context mode of the CABAC in step S605. Otherwise, if the received flag corresponding to the coding unit block and the palette table corresponding to the coding unit block are not compressed by using the CABAC, proceeding to step S607. In the present exemplary embodiment, the decoder120determines whether the flag corresponding to the coding unit block and the palette table corresponding to the coding unit block are compressed by using the CABAC. In another exemplary embodiment, the decoder120does not determine whether the received flag corresponding to the coding unit block and the received palette table corresponding to the coding unit block are compressed by using the CABAC, but directly decompresses the flag and the palette table corresponding to the coding unit block by using the bypass mode of the CABAC or the context mode of the CABAC. In other words, after step S601, proceeding to step S605instead of step S603. In an exemplary embodiment, the encoder110and the decoder120may determine whether to compress or decompress by using the bypass mode or the context mode of the CABAC based on settings, or may determine whether to compress or decompress by using the bypass mode of the CABAC or the context mode of the CABAC based on a communication (e.g., information exchange) between the encoder110and the decoder120.

In step S607, the decoder120determines whether a state value of the flag corresponding to the coding unit block is the first state value or the second state value in the palette mode.

If the flag is the first state value, in step S609, the decoder120determines that an amount of the indexes of the palette table corresponding to the coding unit block is an amount of the one or more major colors of the coding unit block.

If the flag is the second state value, in step S611, the decoder120determines that the amount of the indexes of the palette table corresponding to the coding unit block is the amount of the one or more major colors of the coding unit block plus one.

Subsequently, in step S613inFIG.6B-2, the decoder120receives the index map corresponding to the coding unit block, and determines whether the index map corresponding to the coding unit block is compressed by using the CABAC.

If the received index map corresponding to the coding unit block is compressed by using the CABAC, in step S615, the decoder120decompresses the index map corresponding to the coding unit block according to the amount of the indexes of the palette table by using the bypass mode or the context mode in order to obtain a plurality of index values of the index map. Otherwise, if the received flag corresponding to the coding unit block and the palette table corresponding to the coding unit block are not compressed by using the CABAC, in step S617, the decoder120decodes the index map corresponding to the coding unit block according to a value of the amount of the indexes of the palette table in order to obtain the index values of the index map. In another embodiment, after the index map corresponding to the coding unit block is received, the decoder120does not determine whether the index map corresponding to coding unit block is compressed by using the CABAC but directly decompresses the index map corresponding to the coding unit block according to the value of the amount of the indexes of the palette table by using the bypass mode or the context mode in order to obtain the index values of the index map. In other words, after the index map is received in step S613, proceeding to step S615without determination, and not proceeding to step S617. In an exemplary embodiment, the encoder110and the decoder120may determine whether to compress or decompress by using the bypass mode or the context mode of the CABAC based on settings, or may determine whether to compress or decompress by using the bypass mode of the CABAC or the context mode of the CABAC based on a communication (e.g., information exchange) between the encoder110and the decoder120.

Thereafter, in step S619, the decoder120reconstructs the coding unit block according to the colors of the pixels of the coding unit block in the palette table and the index values of the index map.

It is worth mentioning that, in another exemplary embodiment of the present disclosure, the flag corresponding to the coding unit block, the palette table corresponding to the coding unit block, and the index map corresponding to the coding unit block may also be received by the decoder120at the same time, and then decoded by the decoder120.

In another exemplary embodiment of the present disclosure, the encoder may use the escape pixel to replace a part of the pixels corresponding to the major colors in order to reduce the amount of the transmitted bits.

FIG.7AandFIG.7Bare schematic diagrams illustrating operations of encoding image according to another exemplary embodiment of the present disclosure.

Referring toFIG.7A, in the present exemplary embodiment, in the operation of establishing the palette table corresponding to the coding unit block200, the palette table establishing module114selects one or more candidate colors corresponding to the coding unit block200according to the colors of the pixels of the coding unit block200. Specifically, pixel values (i.e., “10”, “11”, “100”, “200”, and “255”) of original pixels of the coding unit block200are represented by a color C1, a color C2, a color C3, a color C4 and, a color C5, respectively. In one embodiment, a value of the color C1 is the pixel value “10”, and similarly, the values of the color C2, the color C3, the color C4, and the color C5 are the pixel values “11”, “100”, “200”, and “255”, respectively; whereas in another embodiment, the color C1, the color C2, the color C3, the color C4, and the color C5 may be obtained by encoding according to the pixel values “10”, “11”, “100”, “200”, and “255” based on requirements. Because the colors of the color C1 and the color C2 are similar (e.g., a difference between the pixel values of the pixels of the color C1 and color C2 is less than a color difference threshold (e.g., the color difference threshold is the palette table establishing module114selects the color C1 as the candidate color corresponding to the pixels of the pixel value being “10” and the pixel value being “11”. Therefore, the candidate colors corresponding to the coding unit block200selected by the palette table establishing module114are the color C1, the color C3, the color C4, and the color C5, respectively.

Subsequently, according to the candidate colors C1, C3, C4, and C5, the palette table establishing module114quantifies the pixels corresponding to the pixel value being “10” and the pixel value being “11” to the candidate color C1, quantifies the pixels corresponding to the pixel value being “100” to the candidate color C3, quantifies the pixels corresponding to the pixel value being “200” to the candidate color C4, and quantifies the pixels corresponding to the pixel value being “255” to the candidate color C5.

In the present exemplary embodiment, the palette table establishing module114sets the candidate colors as the one or more major colors and the escape pixel respectively according to the pixel values of the candidate colors. For instance, the palette table establishing module114selects and sets the one or more major colors corresponding to the coding unit block200according to an amount threshold. For example, when a pixel amount of one specific candidate color is greater than the amount threshold, the specific candidate color is set as one major color; whereas when the pixel amount of one specific candidate color is less than or equal to the amount threshold, the pixel(s) of the specific candidate color is set as escape pixel(s). In the present exemplary embodiment, it is assumed that the amount threshold is 2, and the amount of the pixels corresponding to the color C1 (i.e., 11) is greater than the amount threshold. Therefore, the palette table establishing module114selects the candidate color C1 as the major color C1 corresponding to the coding unit block200, and a value of the major color C1 may be the pixel value “10” or an encoding value corresponding thereto.

An amount of the pixels corresponding to the candidate color C3 (i.e., 2) is equal to the amount threshold, an amount of the pixels corresponding to the candidate color C4 (i.e., 2) is equal to the amount threshold, and an amount of the pixels corresponding to the candidate color C5 (i.e., 1) is less than the amount threshold. Accordingly, the palette table establishing module114sets the pixels corresponding to the candidate colors C3, C4, and C5 as escape pixels CEscape.

In view of the above, in the present exemplary embodiment, the amount of the pixels of the candidate colors quantified to the major colors is greater than the amount threshold (i.e., 2), and the amount of the pixels of the candidate colors quantified to the escape pixel CEscapeis not greater than the amount threshold. It is worth mentioning that, the color difference threshold and the amount threshold are not particularly limited in the present disclosure. For example, in another exemplary embodiment, the color difference threshold and the amount threshold may be dynamically adjusted with quantified parameters in the encoding computation.

Referring toFIG.7B, subsequently, the palette table establishing module114sets index values corresponding to the major color C1 and corresponding to the escape pixel CEscape, respectively. For example, the palette table establishing module114use numbers 0 and 1 as the index values corresponding to the major color C1 and corresponding to the escape pixel CEscaperespectively.

In the present exemplary embodiment, because the color of at least one pixel of the coding unit block200is not represented by the one or more major colors of the coding unit block200, the flag setting module112sets the flag corresponding to the coding unit block200as the second state value. For example, the second state value is represented by the Boolean value, and the flag setting module112sets the flag as “1” when the color of the at least one pixel of the coding unit block200is not represented by the one or more major colors of the coding unit block200. Accordingly, the palette table establishing module114may determine that the coding unit block200includes the escape pixel according to the second state value of the flag, and set the amount of the indexes of the palette table corresponding to the coding unit block200as the amount of the major colors of the coding unit block200plus one.

FIG.8is a schematic diagram illustrating a palette table according to another exemplary embodiment of the present disclosure.

Referring toFIG.8, in the present exemplary embodiment, the colors of the pixels of the coding unit block200are not all represented by the major colors of the coding unit block200. Accordingly, the palette table establishing module114sets the amount of the indexes of the palette table corresponding to the coding unit block200as the amount of the one or more major colors of the coding unit block200plus one. For example, the amount of the major colors of the coding unit block200is 1 (i.e., the major color C1). Therefore, as shown inFIG.8, the palette table establishing module114sets the amount of the indexes of a palette table800corresponding to the coding unit block200as2. Further, the palette table establishing module114records this major color C1 and the index value corresponding to this major color (i.e., 0) into a color field804and an index value field802in a first row810in the palette table800respectively, and records the index value corresponding to the escape pixel CEscape(i.e., 1) into the index value field802in a second row820of the palette table800. Further, in the palette table800, the palette table establishing module114sets a maximum value among the index values as the amount of the major colors corresponding to the coding unit block. For example, the maximum value among the index values (i.e., 1) is the amount of the major colors (i.e., the major color C1) corresponding to the coding unit block200. Further, the amount of the major colors corresponding to the coding unit block200plus one (i.e., 2) is equal to a total number of the index values of the major colors recorded in the palette table800plus one.

FIG.9illustrates an example for establishing an index map according to another exemplary embodiment of the present disclosure.

Referring toFIG.9, thereafter, the index map establishing module116may use the palette mode to perform the index numbering on the pixels in the coding unit block200according to the index value corresponding to the major color C1 (i.e., 0) and the index value corresponding to the escape pixel CEscape(i.e., 1) in order to generate an index map900. In other words, each of the colors of the pixels of the coding unit block200in the index map900is represented by the index values “0” and “1” corresponding to the major color C1 and the escape pixel CEscape. In an exemplary embodiment, referring toFIG.8andFIG.9together, the pixel values of the pixels having the index values set as “1” (i.e., the escape pixel CEscape) are transmitted to the decoding end in a traditional manner. As such, it is not required to set the color field804in the second row820inFIG.8to a specific pixel value.

Subsequently, the encoding module118encodes the flag, the palette table800, and the index map900by the CABAC before transmitting to the decoder120, or transmits the flag, the palette table800and the index map900to the decoder120. In the present exemplary embodiment, the encoding module118further transmits the pixel values of the original pixels corresponding to the colors C3, C4, and C5 belonging to the escape pixel CEscapeto the decoder120. However, the present disclosure is not limited thereto. For example, in another exemplary embodiment, the palette table800transmitted by the encoding module118includes the major colors and the index values thereof (e.g., the first row810of the palette table800in the present exemplary embodiment) but not including the corresponding field of the escape pixel (e.g., the second row820of the palette table800in the present exemplary embodiment); and in another exemplary embodiment, the palette table800transmitted by the encoding module118includes the major colors (e.g., the color field804in the first row810of the palette table800in the present exemplary embodiment) but not including the index values (e.g., the index value field802in the first row810of the palette table800in the present exemplary embodiment) nor the corresponding fields of the escape pixel, so that the decoding end may determine the index based on the settings or a protocol with the encoding end when the major colors are received. For example, the index value of the first received major color is “0”, the index value of the second received major color is “1”, and the rest may be deduced by analogy.

Specifically, in the present exemplary embodiment, the palette table establishing module114uses the escape pixel to replace the part of pixels which can be represented by the major colors, so that there is only one index corresponding to the major color of the coding unit block200and one escape index in the present exemplary embodiment. Accordingly, only two index values are to be transmitted to the decoder120. Herein, it is assumed that the fixed length encoding method is used, so that said two index values may be encoded by using one bit. For example, if the index values corresponding to the major color C1 and the escape pixel CEscapeare “0” and “1” respectively, the index map establishing module116may encode the two index values by using the “0” and “1” in binary system, and record the “0” and “1” in binary system into the index map. In the case where the escape index is forced to be reserved and not using the scheme of changing the pixels of the major colors to the escape pixel, five index values are to be encoded by using three bits. In other words, by using the encoding method of the present exemplary embodiment, the encoding module118is capable of saving two bits each time when the index value of one pixel is transmitted. In the present embodiment, because the size of the coding unit block200is 4×4, the size of the index map400corresponding to the coding unit block200is also 4×4. In the case where the compression and other processes are not performed, a transmission amount of thirty-two bits may be saved when transmitting the index values of a 4×4 number of pixels.

On the other hand, when the flag corresponding to the coding unit block200and the palette table800corresponding to the coding unit block200are received (and decoded) by the receiving module122of the decoder120, the flag state determining module124determines the state value of the flag corresponding to the coding unit block200. For example, in the exemplary embodiment, the flag state determining module124determines that the received flag is set as the second state value (e.g., “1”). Accordingly, the flag state determining module124determines that the coding unit block200includes the escape pixel, and determines that the amount of the indexes of the palette table800corresponding to the coding unit block200is the amount of the major colors of the coding unit block plus one.

Subsequently, the decoding module126decodes the index map900by using the CABAC according to the amount of the indexes and reconstructs the coding unit block200. More specifically, after the index map900is decoded, the decoding module126searches the palette table800according to the index values of the pixels of the index map900(e.g., by using a look-up table), and the pixel value represented by the major color corresponding to the matched index is the pixel value of the pixel in the coding unit block200. For example, if the index value of one of the pixels in the index map900is “0”, in the palette table800, the major color corresponding to the index value being “0” is C1, and the pixel value thereof is “10”. Therefore, the decoding module126reconstructs that pixel value of the coding unit block200as “10”. Further, by analogy, the decoding module126reconstructs the pixels of the coding unit block200one by one, so as to reconstruct the coding unit block200. As another example, the index of the one of the pixels in the index map900is “1” and the escape pixel is represented by the index value being “1”. In this case, the decoding module126reconstructs the coding unit block200according to the received escape pixels one by one in the traditional manner. In addition, in an exemplary embodiment, the received escape pixels are first decoded by the receiving module122(e.g., by using the bypass mode of the CABAC and the context mode of the CABAC).

FIG.10AandFIG.10Bare schematic diagrams illustrating test results obtained from encoding/decoding image according to exemplary embodiments of the present disclosure.

Referring toFIG.10AandFIG.10B, in order to evaluate the method for encoding and the method for decoding as proposed by the present disclosure, under an experimental environment specified by a core experiment of the JCT-VC standard organization, the present disclosure is implemented in the reference software HM14.0+RExt7.0+SCM1.0+Q0094+Q0047BF provided by said organization, and results of AllIntra-lossy compression modes are compared. Video formats under testing include the YUV format and the RGB format with a total of 26 testing video files. The 26 testing video files may be divided into 12 types according to video content differences and format differences, and the 12 types may refer to the descriptions provided in a first column at left inFIG.10AandFIG.10B. Among the 12 types, “text & graphics with motion” is a video application often encountered by the SCC, which includes content of a common SCC application such as presentation, software, and so on; “mixed content” is a common video SCC video application and a common HEVC natural image application; and “animation” is animation video, where application of “animation” is seldom used in the SCC environment. The video types may also be further divided into three types 720p, 1080p, and 1440p according to their sizes. Herein, the data are all presented in BDrate. BDrate is a conventional objective rating measurement method commonly used by the JCT-VC standard organization. When the data is smaller than zero, it indicates that a visual quality of the same bitrate is better as the data is smaller.

Specifically, the test results shown inFIG.10AandFIG.10Bare the BDrate performances corresponding to the embodiment in which the coding unit block does not include the escape pixel and the embodiment in which the coding unit block includes the escape pixel respectively in the present disclosure. In view of the data, as compared to the existing methods, the method proposed by the present disclosure can provide substantial improvements in performances under the situation where the complicity almost remains unchanged. The performances of said two embodiments may achieve the improvements of up to −0.7% and −1.4%, respectively. The improvement in “text & graphics with motion” (which is the common video application type for the SCC) is especially significant among those performances.

In view of the above, the method for encoding and the method for decoding, the system for encoding and decoding using the methods, the encoder and the decoder as proposed by the exemplary embodiments of the present disclosure are capable of determining whether to reserve the field for the escape index, such that the bits being transmitted may be saved while effectively reducing the transmission amount during the encoding computation to thereby improve the performance for the screen video coding.

It will be apparent to those skilled in the art that various modifications and variations can be made to the disclosed embodiments. It is intended that the specification and examples be considered as exemplary only, with a true scope of the disclosure being indicated by the following claims and their equivalents.