Image display method, system and electronic device for converting RGB888 into RGB565
By using the jitter matrix to optimize color channel processing during the RGB888 to RGB565 image conversion process, the problem of poor image display effect in the prior art is solved, and better visual effects and less visual distortion are achieved.
Patent Information
- Application Number
- CN202210359286.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-07
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2042-04-07
AI Technical Summary
When converting images in RGB888 format to RGB565 format in the prior art, the color channel processing is not perfect enough, resulting in poor image display effect and obvious visual distortion.
The jitter matrix is used to optimize the display of RGB565 images. The specific steps include obtaining the RGB888 images from the host, extracting the color channel matrix, expanding the matrix, segmenting into pixel blocks, separating the high and low digits, and adjusting the high digits according to the jitter matrix to optimize the image display.
Through the optimization of the jitter matrix, the display effect of RGB565 images is significantly improved, visual distortion is reduced, and the color expression of the image is improved.
Smart Images

Figure CN114694561B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image display method, system, electronic device and storage medium for converting RGB888 into RGB565. Background Art
[0002] At present, since the R, G, and B signals of some wearable display panel driver chips can only be processed as 5-bit, 6-bit, and 5-bit respectively, the original RGB888 format obtained from the host is converted into RGB565 format by usually intercepting the corresponding high-bit data and then shifting it to 8-bit display. The processed color channel can only display 64 grayscales at most, which will inevitably cause color deviation in the displayed image and cause visible distortion to the naked eye. Therefore, it is necessary to propose a method to improve the display effect of RGB565 images. Summary of the invention
[0003] The present invention provides an image display method, system, electronic device and storage medium for converting RGB888 into RGB565. The dither matrix used for R, G and B color channels can enable a display panel driver chip for displaying RGB565 images to have better image display effect and less visual distortion when driving and displaying RGB888 images.
[0004] The present invention provides an image display method for converting RGB888 into RGB565, which is applied to a display panel driver chip for displaying RGB565 images, comprising:
[0005] Get the original RGB888 image from the host, extract the components of each color channel from it, and obtain the color channel matrix corresponding to each color channel;
[0006] Expanding the color channel matrix until the number of rows and columns of the color channel matrix is a multiple of a set number;
[0007] Dividing the color channel matrix into a plurality of mutually independent pixel blocks;
[0008] The high-bit and low-bit numbers of each grayscale value of the pixel block are saved separately to obtain high-bit RGB565 and low-bit RGB323;
[0009] The high-bit value of the grayscale value is optimized according to the low-bit value of the grayscale value and the dither matrix, and the high-bit value of the optimized grayscale value is restored to 8 bits for display.
[0010] Furthermore, the size of the color channel matrix is determined based on the resolution of the original RGB888 image obtained from the host.
[0011] Further, the color channel matrix is expanded until the number of rows and columns of the color channel matrix is a multiple of a set number, including:
[0012] If the number of rows and columns of the color channel matrix is not a multiple of the set number, the last row or the last column of the color channel matrix is copied until the number of rows and columns of the color channel matrix are both multiples of the set number.
[0013] Furthermore, dividing the color channel matrix into a plurality of mutually independent pixel blocks comprises:
[0014] The color channel matrix corresponding to the G component is divided into mutually independent pixel blocks of 2*2 size; the color channel matrix corresponding to the R and B components is divided into mutually independent pixel blocks of 4*4 size.
[0015] Furthermore, the step of separately storing the high-order digit and the low-order digit of each grayscale value of the pixel block comprises:
[0016] The upper 6 bits and the lower 2 bits of each grayscale value of the pixel block corresponding to the G component are saved separately, and the upper 5 bits and the lower 3 bits of each grayscale value of the pixel block corresponding to the R and B components are saved separately.
[0017] Furthermore, the value of the high-bit number of the grayscale value is optimized according to the low-bit number of the grayscale value and the dither matrix, including:
[0018] The dither matrix coefficients are compared point-to-point with the low-bit numbers of the grayscale value. Based on the comparison result, it is determined whether the high-bit numbers of the grayscale value should be added to prevent overflow, and the high-bit numbers of the grayscale value are determined.
[0019] The present invention also provides an image display system for converting RGB888 into RGB565, comprising:
[0020] The component extraction module is used to obtain the original RGB888 image from the host, extract the component of each color channel therefrom, and obtain the color channel matrix corresponding to each color channel;
[0021] The image processing module is used to expand the color channel matrix until the number of rows and columns of the color channel matrix is a multiple of a set number; divide the color channel matrix into a plurality of independent pixel blocks; separately save the high-bit and low-bit of each gray value of the pixel block; optimize the value of the high-bit of the gray value according to the low-bit of the gray value and the dither matrix;
[0022] The image display module is used to restore the high-bit number of the optimized grayscale value to 8 bits for display.
[0023] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the image display method of converting RGB888 into RGB565 is implemented when the processor executes the program.
[0024] The present invention also provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the image display method of converting RGB888 into RGB565 is implemented.
[0025] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the image display method of converting RGB888 into RGB565.
[0026] The image display method, system, electronic device and storage medium for converting RGB888 into RGB565 provided by the present invention use a dither matrix for R, G, and B color channels so that a display panel driver chip that displays RGB565 images can drive and display RGB888 images with better image display effects and less visual distortion. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 It is a flow chart of the image display method of converting RGB888 into RGB565 provided by the present invention;
[0029] Figure 2 It is a flow chart of an embodiment of the image display method of converting RGB888 into RGB565 provided by the present invention;
[0030] Figure 3 It is the original image of RGB888 image;
[0031] Figure 4 It is an existing image display schematic diagram of directly intercepting the high bits to convert into RGB565 format and shifting and restoring to RGB888;
[0032] Figure 5 It is a schematic diagram of image display of converting RGB888 into RGB565 by the method of the present invention;
[0033] Figure 6It is a structural schematic diagram of the image display system for converting RGB888 into RGB565 provided by the present invention. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0035] like Figure 1 and Figure 2 As shown, the present invention provides an image display method for converting RGB888 into RGB565, which is applied to a display panel driver chip that displays RGB565 images, and improves the display effect of RGB565 images, including:
[0036] S1, obtains the original RGB888 image from the host, extracts the components of each color channel therefrom, and obtains the color channel matrix corresponding to each color channel.
[0037] S2, expanding the color channel matrix until the number of rows and columns of the color channel matrix are multiples of a set number.
[0038] S3, dividing the color channel matrix into a number of independent pixel blocks.
[0039] S4, separately saving the high-bit number and the low-bit number of each grayscale value of the pixel block.
[0040] S5, optimizing the value of the high-bit number of the grayscale value according to the low-bit number of the grayscale value and the dither matrix, and restoring the high-bit number of the optimized grayscale value to 8 bits for display.
[0041] Furthermore, the size of the color channel matrix is determined based on the resolution of the original RGB888 image obtained from the host. If the resolution of the actual input image is src_w*src_h, the matrix size of each color channel is src_h*src_w.
[0042] Further, the color channel matrix is expanded until the number of rows and columns of the color channel matrix is a multiple of a set number, including:
[0043] If the number of rows and columns of the color channel matrix is not a multiple of the set number, the last row or the last column of the color channel matrix is copied until the number of rows and columns of the color channel matrix are both multiples of the set number.
[0044] Specifically, since the maximum dither matrix of each component is set to 4*4, the setting number can be set to 4. If the number of rows and columns of the original image color channel matrix is not a multiple of 4, the last row and the last column are copied and added after the last row or the last column respectively until the number of rows and columns is a multiple of 4. The specific copy size is: 4-rem(src_h,4) for rows and 4-rem(src_w,4) for columns, and the rem function represents the remainder; if the number of rows and columns of the color channel matrix is a multiple of 4, it remains unchanged.
[0045] Furthermore, dividing the color channel matrix into a plurality of mutually independent pixel blocks comprises:
[0046] The color channel matrix corresponding to the G component is divided into mutually independent pixel blocks of 2*2 size; the color channel matrix corresponding to the R and B components is divided into mutually independent pixel blocks of 4*4 size.
[0047] Specifically, since the G component occupies 6 bits, the G component pixel matrix is divided into small blocks, each of which can be processed independently. The size of each block is 2*2, and the gray value in the block is recorded as Similarly, since the R and B components account for 5, the R and B component pixel matrices are divided into blocks of 4*4, and the grayscale value in the block is .
[0048] Furthermore, the step of separately storing the high-order digit and the low-order digit of each grayscale value of the pixel block comprises:
[0049] The upper 6 bits and lower 2 bits of each grayscale value of the pixel block corresponding to the G component are saved separately, which can be recorded as and The high 5 bits and low 3 bits of each gray value of the pixel block corresponding to the R and B components are saved separately and recorded as and , and .
[0050] Furthermore, the value of the high-bit number of the grayscale value is optimized according to the low-bit number of the grayscale value and the dither matrix, including:
[0051] The dither matrix coefficients are compared point-to-point with the low-bit numbers of the grayscale value. Based on the comparison result, it is determined whether the high-bit numbers of the grayscale value should be added to prevent overflow, and the high-bit numbers of the grayscale value are determined.
[0052] Since G occupies 6 bits and has 64 grayscale levels, to represent 256 grayscale levels, the required matrix size is 2x2, corresponding to the size of each block of G. Therefore, the dither matrix used in the algorithm simulation is ;Will Compared with the elements (thresholds) in the jitter matrix D, point-to-point operation is used here to With the threshold in D In comparison, if > , corresponding to the elements in the high-order matrix Add 1, otherwise Keep unchanged and treat the Output. If If overflow occurs when adding 1, directly take the highest grayscale. If overflow exceeds 2^6-1, directly take 2^6-1.
[0053] Correspondingly, R occupies 5 bits, 32 gray levels, to represent 256 gray levels, the required matrix size is 4x4, corresponding to the size of each block of R above, so the dither matrix used in the algorithm simulation is , the data in the matrix is 0~7, which corresponds to 3 bits, and the elements in each adjacent row and column of the jitter matrix are different, and the elements in the adjacent boundary of the corresponding jitter matrix of the next block are also different; The jitter matrix The elements (thresholds) in are compared, and point-to-point operations are used here. and Medium Threshold In comparison, if > , corresponding to the elements in the high-order matrix Add 1, otherwise Keep unchanged and treat the Output. If If overflow occurs when adding 1, the highest grayscale is directly taken. If overflow exceeds 2^5-1, 2^5-1 is directly taken. The processing method for B blocks is the same as that for R.
[0054] Furthermore, the display panel driver chip restores the optimized grayscale value high bit number to 8 bits for display, and can shift the G component to the left by 2 bits, and shift the R and B components to the left by 3 bits, respectively, to restore the display effect to the RGB888 format.
[0055] like Figure 3-Figure 5 As shown, the present invention processes the components of the RGB888 input image separately, divides each component into different independent blocks, and the blocks can be processed in parallel, which can accelerate the algorithm implementation. The dither matrix used for R, G, and B can make the image without grayscale loss in the process of converting RGB888 to RGB565 from the human eye visual angle, and the adjacent elements of the matrix are different, and the adjacent matrix edge elements are also different, which can make the image display effect better and less visual distortion.
[0056] The image display system for converting RGB888 into RGB565 provided by the present invention is described below. The image display device for converting RGB888 into RGB565 described below and the image display method for converting RGB888 into RGB565 described above can be referenced to each other.
[0057] like Figure 6 As shown, the present invention provides an image display system for converting RGB888 into RGB565, comprising:
[0058] The component extraction module is used to obtain the original RGB888 image, extract the components of each color channel, and obtain the color channel matrix corresponding to each color channel;
[0059] The image processing module is used to expand the color channel matrix until the number of rows and columns of the color channel matrix is a multiple of a set number; divide the color channel matrix into a plurality of independent pixel blocks; separately save the high-bit and low-bit of each gray value of the pixel block; optimize the value of the high-bit of the gray value according to the low-bit of the gray value and the dither matrix;
[0060] The image display module is used to restore the high-bit number of the optimized grayscale value to 8 bits for display.
[0061] The present invention also provides an electronic device. The electronic device may include: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. The processor may call logic instructions in the memory to execute an image display method for converting RGB888 into RGB565.
[0062] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0063] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the image display method of converting RGB888 into RGB565 provided by the above methods.
[0064] On the other hand, the present invention also provides a storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the image display method of converting RGB888 into RGB565 provided by the above methods.
[0065] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0066] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0067] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for converting RGB888 into RGB565 image display, applied to a display panel driver chip for displaying RGB565 images, characterized in that: include: Get the original RGB888 image from the host, extract the components of each color channel from it, and obtain the color channel matrix corresponding to each color channel; Expanding the color channel matrix until the number of rows and columns of the color channel matrix is a multiple of a set number; Dividing the color channel matrix into a plurality of mutually independent pixel blocks; The high-bit and low-bit numbers of each grayscale value of the pixel block are saved separately to obtain high-bit RGB565 and low-bit RGB323; Optimize the high-bit value of the grayscale value according to the low-bit value of the grayscale value and the dither matrix, and restore the high-bit value of the optimized grayscale value to 8 bits for display; The value of the high-bit number of the grayscale value is optimized according to the low-bit number of the grayscale value and the dither matrix, including: performing point-to-point comparison between the dither matrix coefficient and the low-bit number of the grayscale value, and optimizing the value of the high-bit number of the grayscale value according to the comparison result.
2. The image display method for converting RGB888 to RGB565 according to claim 1, characterized in that: The size of the color channel matrix is determined based on the resolution of the original RGB888 image obtained from the host.
3. The image display method for converting RGB888 into RGB565 according to claim 1, characterized in that: The step of expanding the color channel matrix until the number of rows and columns of the color channel matrix are multiples of a set number includes: If the number of rows and columns of the color channel matrix is not a multiple of the set number, the last row or the last column of the color channel matrix is copied until the number of rows and columns of the color channel matrix are both multiples of the set number.
4. The image display method for converting RGB888 into RGB565 according to claim 1, characterized in that: The step of dividing the color channel matrix into a plurality of mutually independent pixel blocks comprises: The color channel matrix corresponding to the G component is divided into mutually independent pixel blocks of 2*2 size; the color channel matrix corresponding to the R and B components is divided into mutually independent pixel blocks of 4*4 size.
5. The image display method for converting RGB888 into RGB565 according to claim 1, characterized in that: The step of separately storing the high-bit number and the low-bit number of each grayscale value of the pixel block comprises: The upper 6 bits and the lower 2 bits of each grayscale value of the pixel block corresponding to the G component are saved separately, and the upper 5 bits and the lower 3 bits of each grayscale value of the pixel block corresponding to the R and B components are saved separately.
6. The image display method for converting RGB888 into RGB565 according to claim 1, characterized in that: The step of optimizing the value of the high-bit number of the grayscale value according to the low-bit number of the grayscale value and the dither matrix includes: The dither matrix coefficients are compared point-to-point with the low-bit numbers of the grayscale value. Based on the comparison result, it is determined whether the high-bit numbers of the grayscale value should be added to prevent overflow, and the high-bit numbers of the grayscale value are determined.
7. An image display system for converting RGB888 into RGB565, characterized in that: include: The component extraction module is used to obtain the original RGB888 image from the host, extract the component of each color channel therefrom, and obtain the color channel matrix corresponding to each color channel; The image processing module is used to expand the color channel matrix until the number of rows and columns of the color channel matrix is a multiple of a set number; divide the color channel matrix into a plurality of independent pixel blocks; separately save the high-bit and low-bit of each gray value of the pixel block to obtain high-bit RGB565 and low-bit RGB323; optimize the value of the high-bit of the gray value according to the low-bit of the gray value and the dither matrix; Optimizing the value of the high-bit number of the grayscale value according to the low-bit number of the grayscale value and the dither matrix, including: performing point-to-point comparison between the dither matrix coefficient and the low-bit number of the grayscale value, and optimizing the value of the high-bit number of the grayscale value according to the comparison result; The image display module is used to restore the high-bit number of the optimized grayscale value to 8 bits for display.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the image display method of converting RGB888 into RGB565 as described in any one of claims 1 to 6 is implemented.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image display method of converting RGB888 into RGB565 as claimed in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the image display method of converting RGB888 into RGB565 as claimed in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Integrated circuit for frame rate control based on read-only memory and its design method
CN101034537A
Video processing device and method
CN104240672A