Screen superposition display device, compression coding device, compression coding method, chip and equipment
By compressing, encoding and decoding the first image to be superimposed, the problem of high hardware storage cost in screen overlay display is solved, and an efficient and simplified screen overlay display is achieved.
Patent Information
- Application Number
- CN202411904361.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-03-25
AI Technical Summary
In the screen overlay display, the amount of first image data to be superimposed is large, and directly storing the original data leads to high hardware storage costs and high requirements for hardware storage units.
The data of the first image is encoded by using compression encoding technology, compressed data is stored, and the compressed data is decoded by the decoding unit in a fixed bit width unit to realize screen overlay display.
It reduces hardware storage costs, simplifies the complexity of the screen overlay display device, and improves the compression rate of each encoding block, achieving efficient screen overlay display.
Smart Images

Figure CN119697377A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of display technology, and in particular to a screen overlay display device, a compression encoding device, a method, a chip and a device. Background Art
[0002] OSD (On Screen Display) display refers to superimposing the first image on the image to be output to form a composite output image. Exemplarily, the image data of the first image is stored in a hardware storage unit; when superimposed display is required, the first image to be superimposed is taken out from the hardware storage unit, and the first image is superimposed on the current image to be output to obtain a final composite output image. In the case where the amount of data of the first image to be superimposed is large, directly storing the original data of the first image to be superimposed results in a large hardware storage cost and a high requirement for the hardware storage unit. Summary of the invention
[0003] The present application provides a screen overlay display device, a compression encoding device, a method, a chip and a device for realizing screen overlay display based on compressed data.
[0004] In a first aspect, a screen overlay display device is provided, the screen overlay display device comprising a storage unit, a first decoding unit and an overlay display unit;
[0005] The storage unit is used to store compressed data of the first image, the compressed data comprising a plurality of coding blocks of fixed bit width, each coding block compressing at least one run in the image data of the first image, a run being a segment of continuously repeated identical pixel values, and the number of compressed runs in any coding block being negatively correlated with the length of the compressed run;
[0006] The first decoding unit is used to decode the compressed data in units of the fixed bit width to obtain image data of the first image;
[0007] The superimposed display unit is used to superimpose the image data of the first image with the image to be displayed to obtain a second image, so that the display panel displays the second image.
[0008] In one possible implementation, the coding block includes a flag bit, a color index value, and a number of pixels, wherein the flag bit indicates the number of runs contained in the coding block, one run corresponds to a color index value and a number of pixels, the color index value of any run indicates the pixel values that are continuously repeated in any run, and the number of pixels of any run indicates the number of times the pixel value is repeated.
[0009] In a possible implementation, the storage unit is also used to store a color lookup table, which includes a correspondence between color index values and pixel values; the first decoding unit is used to decode the compressed data in units of the fixed bit width to obtain the color index value and the number of pixels for each run of the first image; determine the pixel value indicated by the color index value of each run according to the color lookup table, and obtain image data of the first image based on the pixel value and the number of pixels of each run.
[0010] In a possible implementation, the first decoding unit includes: a data reading module and a run-length decoding module;
[0011] The data reading module is used to read the compressed data stored in the storage unit, and send the read compressed data to the run-length decoding module when it is determined that the run-length decoding module has completed decoding of the previous compressed data;
[0012] The run-length decoding module is used to decode the received compressed data in units of the fixed bit width when it is determined that the received compressed data sent by the data reading module is valid.
[0013] In a possible implementation manner, the first decoding unit further includes: a color matching module;
[0014] The run-length decoding module is further used to send the color index value and the number of pixels of a run obtained by decoding to the color matching module when it is determined that the color matching module has completed the processing of the previous run;
[0015] The color matching module is used to determine the pixel value indicated by the received color index value according to the color lookup table when it is determined that the color index value and the number of pixels sent by the run-length decoding module are valid, and output pixels based on the pixel value and the number of pixels.
[0016] In a possible implementation, the first image includes an upper out-of-bounds portion, and the upper out-of-bounds portion refers to a portion of the first image that exceeds the upper boundary of the second image after being superimposed on the second image; the screen overlay display device also includes a second decoding unit, and the second decoding unit is used to decode the compressed data corresponding to the upper out-of-bounds portion in units of the fixed bit width to obtain the number of pixels of the upper out-of-bounds portion.
[0017] In a possible implementation manner, the compressed data corresponding to the upper out-of-bounds portion includes a first coding block and a second coding block;
[0018] The second decoding unit is further configured to, after the second decoding unit decodes and obtains a first number of pixels of the first coding block, if the first number of pixels is less than or equal to a second number of pixels, update the second number of pixels based on the first number of pixels and continue decoding the second coding block;
[0019] If the first number of pixels is greater than the second number of pixels, the first coding block is sent to the first decoding unit, and the first decoding unit decodes the first coding block; wherein the second number of pixels indicates the number of undecoded pixels in the upper out-of-bounds portion of the first image.
[0020] In a second aspect, a compression encoding device is provided, the device comprising a processing module, and the processing module is configured to:
[0021] Get image data;
[0022] The image data is encoded according to a fixed-bit-width encoding format to obtain multiple encoding blocks, each encoding block compresses at least one run of the image data, a run refers to a section of continuously repeated identical pixel values, and the number of compressed runs in any encoding block is negatively correlated with the length of the compressed run.
[0023] In one possible implementation, the encoding format includes a flag bit, a color index value, and a number of pixels, wherein the flag bit indicates the number of runs contained in the encoding block, one run corresponds to a color index value and a number of pixels, the color index value of any run indicates the pixel values that are continuously repeated in any run, and the number of pixels of any run indicates the number of times the pixel value is repeated.
[0024] In a possible implementation, the color index value corresponding to any pixel value is determined by using a color lookup table, where the color lookup table includes a correspondence between color index values and pixel values.
[0025] In a third aspect, a screen overlay display method is provided, the method comprising:
[0026] Decoding the compressed data of the first image in units of a fixed bit width to obtain image data of the first image, wherein the compressed data includes a plurality of coding blocks of the fixed bit width, each coding block compresses at least one run in the image data of the first image, a run refers to a segment of continuously repeated identical pixel values, and the number of compressed runs in any coding block is negatively correlated with the length of the compressed run;
[0027] The image data of the first image is superimposed on the image to be displayed to obtain a second image, so that the display panel displays the second image.
[0028] In one possible implementation, the coding block includes a flag bit, a color index value, and a number of pixels, wherein the flag bit indicates the number of runs contained in the coding block, one run corresponds to a color index value and a number of pixels, the color index value of any run indicates the pixel values that are continuously repeated in any run, and the number of pixels of any run indicates the number of times the pixel value is repeated.
[0029] In a possible implementation manner, decoding the compressed data of the first image in units of a fixed bit width to obtain the image data of the first image includes:
[0030] Decoding the compressed data in units of the fixed bit width to obtain a color index value and a number of pixels for each run of the first image;
[0031] The pixel value indicated by the color index value of each run is determined according to a color lookup table, and the image data of the first image is obtained based on the pixel value and the number of pixels of each run, wherein the color lookup table includes a correspondence between color index values and pixel values.
[0032] In a possible implementation manner, the first image includes an upper out-of-bounds portion and a non-out-of-bounds portion, the upper out-of-bounds portion refers to a portion of the first image that exceeds an upper boundary of the second image after being superimposed on the second image, and the non-out-of-bounds portion is a portion of the first image other than the upper out-of-bounds portion; the method further includes:
[0033] The compressed data corresponding to the upper crossing portion is quickly decoded in units of the fixed bit width to obtain the number of pixels of the upper crossing portion;
[0034] The compressed data corresponding to the non-cross-border portion is normally decoded in units of the fixed bit width to obtain image data of the non-cross-border portion.
[0035] In a possible implementation manner, the compressed data corresponding to the upper out-of-bounds portion includes a first coding block and a second coding block; and the method includes:
[0036] After quickly decoding to obtain a first number of pixels of the first coding block, if the first number of pixels is less than or equal to a second number of pixels, updating the second number of pixels based on the first number of pixels, and continuing to quickly decode the second coding block;
[0037] If the first number of pixels is greater than the second number of pixels, the first coding block is normally decoded in units of the fixed bit width to obtain image data corresponding to the first coding block;
[0038] The second number of pixels indicates the number of undecoded pixels in the upper out-of-bounds portion.
[0039] In a fourth aspect, a compression encoding method is provided, the method comprising:
[0040] Get image data;
[0041] The image data is encoded according to a fixed-bit-width encoding format to obtain multiple encoding blocks, each encoding block compresses at least one run of the image data, a run refers to a section of continuously repeated identical pixel values, and the number of compressed runs in any encoding block is negatively correlated with the length of the compressed run.
[0042] In one possible implementation, the encoding format includes a flag bit, a color index value, and a number of pixels, wherein the flag bit indicates the number of runs contained in the encoding block, one run corresponds to a color index value and a number of pixels, the color index value of any run indicates the pixel values that are continuously repeated in any run, and the number of pixels of any run indicates the number of times the pixel value is repeated.
[0043] In a fifth aspect, a chip is provided, wherein the chip includes the screen overlay display device as described in the first aspect above, and / or the chip includes the compression encoding device as described in the second aspect above.
[0044] In a sixth aspect, an electronic device is provided, wherein the electronic device comprises the chip as described in the fifth aspect.
[0045] The technical solution provided by this application can at least bring the following beneficial effects:
[0046] The technical solution provided by the present application stores compressed data in the storage unit, which reduces the hardware storage cost. In addition, since the compressed data is encoded with a fixed bit width, decoding is performed in units of the fixed bit width, and each decoding unit is independent, making the decoding method simple and unconstrained, simplifying the complexity of the screen superposition display device. In addition, the number of compressed runs in any coding block is negatively correlated with the length of the compressed run. The shorter the run length, the more compressed runs, and the longer the run length, the fewer compressed runs, so as to avoid a single run with a shorter run length occupying more coding bit width, thereby improving the compression rate of each coding block. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0048] Figure 1It is a schematic diagram of a coding rule for compression processing provided in the related art;
[0049] Figure 2 is a flow chart of a compression encoding method provided by an embodiment of the present application;
[0050] Figure 3 is a schematic diagram of a coding format provided in an embodiment of the present application;
[0051] Figure 4 is a schematic diagram of another encoding format provided in an embodiment of the present application;
[0052] Figure 5 is a schematic diagram of another encoding format provided in an embodiment of the present application;
[0053] Figure 6 is a schematic diagram of another encoding format provided in an embodiment of the present application;
[0054] Figure 7 is a structural schematic diagram of a screen overlay display device provided in an embodiment of the present application;
[0055] Figure 8 is a schematic diagram of data transmission provided by an embodiment of the present application;
[0056] Fig. 9 is a schematic diagram of an upper boundary crossing scenario provided in an embodiment of the present application;
[0057] Fig.10 is a structural schematic diagram of another screen overlay display device provided in an embodiment of the present application;
[0058] Fig.11 This is a flowchart of fast decoding and normal decoding provided by an embodiment of the present application;
[0059] Fig.12 It is a flow chart of a screen overlay display method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0061] On Screen Display (OSD) is a basic function involved in the output display of the Image Signal Processor (ISP). It is used to superimpose different images, texts, graphics and other foreground images on the output image processed by the ISP to form a composite output image. The application scenarios of on-screen overlay display include but are not limited to: TV, navigation system, augmented reality (AR), video games, car rearview mirror, 360-degree surround view, etc. For example, in the car rearview mirror scene, the foreground image to be superimposed mainly includes: prompt signals, lane auxiliary lines, radar auxiliary lines and other images.
[0062] The overall idea of realizing screen superposition display is: pre-storing the foreground image to be superimposed in the hardware storage unit; when superimposed display is required, taking out the foreground image to be superimposed from the hardware storage unit, and superimposing the foreground image on the current image to be output according to the superposition principle. In the case where the data amount of the foreground image to be superimposed is small, for example, the image size is small or the color is relatively single, resulting in a small data amount, the original data of the foreground image to be superimposed can be directly stored in the hardware storage unit.
[0063] However, when the amount of data of the foreground image to be superimposed is large, or a large number of foreground images need to be superimposed on an output image, directly storing the original data of the foreground image to be superimposed results in a large hardware storage cost and a high requirement for the hardware storage unit. Therefore, it is necessary to compress the foreground image to be superimposed, and store the compressed data of the foreground image to be superimposed in the hardware storage unit to reduce the storage cost of the foreground image to be superimposed.
[0064] Run-length encoding (RLE), also known as run-length encoding or variable length encoding, is a simple lossless data compression algorithm. Run-length encoding reduces the size of data by recording the same data that is repeated continuously and the number of repetitions. Among them, a section of the same data that is repeated continuously in the original data is called a run or a stroke, and the number of repetitions is also called the run length. Run-length encoding is particularly suitable for compressing data that contains a large amount of continuous repetitive data. For images, it is an image that contains a large number of continuous repetitive pixel values.
[0065] The data compression process using run-length encoding includes: starting scanning from the starting position of the original data, recording the continuously repeated identical data, namely the run; whenever encountering a new data different from the previous data, recording the data value of the previous data and the number of consecutive repetitions; when encoding, converting the recorded number of repetitions and the corresponding data value into a coding format, usually in the form of "number-value" or "value-number"; when decoding, parsing the number of repetitions and data values in the coding format, and repeatedly outputting the corresponding data value until the length of the original data is reached.
[0066] For example, taking the original data of the character sequence "WWWWBBBWWWWWWWWBBWW" and the encoding format of "value-number" as an example, the result after run-length encoding compression is "(W, 4)(B, 3)(W, 8)(B, 2)(W, 2)", which means that 4 Ws appear consecutively, followed by 3 Bs appear consecutively, then 8 Ws appear consecutively, 2 Bs appear consecutively, and finally 2 Ws appear consecutively.
[0067] The compression algorithm of run-length encoding can achieve simple and efficient lossless data compression, with fast encoding and decoding speeds. The decoded data is completely consistent with the original data without information loss. For files containing a large amount of repeated data, the file size can be significantly reduced. However, for files containing a large amount of non-repeating or low-repeating data, the compression effect of run-length encoding is poor, and sometimes it may even cause data expansion. Therefore, the compression algorithm of run-length encoding is suitable for the compression of simple images such as black and white images, vector images, and bitmaps.
[0068] In the related art, a compression encoding method is provided based on run-length encoding, see Figure 1 Schematic diagram of the encoding rules for compression processing shown. The encoding format of the original data after compression processing is: flag bit + run length + data. The flag bit represents whether compression is required. The size of the flag bit is 2 bits (bits), where 00 represents no compression and the run length is less than or equal to 3; 01 represents no compression and the run length is greater than or equal to 4 and less than or equal to 1023; 10 represents compression and the run length is greater than or equal to 3 and less than or equal to 1023; 11 represents compression and the run length is greater than or equal to 1024 and less than or equal to 262143. The run length represents the number of consecutive repetitions.
[0069] Continue as Figure 1 As shown in the figure, the recording unit of each run length code is 8 bits. If the last unit of the "flag bit + run length + data" after compression is less than 8 bits, the code also includes a padding bit, which is filled with 0 to fill up 8 bits. The coding width for the run length, i.e., the bit width, can be flexibly adjusted. If the run length is greater than 3 and less than 1023, the run length code occupies 10 bits. If the run length is greater than 1024, the run length code occupies 18 bits.
[0070] For example, assuming that the original data is [d0, d0, d3…d3 (1000 d3)], according to Figure 1The original data is encoded according to the compression processing rules shown. For the first two data d0, d0, the flag bit is 00, indicating that compression is not required. The code of the run length 2 occupies 2 bits, which is 10. The data is not compressed as d0, d0. Since the last 8 bits after encoding are not full, the last 4 bits are filled with 0, and the final code is (0010, d0) (d0, 0000). For the subsequent 1000 d3, the compression standard is met. According to the compression coding rules, the flag bit is 10, and the code of the run length 1000 occupies 10 bits, which is 11, 30, 1000. The repeated data value is d3, so the 1000 d3 are finally encoded as (1011, 30) (1000, d3).
[0071] against Figure 1 The encoding rules of the compression process shown can guarantee the compression rate, which is the ratio of the compressed data size to the data size before compression. However, since the encoding process is performed in units of run lengths, that is, one run length encoding corresponds to a complete coding block, the original data can only be obtained by decoding one coding block each time. Since the run lengths of different runs are different, the run lengths occupy different bit widths in the coding block, and thus the lengths of the coding blocks of different runs are different, which results in constraints in the decoding process.
[0072] For example, if decoding is performed in units of one byte (i.e. 8 bits), the second byte will be affected by the flag bit and run length in the first byte. If decoding is performed in units of two bytes, the second two bytes will be affected by the flag bit and run length of the first two bytes. In other words, no matter how many bits are used for decoding, the decoding of the previous unit must be completed before the decoding of the subsequent unit can be performed. That is, no matter how many bits are used for decoding, there will be a correlation between the previous and next units.
[0073] Moreover, since a decoding unit may contain part of the encoding of the previous run and part of the encoding of the next run, there are many decoding methods, so the decoding unit needs to support multiple circuits for selection, resulting in the inability to achieve synchronous decoding of multiple decoding units. Multiple circuits will also lead to higher circuit complexity of the decoding unit and higher hardware resources occupied.
[0074] The embodiment of the present application provides a compression coding method, which can simplify the decoding process while ensuring the compression rate, and can achieve synchronous decoding without decoding in the order of decoding units. Figure 2 , Figure 2 A flowchart of a compression coding method provided in an embodiment of the present application, the compression coding method includes but is not limited to the following steps 401 and 402.
[0075] Step 401, acquiring image data.
[0076] Wherein, the image data includes pixel values of multiple pixels, and different pixel values represent different colors. The embodiment of the present application does not limit the type of image data, including but not limited to binary images, grayscale images or RGB images. RGB image is an image format using three color channels of red (red, R), green (green, G) and blue (blue, B). Exemplarily, the image data can be the image data of the foreground image mentioned above.
[0077] For binary images, there are only two states: 0 (representing black) and 1 (representing white), so the pixel value of each pixel only needs to be represented by 1 bit. For grayscale images, the pixel value of each pixel requires 8 bits to represent, from 0 (representing black) to 255 (representing white), a total of 256 colors. For RGB images, the pixel value of each pixel usually requires 24 bits to represent, because the three channels of R, G, and B each occupy 8 bits, and a total of 24 bits can represent about 16.7 million colors.
[0078] Step 402, encode the image data according to a fixed bit width encoding format to obtain multiple encoding blocks, each encoding block compresses at least one run in the image data, a run refers to a section of continuously repeated identical pixel values, and the number of compressed runs in any encoding block is negatively correlated with the length of the compressed run.
[0079] The compression coding method provided in the embodiment of the present application performs coding in units of fixed bit width, so that the length of each coding block obtained by coding is fixed. The embodiment of the present application does not limit the size of the fixed bit width, and can be flexibly adjusted according to the application scenario. For example, if the fixed bit width is 16 bits, then one coding block is a 16-bit compressed data.
[0080] Among them, since each coding block is complete and independent, each coding block can be decoded to obtain the original data by decoding it separately, and the decoding between different coding blocks does not affect each other. In the embodiment of the present application, the length of each coding block is fixed, and the bit width is fixed. Therefore, decoding is performed in units of fixed bit width, and the front and rear decoding units are two independent coding blocks. The decoding of the latter decoding unit is not affected by the previous decoding unit, and there is no need to decode in the order of the decoding units, which can achieve synchronous decoding of multiple coding blocks.
[0081] In a possible implementation, the encoding format of the fixed bit width is: flag bit + color index value + number of pixels, that is, each coding block contains a flag bit, a color index value and a number of pixels. The flag bit is used to indicate the number of runs contained in the coding block, and one run corresponds to a color index value and a number of pixels, that is, one run can be encoded as a color index value and a number of pixels. The color index value of any run indicates the pixel values that are continuously repeated in any run, and the number of pixels in any run indicates the number of repetitions of the continuously repeated pixel values.
[0082] The bit width of the color index value corresponding to each run is usually the same, while the bit width of the number of pixels corresponding to each run can be different, which is related to the value of the number of pixels, that is, how many bits are needed to represent the number of pixels. The larger the value of the number of pixels, the larger the bit width of the number of pixels in the coding block, and the smaller the value of the number of pixels, the smaller the bit width of the number of pixels in the coding block.
[0083] Therefore, the number of runs compressed in any coding block is negatively correlated with the length of the compressed run. The shorter the run length, the smaller the value of the number of pixels, and the more runs that can be compressed within a fixed bit width. The longer the run length, the smaller the value of the number of pixels, and the fewer runs that can be compressed within a fixed bit width. This makes the number of runs compressed within a fixed bit width adaptively change with the run length, avoiding a single run with a shorter length occupying more coding bit width, thereby improving the compression rate of each coding block.
[0084] Optionally, the color index value is the pixel value itself; or, the color index value is not the pixel value itself, but the index value in the color lookup table that indicates the pixel value. For example, for a binary image, since the pixel value of each pixel only needs to be represented by 1 bit, the color index value can be directly represented as the pixel value itself. For a grayscale image or an RGB image, since the pixel value of each pixel needs to be represented by 8 or 24 bits, and the index value in the color lookup table is usually less than 8 bits, the color index value can be represented as the index value in the color lookup table to reduce the number of bits occupied by the color index value in the encoding block.
[0085] Among them, in the case where the color index value is the index value indicating the pixel value in the color lookup table, the color index value corresponding to any pixel value needs to be determined by the color lookup table. The color lookup table includes the corresponding relationship between the color index value and the pixel value, and one color index value corresponds to one pixel value. The color lookup table can be obtained by: selecting m pixel values corresponding to m colors, and the color index values corresponding to the m pixel values are 0 to m-1, then the size of the color lookup table is m, and the color lookup table includes a one-to-one correspondence between the m pixel values and the m index values. Therefore, the size of the color lookup table is related to the type of color. In addition, the bit width of the color index value in the encoding format also determines the size of the color lookup table. Assuming that the bit width of the color index value is n bits, then the size m of the color lookup table needs to be less than or equal to the maximum value that can be represented by n bits.
[0086] For the pixel values of four-channel image data, the four channels are A, R, G and B, A represents the transparency channel, R represents the red channel, G represents the green channel, and B represents the blue channel. The transparency is represented by alpha, where the white area (alpha=0) occupies one color, so only the color types of the non-white area (alpha>0) need to be counted. After the statistics are completed, they are sorted from large to small according to the color types. According to the size m of the given color lookup table, the pixel value in the color lookup table (i.e. white + the first m-1 colors) is determined. When encoding, for pixel values that are not in the color lookup table, they can be clustered into pixel values in the color lookup table according to the Euclidean distance.
[0087] In general, the pixel value of the four-channel image data is 32 bits. In the encoding process of the embodiment of the present application, the color index value is used instead of the pixel value. The bit width of the color index value can be determined by the color types contained in the foreground image to be compressed, that is, the maximum value that can be represented by the bit width of the color index value is greater than the color type, and the maximum value that can be represented by the bit width of 32 bits is 4294967295, and the color type of the foreground image to be superimposed is usually relatively single, much less than 4294967295. Therefore, the bit width of the color index value is smaller than the bit width of the pixel value. Using the color index value instead of the pixel value effectively saves the encoding bit width, so that there are more bits to record the number of pixels in the encoding block with the same bit position, which can improve the compression rate to a certain extent.
[0088] The embodiment of the present application does not limit the bit width of the color index value in the fixed bit width. Optionally, the bit width of the color index value can be determined according to the color types included in the image data. The more color types, the larger the bit width of the color index value. When the fixed bit width of the encoding format is 16 bits, the bit width of the color index value can be 3 bits, 4 bits, 5 bits or 6 bits. Taking the color index value represented by color_idx and the number of pixels represented by color_cnt as an example, the encoding format under different bit widths of the color index value is illustrated.
[0089] When the color_idx bit width is 3 bits, see Figure 3 Schematic diagram of the encoding format shown. If the run length is less than 4, the bit width of color_cnt can be 2 bits, so that a 16-bit coding block can compress 3 runs. In this case, the maximum amount of data that can be compressed by a coding block is 4*3=12 pixels. If the run length is less than 16, the bit width of color_cnt can be 4 bits, so that a 16-bit coding block can compress 2 runs. In this case, the maximum amount of data that can be compressed by a coding block is 16*2=32 pixels. If the run length is less than 2048, the bit width of color_cnt can be 11 bits, so that a 16-bit coding block can compress 1 run. In this case, the maximum amount of data that can be compressed by a coding block is 2048*1=2048 pixels.
[0090] When the color_idx bit width is 4 bits, see Figure 4 The coding diagram shown. If the run length is less than 2, the bit width of color_cnt can be 1 bit, so that one coding block can compress 3 runs. In this case, the maximum amount of data that can be compressed by one coding block is 2*3=6 pixels. If the run length is less than 8, the bit width of color_cnt can be 3 bits, so that one coding block can compress 2 runs. In this case, the maximum amount of data that can be compressed by one coding block is 8*2=16 pixels. If the run length is less than 1024, the bit width of color_cnt can be 10 bits, so that one coding block can compress 1 run. In this case, the maximum amount of data that can be compressed by one coding block is 1024*1=1024 pixels.
[0091] When the color_idx bit width is 5 bits, see Figure 5The coding diagram shown in the figure. If the run length is less than 4, the bit width of color_cnt can be 2 bits, so that one coding block can compress 2 runs. In this case, the maximum amount of data that can be compressed by one coding block is 4*2=8 pixels. If the run length is less than 1024, the bit width of color_cnt can be 10 bits, so that one coding block can compress 1 run. In this case, the maximum amount of data that can be compressed by one coding block is 1024*1=1024 pixels.
[0092] When the color_idx bit width is 6 bits, see Figure 6 The coding diagram shown in the figure. If the run length is less than 2, the bit width of color_cnt can be 1 bit, so that one coding block can compress 2 runs. In this case, the maximum amount of data that can be compressed by one coding block is 2*2=4 pixels. If the run length is less than 512, the bit width of color_cnt is 9 bits, so that one coding block can compress 1 run. In this case, the maximum amount of data that can be compressed by one coding block is 512*1=512 pixels.
[0093] In summary, the 16 bits of the coding block are fixed. The smaller the bit width of the color index value, the larger the bit width of the number of pixels, and the larger the amount of data that can be compressed by the number of pixels, that is, the higher the compression rate. Conversely, the larger the bit width of the color index value, the smaller the bit width of the number of pixels, and the smaller the amount of data that can be compressed by the number of pixels, the lower the compression rate will be. However, the larger the bit width of the color index value, the more types of pixel values corresponding to the color index value, and the smaller the data compression loss. Therefore, in the encoding format with a color index value bit width of 3 bits, the foreground image to be superimposed can be compressed to the greatest extent; in the encoding format with a color index value bit width of 6 bits, the details of the foreground image to be superimposed can be retained as much as possible.
[0094] The highest bit of the coding block is the flag bit. Figure 3 or Figure 4 In the coding format shown, when the highest bit of the coding block is 0, the coding block includes 3 runs; when the highest bit of the coding block is 1, the flag bit also includes the 8th bit from low to high of the coding block, when the 8th bit from low to high of the coding block is 1, the coding block includes 2 runs, and when the 8th bit from low to high of the coding block is 0, the coding block includes 1 run. Figure 5 or Figure 6 In the coding format shown, when the highest bit of the coding block is 0, the coding block includes 2 runs; when the highest bit of the coding block is 1, the coding block includes 1 run.
[0095] In the embodiment of the present application, when compressing and encoding the same image, the bit width of the color index value of the encoding format used is consistent, that is, the encoding formats of color index values with different bit widths cannot be cross-used in the same image; and when compressing and encoding different images, the bit width of the color index value of the encoding format used for different images may be inconsistent. For example, image 1 is Figure 3 The color index value shown in the figure is compressed and encoded in three encoding formats with a bit width of 3 bits. Image 2 is encoded by Figure 4 The color index values shown are compressed and encoded in three encoding formats with a bit width of 4 bits.
[0096] For example, the encoding operation provided by the embodiment of the present application is illustrated by taking the bit width of color_idx as 3 bits. Assume that the image data includes {aaaabbbccccccccccccccddddddddd}, where a, b, c and d represent different pixel values, and a`, b`, c` and d` are used to represent the color index values of a, b, c and d, respectively. Then according to Figure 3 The encoding results obtained by encoding the image data in the encoding format shown include: encoding block 1 (0, color_idx0=a`, color_cnt0=4, color_idx1=b`, color_cnt1=3, color_idx2=c`, color_cnt2=4) and encoding block 2 (1, color_idx0=c`, color_cnt0=9, 1, color_idx1=d`, color_cnt1=9).
[0097] It can be seen that since the run lengths of run 1 {aaaa} and run 2 {bbb} are both less than 4, use Figure 3 The first coding format including 3 runs is shown for encoding, and since the run length of run 3 {ccccccccccccc} is greater than 4, in order to be encoded together with run 1 and run 2 into a coding block including 3 runs, run 3 is split into two parts, run 3.1 {cccc} and run 3.2 {ccccccccc}. Run 1, run 2 and run 3.1 are encoded into the above coding block 1 according to the coding format including 3 runs, and run 3.1 and run 4 {ddddddddd} are encoded into the above coding block 2 according to the coding format including 2 runs. Therefore, according to the different run lengths in the image data, the appropriate coding format can be flexibly selected for encoding.
[0098] The above is the process of encoding operation, and the decoding operation is the reverse process of the above encoding operation. Through the compressed data obtained by the above encoding operation, every two bytes (i.e. 16 bits) can be decoded to obtain a maximum of 2048 color index values, and each color index value can determine a pixel value by the color lookup table. If 4 bytes are decoded per clock, then at most 2048*2=4096 pixel values can be decoded per clock.
[0099] The decoding operation for a coding block includes: decoding in units of coding blocks (16 bits), decoding each coding block to obtain compressed data of at least one run, and the compressed data of a run includes a color index value (color_idx) and a number of pixels (color_cnt); for the compressed data of each run, determine the corresponding pixel value in the color lookup table according to color_idx, repeat the pixel value color_cnt times, and the original data of each run can be obtained.
[0100] Taking the color index value having a bit width of 3 bits as an example, decoding any coding block into compressed data of at least one run includes the following three cases.
[0101] Case 1: If the highest bit of the coding block (16th bit from low to high) is 0, it is decoded according to the decoding rules of 3 runs. Among them, the 15th to 13th bits are decoded as the color index value of the first run, and the 12th and 11th bits are decoded as the number of pixels of the first run; the 10th to 8th bits are decoded as the color index value of the second run, and the 7th and 6th bits are decoded as the number of pixels of the second run; the 5th to 3rd bits are decoded as the color index value of the third run, and the 2nd and 1st bits are decoded as the number of pixels of the third run.
[0102] Case 2: If the highest bit of the coding block is 1, then you need to look at the 8th bit of the coding block. If the 8th bit is 1, decode it according to the decoding rules of 2 runs. Among them, the 15th to 13th bits are decoded as the color index value of the first run, and the 12th and 9th bits are decoded as the number of pixels in the first run; the 7th to 5th bits are decoded as the color index value of the second run, and the 4th and 1st bits are decoded as the number of pixels in the second run.
[0103] Case 3: If the highest bit of the coding block is 1, then the 8th bit of the coding block needs to be checked. If the 8th bit is 0, the decoding is performed according to the decoding rules of 1 run. Among them, the 15th to 13th bits are decoded as the color index value of the 1 run, and the 12th to 9th bits and the 7th to 1st bits are decoded as the number of pixels of the 1 run.
[0104] It can be seen that the embodiment of the present application performs decoding in units of a fixed bit width of 16 bits, and each two decoding units will not affect each other. Only the flag bit determination is required to determine the decoding rule, and different decoding rules correspond to different decoding circuits. Since the decoding rules indicated by the flag bit are relatively few, when the bit width of the color index value is 3 bits, there are 3 decoding rules. Therefore, the decoding circuit branches required by the decoding unit are relatively few, making the circuit structure of the decoding unit relatively simple, saving hardware implementation resources.
[0105] The embodiment of the present application provides a compression coding device, which includes a processing module, and the processing module is configured to: execute Figure 2 The compression encoding method shown.
[0106] In one possible implementation, the processing module is configured to: acquire image data; encode the image data according to a fixed bit width encoding format to obtain multiple encoding blocks, each encoding block compressing at least one run of the image data, a run refers to a section of continuously repeated identical pixel values, and the number of compressed runs in any encoding block is negatively correlated with the length of the compressed run.
[0107] In one possible implementation, the encoding format includes a flag bit, a color index value, and a number of pixels, the flag bit indicates the number of runs contained in the encoding block, one run corresponds to a color index value and a number of pixels, the color index value of any run indicates the continuously repeated pixel values in any run, and the number of pixels in any run indicates the number of times the pixel value is repeated.
[0108] Other embodiments of the compression encoding device can be found in Figure 2 The relevant implementation methods in the compression encoding method shown will not be repeated here.
[0109] Based on the compression coding device and compression coding method provided in the above-mentioned embodiments of the present application, for the application scenario of screen overlay display, the embodiment of the present application provides a screen overlay display device, and the structural schematic diagram of the screen overlay display (OSD) device can be as follows: Figure 7The screen overlay display device includes: a storage unit 901, a first decoding unit 902 and an overlay display unit 903. The storage unit 901 may be a static random access memory (SRAM), which is not limited in the present embodiment.
[0110] The storage unit 901 is used to store compressed data of the first image, the compressed data includes multiple coding blocks of fixed bit width, each coding block compresses at least one run in the image data of the first image, a run refers to a continuous repetition of the same pixel value, and the number of compressed runs in any coding block is negatively correlated with the length of the compressed run. The first decoding unit 902 is used to decode the compressed data in units of fixed bit width to obtain the image data of the first image. The superimposed display unit 903 is used to superimpose the image data of the first image with the image to be displayed to obtain a second image, so that the display panel displays the second image.
[0111] Optionally, the compressed data of the first image is Figure 2 The compression encoding method shown is used to encode the image data of the first image, and the image data of the first image is the original data. The first image may be a foreground image to be superimposed. For example, the first image is Figure 1 The images shown include the prompt signal, lane auxiliary lines, radar auxiliary lines, etc. The image data of the foreground image to be superimposed is used to superimpose with the image data of the image to be displayed to obtain a second image, and the image to be displayed is the background image to be superimposed. For example, the image to be displayed is the image to be output processed by the ISP. In a possible implementation, the superimposed display unit 903 is connected to the ISP, and the superimposed display unit 903 is also used to receive the image to be output processed by the ISP.
[0112] The decoding operation performed by the first decoding unit 902 is Figure 2 The reverse process of the encoding operation shown. The decoded run includes a color index value and a number of pixels, and the color index value determines the corresponding pixel value through a color lookup table. In this case, the storage unit is also used to store a color lookup table, and the color lookup table includes the correspondence between the color index value and the pixel value. The first decoding unit 902 is used to decode the compressed data in units of a fixed bit width to obtain the color index value and the number of pixels of each run of the first image; determine the pixel value indicated by the color index value of each run according to the color lookup table, and obtain the image data of the first image based on the pixel value and the number of pixels of each run.
[0113] In a possible implementation, the first decoding unit 902 includes a data reading module and a run-length decoding module. The data reading module is used to read the compressed data stored in the storage unit 901; the run-length decoding module is used to decode the compressed data in units of a fixed bit width to obtain the color index value and the number of pixels of each run of the first image. Among them, the data reading module is used to read the compressed data stored in the storage unit in units of any multiples of the fixed bit width. For example, the data reading module reads N bits of compressed data each time, where N is any multiple of the fixed bit width. When the fixed bit width is 16 bits, N can be 16, 32, 48 or 64, etc.
[0114] Optionally, the data reading module is used to send the read compressed data to the run-length decoding module when it is determined that the run-length decoding module has completed decoding of the previous compressed data; the run-length decoding module is used to decode the received compressed data in units of fixed bit width when it is determined that the received compressed data sent by the data reading module is valid. For example, after completing the encoding, the run-length decoding module sends a completion notification to the data reading module; the data reading module not only sends the compressed data to the run-length decoding module, but also sends a notification to the run-length decoding module that the compressed data is valid.
[0115] In a possible implementation, the first decoding unit 902 further includes a color matching module, which is used to determine the pixel value indicated by the color index value of each run according to a color lookup table, and obtain image data of the first image based on the pixel value and pixel number of each run.
[0116] Optionally, the run-length decoding module is further used to send the color index value and pixel number of a run obtained by decoding to the color matching module when it is determined that the color matching module has completed the processing of the previous run; the color matching module is used to determine the pixel value indicated by the received color index value according to the color lookup table when it is determined that the received color index value and pixel number sent by the run-length decoding module are valid, and output pixels based on the pixel value and the pixel number. For example, after completing the pixel output of a run, the color matching module sends a completion notification to the run-length decoding module; the run-length decoding module not only sends the run-length data to the color matching module, but also sends a notification to the color matching module that the run-length data is valid.
[0117] In the embodiment of the present application, the data transmission between the data reading module, the run-length decoding module and the color matching module can be ensured to be correct by a handshake protocol. The handshake protocol is a network protocol that allows the sender and the receiver to confirm each other's identity. Optionally, the handshake protocol may include a valid (vld) signal and an acknowledgement (ack) signal, wherein the valid signal indicates that the data transmitted by the sender is valid and the receiver can process it; the acknowledgement signal indicates that the valid data received by the receiver has been processed and the sender can send new data.
[0118] In one possible embodiment, the data reading module is also used to send the read compressed data and a first valid signal to the run-length decoding module upon receiving a first confirmation signal sent by the run-length decoding module, wherein the first confirmation signal indicates that the run-length decoding module has completed decoding of the previous compressed data, and the first valid signal indicates that the read compressed data is valid.
[0119] A run-length decoding module is used to decode the compressed data sent by the data reading module to obtain the color index value and the number of pixels of a run-length upon receiving the first valid signal sent by the data reading module; send the decoded color index value and the number of pixels of a run-length and the second valid signal to the color matching module upon receiving the second confirmation signal sent by the color matching module, and continue to decode the next run-length; after decoding the compressed data, send the first confirmation signal to the data reading module; wherein the second confirmation signal indicates that the color matching module has completed the processing of the previous run-length, i.e., completed the determination of the pixel value of the color index value of the previous run-length and the pixel output of the pixel number, and the second valid signal indicates that the color index value and the number of pixels of the run-length are valid.
[0120] The color matching module is used to determine the pixel value indicated by the color index value of the run sent by the run-length decoding module according to the color lookup table when receiving the second valid signal sent by the run-length decoding module, output the pixel based on the pixel value and the number of pixels of the run, and send a second confirmation signal to the run-length decoding module after the pixel output corresponding to the run is completed.
[0121] For example, see Figure 8Schematic diagram of data transmission shown. The data reading module reads 2 bytes (i.e. 16 bits) of compressed data each time. The first reading is controlled by the bm_vld signal (corresponding to the first valid signal), and the subsequent reading is controlled by the bm_ack signal (corresponding to the first confirmation signal) fed back by the run-length decoding module. For example, every time the data reading module receives the bm_ack signal fed back by the run-length decoding module, it sends 16 bits of compressed data to the run-length decoding module. At the same time, the data reading module notifies the run-length decompression module through the bm_vld signal that the read data is valid and the run-length decompression operation can be performed. For example, every time the run-length decoding module receives the bm_vld signal sent by the data reading module, it decodes the 16 bits of compressed data sent by the data reading module, and sends the bm_ack signal to the data reading module after the decoding is completed.
[0122] The run-length decoding module decodes the received valid compressed data in units of two bytes (i.e., 16 bits), for example, by performing reverse decoding according to the encoding operation provided in the above embodiment of the present application, and each time a run is obtained by decoding, the color index value and the number of pixels of the current run are sent to the color matching module. Then, the run-length decoding module informs the color matching module of the validity of the run-length data sent by the color matching module through the run_vld signal (corresponding to the second valid signal), and determines whether to decode the next run through the run_ack signal (corresponding to the second confirmation signal) fed back by the color matching module.
[0123] Since the color index value is used instead of the pixel value itself in the encoding, when the color matching module obtains the valid run data sent by the run-length decoding module, it is necessary to determine the pixel value corresponding to the color index value of the current run according to the color lookup table stored in the storage unit 901. The pixel value is the image data of the foreground image to be superimposed; the number of pixels is used to control whether the current run is completed. Since the first decoding unit 902 processes only one pixel per clock, the number of pixels is updated once a pixel is processed, for example, minus 1. Therefore, when the number of pixels is updated to zero, it indicates that the current run processing is completed, and the run_ack signal is fed back to the run-length decoding module.
[0124] In a possible implementation, the first image includes an upper boundary portion, which refers to a portion of the first image that exceeds the upper boundary of the image to be displayed after being superimposed on the image to be displayed. The upper boundary portion refers to the display area of the foreground image to be superimposed exceeding the upper boundary of the background image. Fig. 9 As shown. Fig. 9 In the display, the active area of the screen is the pixel display area of the background image, that is, the valid data area; the blanking area of the screen is the blanking area of the background image, and the blanking area does not include valid data.
[0125] When the screen displays the image to be output, it scans line by line from the upper left corner of the screen. No image data is needed when scanning the blanking area, and image data is needed only when scanning the active area. Among them, the foreground image is also decoded line by line from the upper left corner, and the background image is output to Fig. 9 When the black dot position is reached, the background image and foreground image need to be superimposed. If the foreground image has not been decoded to the pixel value of the black dot position, an overlay display error will occur.
[0126] That is to say, when the foreground image to be superimposed crosses the boundary, since the first decoding unit 902 processes one pixel value per clock in the normal decoding process, and the upper blanking area of the background image output by the ISP is limited, it will cause the background image to be superimposed normally ( Fig. 9 The first decoding unit 902 cannot complete the upper boundary part in time ( Fig. 9 The decoding of the dotted frame part in the image may cause an overlay display error.
[0127] Therefore, see Fig.10 As shown in the structural diagram of the OSD device, the screen overlay display device provided in the embodiment of the present application further includes a second decoding unit 904, and the decoding speed of the upper out-of-bounds portion is accelerated by the second decoding unit 904. In this case, since the upper out-of-bounds portion of the foreground image does not need to be superimposed on the background image, it is not necessary to obtain the pixel value of the upper out-of-bounds portion, that is, it is not necessary to determine the pixel value in the color lookup table through the color matching module, and it is only necessary to decode the compressed data of the upper out-of-bounds portion in sequence, that is, only the number of pixels can be obtained by decoding.
[0128] Optionally, the second decoding unit 904 is used to decode the compressed data corresponding to the upper out-of-bounds part in units of fixed bit width to obtain the number of pixels of the upper out-of-bounds part. The second decoding unit 904 does not perform the color search process to achieve faster decoding. Since the decoding speed of the first decoding unit 902 cannot guarantee that the superimposed display will not be wrong in the scene where the superimposed image crosses the boundary, the embodiment of the present application improves the decoding speed through the second decoding unit 904. In the embodiment of the present application, the first decoding unit 902 is also called the normal decoding unit, and the second decoding unit 904 is also called the fast decoding unit. Thus, the second decoding unit 904 can decode the 2 bytes read from the storage unit 901 at a time, obtain the number of pixels corresponding to the 2 bytes, and update the number of out-of-bounds pixels by the number of pixels.
[0129] In a possible implementation, the second decoding unit 904 includes a data reading module and a quantity decoding unit. The data reading module is used to read the compressed data stored in the storage unit 901, for example, in units of a fixed bit width; the quantity decoding unit is used to decode the read compressed data in units of a fixed bit width to obtain the number of pixels of at least one run. The second decoding unit 904 can share the same data reading module with the first decoding unit 902. The data reading module and the quantity decoding unit in the second decoding unit 904 can also ensure data correctness through a handshake protocol. Please refer to the relevant description of the handshake protocol above, which will not be repeated here.
[0130] In the embodiment of the present application, the compressed data corresponding to the upper out-of-bounds portion includes a first coding block and a second coding block as an example, wherein the first coding block and the second coding block are two compressed blocks that need to be decoded continuously in the compressed data corresponding to the upper out-of-bounds portion. The second decoding unit 904 is also used to, after the second decoding unit 904 decodes and obtains the first pixel number of the first coding block, if the first pixel number is less than or equal to the second pixel number, update the second pixel number based on the first pixel number, and continue to decode the second coding block; if the first pixel number is greater than the second pixel number, send the first coding block to the first decoding unit 902, and the first decoding unit 902 decodes the first coding block, and all subsequent compressed data are decoded by the first decoding unit 902. The second pixel number indicates the number of pixels of undecoded pixels in the upper out-of-bounds portion of the first image.
[0131] Exemplarily, the specific flow chart used for fast decoding and normal decoding is as follows: Fig.11 As shown. For the upper out-of-bounds part of the foreground image to be superimposed, the number of pixels of the undecoded pixels in the upper out-of-bounds part is recorded as Exera_cnt; the second decoding unit 904 decodes each coding block in the compressed data in turn, and each decoding obtains a number of pixels, and determines whether the number of pixels obtained by the decoding is less than or equal to Exera_cnt; if the number of pixels obtained by decoding is less than or equal to Exera_cnt, update Exera_cnt = Exera_cnt-the number of pixels obtained by decoding, and continue to obtain the number of pixels of the next coding block through fast decoding; if the number of pixels obtained by fast decoding is greater than Exera_cnt, switch to the first decoding unit 902 for normal decoding.
[0132] Since each 16-bit coding block is independent of each other, if the storage unit 901 allows to read 32-bit data at a time, the second decoding unit 904 also supports decoding more than one pixel per clock, making the decoding speed faster. After testing, using the largest size foreground image to be superimposed, even if the upper cross-border part is very large, for example, only one row of pixels is left for superimposition to the background image, the second decoding unit 904 can still complete the decoding in time, and there will be no superimposed display error in the upper cross-border scene.
[0133] In the scenario involving upper crossing, if the number of pixels of the upper crossing portion is greater than the number of pixels contained in the two bytes currently decoded, then a fast decoding method is required, that is, the upper crossing portion is decoded by the second decoding unit 904, and the portion other than the upper crossing portion is decoded by the first decoding unit 902. In this case, the image data of the first image decoded by the first decoding unit 902 is the image data of the portion other than the upper crossing portion. For the crossing scenes at other positions other than the upper crossing, since the width of the background image plus the blanking area must be greater than the width of the foreground image to be superimposed, only the normal decoding method can be used, that is, the entire foreground image is decoded by the first decoding unit 902.
[0134] After the compressed data is decoded by the first decoding unit 902, the image data of the first image can be obtained, and the first decoding unit 902 sends the image data of the first image to the superimposition display unit 903. The superimposition display unit 903 is used to superimpose the image data obtained by the first decoding unit 902 on the image data of the background image, and output and display the superimposed composite image to achieve the effect of screen superimposition display.
[0135] Among them, screen overlay display is usually implemented based on the concept of layers. Each layer can contain different types of content, such as graphics, text or video. Different layers are superimposed together in a certain order to form the final display image. The bottom layer is usually the background image, and various information layers are superimposed on the background image. The foreground image to be superimposed can be located in the topmost information layer.
[0136] A key factor in screen overlay display is transparency. By adjusting transparency, the appearance of each layer in the final image can be controlled. For example, by adjusting transparency, it can be determined whether to completely cover the underlying layer, or to overlay it semi-transparently, or to make only a portion of the area transparent. In a possible implementation, the layer overlay formula can be shown as the following formula (1).
[0137] Out img =img fg *alpha+img bg *(1-alpha) formula (1)
[0138] Among them, img fg Represents the foreground image (image_foreground), such as the first image; img bg Represents the background image (image_background), such as the image to be displayed; alpha represents the transparency when superimposed, and the value range can be [0, 1]. 0 represents completely transparent, and 1 represents completely opaque. Different values between 0 and 1 represent different transparencies, and the smaller the value, the more transparent it is.
[0139] The screen overlay display device of the embodiment of the present application can be implemented by software or hardware. At the software level, the overlay display is implemented by a graphics rendering engine or a graphics library (such as OpenGL, DirectX, Vulkan), and the software processing flexibility is high, but more computing resources are required. At the hardware level, the overlay display is implemented by a dedicated hardware circuit, and the hardware processing is more efficient, which is suitable for applications with strict real-time requirements.
[0140] See also Fig.12 , Fig.12 This is a flow chart of a screen overlay display method provided by this application. Fig.12 As shown, the screen overlay display method includes but is not limited to the following steps 1201 and 1202.
[0141] Step 1201, decode the compressed data of the first image in units of fixed bit width to obtain image data of the first image, the compressed data includes multiple coding blocks of fixed bit width, each coding block compresses at least one run in the image data of the first image, a run refers to a section of continuously repeated identical pixel values, and the number of compressed runs in any coding block is negatively correlated with the length of the compressed run.
[0142] Among them, the coding block includes a flag bit, a color index value and a number of pixels. The flag bit indicates the number of runs contained in the coding block. One run corresponds to a color index value and a number of pixels. The color index value of any run indicates the continuously repeated pixel values in any run, and the number of pixels in any run indicates the number of repetitions of the pixel value.
[0143] In one possible implementation, compressed data of a first image is decoded in units of a fixed bit width to obtain image data of the first image, including: decoding compressed data in units of a fixed bit width to obtain a color index value and a number of pixels for each run of the first image; determining a pixel value indicated by the color index value of each run according to a color lookup table, and acquiring image data of the first image based on the pixel value and the number of pixels for each run, wherein the color lookup table includes a correspondence between color index values and pixel values.
[0144] In one possible case, the first image includes an upper out-of-bounds portion and a non-out-of-bounds portion, the upper out-of-bounds portion refers to the portion of the first image that exceeds the upper boundary of the second image after being superimposed on the second image, and the non-out-of-bounds portion is the portion of the first image other than the upper out-of-bounds portion; the method also includes: quickly decoding the compressed data corresponding to the upper out-of-bounds portion in units of a fixed bit width to obtain the number of pixels of the upper out-of-bounds portion; and normally decoding the compressed data corresponding to the non-out-of-bounds portion in units of a fixed bit width to obtain image data of the non-out-of-bounds portion.
[0145] Taking the compressed data corresponding to the above out-of-bounds part including the first coding block and the second coding block as an example; the method includes: after quickly decoding to obtain a first pixel number of the first coding block, if the first pixel number is less than or equal to the second pixel number, updating the second pixel number based on the first pixel number, and continuing to quickly decode the second coding block; if the first pixel number is greater than the second pixel number, decoding the first coding block normally in units of a fixed bit width to obtain image data corresponding to the first coding block; wherein the second pixel number indicates the pixel number of undecoded pixels of the above out-of-bounds part.
[0146] Step 1202 : superimpose the image data of the first image and the image to be displayed to obtain a second image, so that the display panel displays the second image.
[0147] Optionally, the method is applied to a screen overlay display device, which may be Figure 7 or Fig.10 The screen overlay display device shown. Other implementations of the screen overlay display method can refer to the relevant implementations of the above-mentioned screen overlay display device, which will not be repeated here.
[0148] In summary, the technical solution provided by the present application stores compressed data in the storage unit, which reduces the hardware storage cost. In addition, since the compressed data is encoded with a fixed bit width, decoding is performed in units of the fixed bit width, and each decoding unit is independent, making the decoding method simple and unconstrained, simplifying the complexity of the screen superimposed display device, and enabling synchronous decoding of multiple coding blocks. In addition, the number of compressed runs in any coding block is negatively correlated with the length of the compressed run. The shorter the run length, the more compressed runs, and the longer the run length, the fewer compressed runs, avoiding a single run with a shorter run length from occupying more coding bit width, thereby improving the compression rate of each coding block.
[0149] An embodiment of the present application provides a chip, which includes any of the screen overlay display devices shown above, and / or any of the compression encoding devices shown above.
[0150] An electronic device provided in an embodiment of the present application includes the above chip. Optionally, the electronic device is used to execute Figure 2 The compression encoding method shown, or, for executing Fig.12 The screen overlay display method shown.
[0151] It should be understood that the terms used in the embodiments of the present disclosure are only used to explain the embodiments of the present disclosure, and are not intended to limit the present disclosure. Unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be the common meanings understood by people with ordinary skills in the field to which the present disclosure belongs.
[0152] For example, the words "first", "second" or "third" and similar words used in the patent application specification and claims of this disclosure do not indicate any order, quantity or importance, but are merely used to distinguish different components.
[0153] Likewise, the words “a” or “an” and the like do not denote a limitation of quantity, but rather denote the presence of at least one.
[0154] Words such as “include” or “comprising” and the like mean that the elements or objects preceding “include” or “comprising” include the elements or objects listed after “include” or “comprising” and their equivalents, and do not exclude other elements or objects.
[0155] "Up", "down", "left" or "right" etc. are only used to indicate relative position relationship. When the absolute position of the described object changes, the relative position relationship may also change accordingly. "Connected" or "coupled" refers to electrical connection.
[0156] "And / or" indicates that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship.
[0157] Technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working processes of the gate drive circuit, shift register unit, each circuit and each sub-circuit described above can refer to the corresponding processes in the method embodiment and will not be repeated here.
[0158] The above description is only an optional embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A screen overlay display device, characterized in that: The screen overlay display device comprises a storage unit, a first decoding unit and an overlay display unit; The storage unit is used to store compressed data of the first image, the compressed data comprising a plurality of coding blocks of fixed bit width, each coding block compressing at least one run in the image data of the first image, a run being a segment of continuously repeated identical pixel values, and the number of compressed runs in any coding block being negatively correlated with the length of the compressed run; The first decoding unit is used to decode the compressed data in units of the fixed bit width to obtain image data of the first image; The superimposed display unit is used to superimpose the image data of the first image with the image to be displayed to obtain a second image, so that the display panel displays the second image.
2. The screen overlay display device according to claim 1, characterized in that: The coding block includes a flag bit, a color index value and a number of pixels, wherein the flag bit indicates the number of runs contained in the coding block, one run corresponds to a color index value and a number of pixels, the color index value of any run indicates the pixel values that are continuously repeated in any run, and the number of pixels of any run indicates the number of times the pixel value is repeated.
3. The screen overlay display device according to claim 1, characterized in that: The storage unit is further used to store a color lookup table, wherein the color lookup table includes a correspondence between color index values and pixel values; The first decoding unit is used to decode the compressed data in units of the fixed bit width to obtain a color index value and a number of pixels for each run of the first image; The pixel value indicated by the color index value of each run is determined according to the color lookup table, and the image data of the first image is acquired based on the pixel value and the number of pixels of each run.
4. The screen overlay display device according to claim 3, characterized in that: The first decoding unit includes: a data reading module and a run-length decoding module; The data reading module is used to read the compressed data stored in the storage unit, and send the read compressed data to the run-length decoding module when it is determined that the run-length decoding module has completed decoding of the previous compressed data; The run-length decoding module is used to decode the received compressed data in units of the fixed bit width when it is determined that the received compressed data sent by the data reading module is valid.
5. The screen overlay display device according to claim 4, characterized in that: The first decoding unit further includes: a color matching module; The run-length decoding module is further used to send the color index value and the number of pixels of a run obtained by decoding to the color matching module when it is determined that the color matching module has completed the processing of the previous run; The color matching module is used to determine the pixel value indicated by the received color index value according to the color lookup table when it is determined that the color index value and the number of pixels sent by the run-length decoding module are valid, and output pixels based on the pixel value and the number of pixels.
6. The screen overlay display device according to any one of claims 1 to 5, characterized in that: The first image includes an upper boundary portion, and the upper boundary portion refers to a portion of the first image that exceeds an upper boundary of the second image after being superimposed on the second image; The screen overlay display device also includes a second decoding unit, which is used to decode the compressed data corresponding to the upper cross-border part in units of the fixed bit width to obtain the number of pixels of the upper cross-border part.
7. The screen overlay display device according to claim 6, characterized in that: The compressed data corresponding to the upper out-of-bounds portion includes a first coding block and a second coding block; The second decoding unit is further configured to, after the second decoding unit decodes and obtains a first number of pixels of the first coding block, if the first number of pixels is less than or equal to a second number of pixels, update the second number of pixels based on the first number of pixels and continue decoding the second coding block; If the first number of pixels is greater than the second number of pixels, the first coding block is sent to the first decoding unit, and the first decoding unit decodes the first coding block; wherein the second number of pixels indicates the number of undecoded pixels in the upper out-of-bounds portion.
8. A compression encoding device, characterized in that: The apparatus comprises a processing module, wherein the processing module is configured to: Get image data; The image data is encoded according to a fixed-bit-width encoding format to obtain multiple encoding blocks, each encoding block compresses at least one run of the image data, a run refers to a section of continuously repeated identical pixel values, and the number of compressed runs in any encoding block is negatively correlated with the length of the compressed run.
9. The compression encoding device according to claim 8, characterized in that: The encoding format includes a flag bit, a color index value and a number of pixels, wherein the flag bit indicates the number of runs contained in the encoding block, one run corresponds to a color index value and a number of pixels, the color index value of any run indicates the pixel values that are continuously repeated in any run, and the number of pixels of any run indicates the number of times the pixel value is repeated.
10. A screen overlay display method, characterized in that: The method comprises: Decoding the compressed data of the first image in units of a fixed bit width to obtain image data of the first image, wherein the compressed data includes a plurality of coding blocks of the fixed bit width, each coding block compresses at least one run in the image data of the first image, a run refers to a segment of continuously repeated identical pixel values, and the number of compressed runs in any coding block is negatively correlated with the length of the compressed run; The image data of the first image is superimposed on the image to be displayed to obtain a second image, so that the display panel displays the second image.
11. A compression coding method, characterized in that: The method comprises: Get image data; The image data is encoded according to a fixed-bit-width encoding format to obtain multiple encoding blocks, each encoding block compresses at least one run of the image data, a run refers to a section of continuously repeated identical pixel values, and the number of compressed runs in any encoding block is negatively correlated with the length of the compressed run.
12. A chip, comprising the screen overlay display device according to any one of claims 1 to 7, and / or the chip comprising the compression encoding device according to claim 8 or 9.
13. An electronic device comprising the chip according to claim 12.