Software and hardware combined point 9 picture display method, system and device and storage medium
By combining hardware and software, the 9-point PNG images used in UI design are directly decoded, solving the problem of increased processing steps in existing technologies and achieving more efficient image display.
Patent Information
- Application Number
- CN202211278266.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-19
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2042-10-19
AI Technical Summary
The existing Android framework cannot directly support .9 PNG images drawn by UI designers. They need to be converted into PNG images containing .npTc type chunks using the aapt tool, which increases the processing steps and is especially inefficient when downloading from the network.
A combination of software and hardware is used: the software decoding module parses the header of the dot 9 image file, the hardware decoding module decodes the compressed data, and the 2D graphics acceleration engine performs stretching processing, allowing the dot 9 image file designed for the UI to be used directly.
It improves the processing speed of .9 PNG images, simplifies the processing flow, reduces reliance on the aapt tool, and enhances the display efficiency of network downloads.
Smart Images

Figure CN115904570B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and in particular to a hardware and software combined method, system, device and storage medium for displaying 9-dot images. Background Technology
[0002] In existing technologies, such as Figure 1 As shown, the use of dot 9png in Android involves three steps: (1) UI designers create dot 9png images using image processing tools such as Photoshop and deliver them to software developers; (2) Software developers use tools such as aapt (Android Assert Packaging Tool) to create dot 9png images. Figure 2 As shown, firstly, the 9-point png is converted into an RGB image of png format with the black lines marking the edges of the image removed, and the block information is written into a chunk (data block) of type "npTc" in the png. This chunk contains the coordinate information of the stretchable block and the coordinate information of the displayable area. (3) The png containing the "npTc" type chunk is displayed on screens with different resolutions. In order to adapt to different screens, the stretchable image blocks can be stretched.
[0003] Based on Android's processing flow for .9png files, the existing Android framework cannot directly support images with the ".9.png" extension drawn directly by UI designers. It only supports PNG images that have been compiled and converted into PNG images containing "npTc" type chunks. The "npTc" chunks contain the .9png's block information before the .9png is displayed. Performing format conversion during the compilation stage can improve the loading speed of .9png display, but it adds an extra step in image processing. Furthermore, if the .9png image displayed by the app is not included with the local APK installation but downloaded from the network, the app needs to call aapt in real-time for format conversion before displaying the .9png. In this case, pre-compilation cannot improve loading speed. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a highly efficient, hardware-software integrated method, system, device, and storage medium for displaying 9-dot images.
[0005] On one hand, embodiments of the present invention provide a hardware-software combined method for displaying 9-dot images, including:
[0006] Obtain the image file for point 9 to be processed;
[0007] The header file of the image file to be processed (point 9) is parsed using a software decoding module to obtain parsed data.
[0008] The parsed data includes image format information and image compression data;
[0009] The compressed data is classified and decoded using a hardware decoding module to obtain decoded data.
[0010] The decoded data includes block information, image data, and display area information;
[0011] Based on the decoded data, the target image is stretched to obtain the stretched display image.
[0012] Optionally, obtaining the image file of point 9 to be processed includes:
[0013] Read the image file containing the .9.png extension from the target file directory;
[0014] The target file directory includes the APK installation directory and the resource file directory.
[0015] Optionally, the header parsing of the image file for point 9 to be processed to obtain parsed data includes:
[0016] The image file of point 9 to be processed is subjected to data block classification and parsing to obtain parsed data;
[0017] The image file at point 9 to be processed includes a header data block and an image data block.
[0018] Optionally, the step of performing data block classification and parsing on the image file of point 9 to obtain parsed data includes:
[0019] Parse the file header data block to obtain the image format information;
[0020] The image data block is parsed to obtain compressed image data.
[0021] Optionally, the parsed data further includes palette information and transparency information, and the image file of point 9 to be processed further includes palette data blocks and image transparency data blocks. The step of classifying and parsing the data blocks of the image file of point 9 to obtain the parsed data further includes:
[0022] Parse the palette data block to obtain palette information;
[0023] The transparency data block of the image is parsed to obtain transparency information.
[0024] Optionally, the step of classifying and decoding the compressed data to obtain decoded data includes:
[0025] Obtain the block data with the initial number from the compressed data, and use the block data with the initial number as the target block data;
[0026] The compression format type of the target block data is determined;
[0027] The compression format types include uncompressed format, fixed Huffman table compression format, and dynamic Huffman table compression format;
[0028] Based on the compression format type of the target block data, the target block data is classified and decoded to obtain initial decoded data;
[0029] Wherein, the uncompressed compressed data does not require decoding and the initial decoded data is obtained directly;
[0030] The initial decoded data is classified to obtain decoded sub-data;
[0031] The decoded sub-data is one of block information, image data, or display area information;
[0032] The block data with the number incremented by one is used as the target block data. Then, the step of determining the compression format type of the target block data is returned until all block data in the compressed data has been decoded.
[0033] The decoded data is the collection of all decoded sub-data.
[0034] Optionally, the step of stretching the target image based on the decoded data to obtain the stretched display image includes:
[0035] Based on the image data, determine the target image;
[0036] Based on the target image and the segmentation information, the target image is stretched using a 2D graphics acceleration engine to obtain the stretched display image.
[0037] The target image is divided into non-stretchable graphic blocks and stretchable image blocks based on the block information.
[0038] The stretching process includes the moving of non-stretchable image blocks and the moving and scaling of stretchable graphic blocks in the target image.
[0039] On the other hand, embodiments of the present invention provide a hardware and software combined dot 9 image display system, including:
[0040] The file acquisition module is used to acquire the image file of point 9 to be processed;
[0041] The software decoding module is used to parse the header file of the image file to be processed (point 9) to obtain parsed data; wherein, the parsed data includes image format information and image compression data;
[0042] A hardware decoding module is used to classify and decode the compressed data to obtain decoded data; wherein, the decoded data includes block information, image data, and display area information;
[0043] The display module is used to stretch the target image based on the decoded data to obtain a stretched display image.
[0044] On the other hand, embodiments of the present invention provide a hardware and software combined dot 9 image display device, including a processor and a memory;
[0045] The memory is used to store programs;
[0046] The processor executes the program to implement the method described above.
[0047] On the other hand, embodiments of the present invention provide a computer-readable storage medium storing a program that is executed by a processor to implement the methods described above.
[0048] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned method.
[0049] This invention first acquires a point 9 image file to be processed; then, using a software decoding module, it parses the header file of the point 9 image file to obtain parsed data; wherein, the parsed data includes image format information and image compression data; next, using a hardware decoding module, it performs classification decoding on the compressed data to obtain decoded data; wherein, the decoded data includes block information, image data, and display area information; based on the decoded data, it performs stretching processing on the target image to obtain a stretched display image. This invention, through a decoding logic implemented by combining a software decoding module and a hardware decoding module, performs header file parsing and classification decoding on the point 9 image file to obtain decoded data, eliminating the need for prior conversion using processing tools and allowing direct use of point 9 images drawn by UI designers; furthermore, by using a hardware decoding module to process the compressed data, which is slow to process with software, it effectively improves processing speed. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 This is a diagram illustrating the usage of .9png in Android.
[0052] Figure 2 Convert the .9png file into a flowchart containing "npTc" for aapt;
[0053] Figure 3 A 9-bit PNG image illustrating points marked with black lines;
[0054] Figure 4 This is a schematic diagram of the points after being divided into blocks (9png image).
[0055] Figure 5 This is a schematic diagram of the area displayed in the 9-dot PNG image;
[0056] Figure 6 A schematic flowchart illustrating the hardware and software combined point 9 image display method provided in this embodiment of the invention;
[0057] Figure 7 This is a diagram illustrating the compression format of Chunk Data.
[0058] Figure 8 This is a schematic diagram of the hardware decoding process for a dot 9 image provided in an embodiment of the present invention;
[0059] Figure 9 This is a schematic diagram of a 9-pin PNG image containing black lines with specific numerical markings, provided as an embodiment of the present invention.
[0060] Figure 10 This is a schematic diagram of a 9-pin PNG image of points after specific numerical block division provided in an embodiment of the present invention;
[0061] Figure 11 This is a schematic diagram of the specific numerical display area of the dot 9 png image provided in an embodiment of the present invention;
[0062] Figure 12 This is a schematic diagram of the batch structure for Command Queue processing provided in an embodiment of the present invention;
[0063] Figure 13 This is a schematic diagram illustrating the effect of block stretching of a 9-dot PNG image provided in an embodiment of the present invention.
[0064] Figure 14 A flowchart illustrating the Blit operation of the Graphics Engine provided in an embodiment of the present invention;
[0065] Figure 15 A flowchart illustrating the StretchBlit operation of the Graphics Engine provided in this embodiment of the invention;
[0066] Figure 16 This is a schematic diagram of the overall process of the hardware and software combined point 9 image display method provided in the embodiments of the present invention. Detailed Implementation
[0067] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0068] First, it's important to note that .9 PNG, also known as a .9 image, is a special image format used in Android development. One advantage of this format is that it can adapt to different screen resolutions without affecting clarity. Furthermore, apps don't need to package multiple UI resources for different resolutions, reducing app size. The principle is to divide the entire image into blocks, some of which are stretchable and others are not. When creating the image, rounded corners and other areas can be marked as non-stretchable (stretching will blur), while some central areas can be set as stretchable. The difference between .9 PNG and regular PNG images is:
[0069] (1) The file extension for a regular PNG image is ".png", while the file extension for a .9 PNG image is ".9.png".
[0070] (2) The compression method is the same as PNG, but there is an additional 1-pixel wide black line on the top, left, bottom, and right sides, such as... Figure 3 As shown, this straight line is not for display purposes; it is only used to mark the image. The top and left lines mark the stretchable area. The right and bottom lines mark the display area.
[0071] refer to Figure 3 The original image can be divided into 9 smaller sections by the black lines at the top and left, as shown below. Figure 4 As shown, the area within the black lines is stretchable, while the area outside the black lines is non-stretchable. (The horizontal and vertical stretch marker lines can also be discontinuous, allowing the original image to be divided into more smaller blocks. The principle is similar and will not be elaborated further.)
[0072] (1) Among them, image blocks 0, 2, 6, and 8 are non-stretchable image blocks;
[0073] (2) Image block 4 can be stretched in both horizontal and vertical directions;
[0074] (3) Image blocks 1 and 7 can only be stretched in the horizontal direction;
[0075] (4) Image blocks 3 and 5 can only be stretched vertically.
[0076] refer to Figure 3 The black lines on the right and bottom of the middle section mark the display area, such as... Figure 5 As shown in the dashed box, other content that can be superimposed can only be displayed within the dashed box and cannot extend beyond it.
[0077] On the one hand, refer to Figure 6 Embodiments of the present invention provide a hardware-software combined method for displaying 9-dot images, including:
[0078] S100, Obtain the image file for point 9 to be processed;
[0079] It should be noted that the image file to be processed, with the file extension .9.png, is read from the target file directory; the target file directory includes the APK installation directory and the resource file directory.
[0080] Specifically, the system on which the technical solution of this invention runs is not limited to Android; it can also run on Linux or RTOS. On Android, the dot9png file is obtained from the APK installation directory, while on Linux or other systems, the dot9png file is placed in a resource file directory accessible to the application.
[0081] S200: The header file of the image file to be processed (point 9) is parsed using the software decoding module to obtain the parsed data;
[0082] It should be noted that the parsed data includes image format information and image compression data; the header file of the image file to be processed (point 9) is parsed to obtain the parsed data, including: the data block classification parsing of the image file to be processed (point 9) to obtain the parsed data; wherein, the image file to be processed (point 9) includes file header data blocks and image data blocks.
[0083] The image file at point 9 is parsed by classifying and analyzing data blocks to obtain the parsed data, including: parsing the file header data block to obtain image format information; and parsing the image data block to obtain image compressed data.
[0084] In some embodiments, the parsed data also includes palette information and transparency information. The image file of point 9 to be processed also includes palette data blocks and image transparency data blocks. The parsing of the image file of point 9 to be processed by data block classification to obtain parsed data also includes: parsing the palette data blocks to obtain palette information; and parsing the image transparency data blocks to obtain transparency information.
[0085] Specifically, the parsing of the .9png header file is handled by software, which has a relatively low workload. The header file can be used to parse the width, height, and other format information of the PNG. It's important to note that while the .9png format is consistent with the PNG compression format, due to the presence of black borders, the width and height information parsed from the header file is larger than the actual width and height of the image to be displayed (by 2).
[0086] The PNG header file parsing instructions are as follows:
[0087] The PNG file structure consists of various chunks (data blocks), as shown in Table 1, which provides a basic description of PNG data blocks:
[0088] Table 1
[0089] chunk Type Data block name IHDR File header data block PLTE Palette data blocks tRNS Image Transparent Data Block IDAT Image data blocks IEND Image End Data Block
[0090] Different types of chunks have the same structure, as shown in Table 2:
[0091] Table 2
[0092]
[0093] The chunk data in the chunk with Chunk Type Code "IHDR" is arranged as shown in Table 3:
[0094] Table 3
[0095]
[0096]
[0097] Other types of chunk structures will not be discussed further, but the principles are similar.
[0098] Header file parsing via software decoding mainly involves parsing different types of chunk structures, including the following types:
[0099] (1) Parse the chunk of type "IHDR" to obtain the width / height information of the PNG image;
[0100] (2) If there is a chunk of type “PLTE”, parse the chunk of this type to obtain the color palette information. The color palette information is only used as the color mapping after PNG decoding. The color mapping is not very relevant to this invention and will not be elaborated on.
[0101] (3) If a chunk of type “tRNS” exists, the chunk of this type is parsed to obtain the transparency information. The transparency information is not very relevant to this invention and will not be elaborated on further.
[0102] (4) Parse the chunk of type "IDAT" to obtain the Chunk Data, where
[0103] The data in Chunk Data is in zlib compressed format, such as Figure 7 As shown, it includes 1 BYTE CMF, 1 BYTE FLG, compressed data, and 4 BYTE ADLER32, wherein:
[0104] CMF: CMF is a description of the compression method, which is parsed by the software. In PNG, this information is fixed and can be skipped directly.
[0105] FLG: Some marker information related to zlib decoding, which is parsed by the software. This information is fixed in the PNG and can be skipped directly.
[0106] Compressed data: This part of the data is the data that the hardware decoding module actually needs to process;
[0107] ADLER32: It is only used to verify the correctness of the results. To speed up the processing, it can be skipped.
[0108] After the software parses the header file, the compressed data portion in "IDAT" is sent to the hardware decoding module for PNG hardware decoding.
[0109] S300: The compressed data is classified and decoded through the hardware decoding module to obtain the decoded data;
[0110] It should be noted that the decoded data includes block information, image data, and display area information. The compressed data is classified and decoded to obtain decoded data, including: obtaining the block data with the initial number from the compressed data, using the block data with the initial number as the target block data; determining the compression format type of the target block data; where the compression format type includes uncompressed format, fixed Huffman table compression format, and dynamic Huffman table compression format; based on the compression format type of the target block data, classifying and decoding the target block data to obtain initial decoded data; where uncompressed compressed data does not need to be decoded and the initial decoded data is obtained directly; classifying the initial decoded data to obtain decoded sub-data; where the decoded sub-data is one of block information, image data, or display area information; using the block data with the number incremented by one as the target block data, and then returning to the step of determining the compression format type of the target block data, until all block data in the compressed data has been decoded; where the decoded data is the collection of all decoded sub-data.
[0111] Specifically, compressed data can be divided into multiple blocks, and each block may use different compression methods, such as... Figure 8 As shown, hardware decoding determines the different block types at the beginning of each block.
[0112] The area within the dashed box represents the hardware decoding process of the .9png compressed file. The area outside the dashed box is handled by the software decoding module. "PNG Parser" refers to the software parsing of the PNG header information (i.e., header file parsing). "Read zlib Header" refers to the software parsing of the zlib compressed data header information. Since the PNG compressed bitstream may contain multiple blocks, the hardware decoder checks the different block types at the beginning of each block. .9png hardware decoding decodes on a block-by-block basis, and the hardware continuously checks whether the current block is the last block. "Output" refers to the PNG decoding output (i.e., decoded data), which includes three parts:
[0113] (1) Stretchable / non-stretchable block information (i.e. block information) is written by hardware into DDR (Double Data Rate Synchronous Dynamic Random Access Memory) or read-only register;
[0114] (2) The RGB image information (i.e., image data) with one pixel of black border on the top, bottom, left, and right sides is cropped and written to DDR by hardware. This is obtained by parsing the image format information (including image height and width) from the header file; for example, if the size of a .9 PNG image is 62x42, then the displayable content area excluding the black border is 60x40.
[0115] (3) The coordinate information of the display area (i.e., the display area information) can be written into DDR or read-only register by hardware.
[0116] Writing to DDR or read-only registers makes no difference in functionality; both are alternatives. However, cost is a consideration during hardware design, resulting in a cost difference between the two methods. When dealing with large amounts of data, writing to DDR is more suitable.
[0117] It should be noted that, Figure 8 The dashed box contains the PNG hardware decoding part:
[0118] "BTYPE=?" indicates the type of compression format for the block, which includes three types:
[0119] 0: Uncompressed format;
[0120] 1: Fixed Huffman table compression format;
[0121] 2: This is a dynamic Huffman table compression format.
[0122] The three types mentioned here simply describe three types of zlib decompression processes. Regardless of the zlib format, the final output is an uncompressed format.
[0123] The output section further evaluates the decoded, uncompressed image data, dividing it into three categories:
[0124] (1) Stretchable / non-stretchable block information (i.e. block information);
[0125] (2) Image data (i.e., picture data);
[0126] (3) Can display partial coordinates (i.e. display area information).
[0127] (2) is the decompressed image data directly written into DDR (pixels in the non-image boundary part), and (1) and (3) are the decompressed image boundary pixels converted into corresponding coordinate information and written out.
[0128] Taking a 62x42 pixel .9 PNG image as an example, the displayable content area excluding the black border is 60x40. Decoding yields:
[0129] (1) Stretchable data output, which can be divided into two directions:
[0130] like Figure 9 As shown, where m is the index number of the horizontal block, starting from 0, the horizontal coordinate is represented by X[m], and the horizontal stretchability flag is represented by X_FLAG[m]. Therefore:
[0131] X[0]=24, X[1]=36, X[2]=60;
[0132] X_FLAG[0]=0, X_FLAG[1]=1, X_FLAG[2]=0;
[0133] Where n is the index number of the vertical block, starting from 0, the vertical coordinate is represented by Y[m], and the horizontal stretchability flag is represented by Y_FLAG[m]. Therefore:
[0134] Y[0]=14, Y[1]=28, Y[2]=40;
[0135] Y_FLAG[0]=0, Y_FLAG[1]=1, Y_FLAG[2]=0;
[0136] Based on the hardware output information above, detailed information about the stretchable / non-stretchable block can be calculated, including the coordinate range and whether it is stretchable, such as... Figure 10 As shown.
[0137] Let start_x[i][j] and start_y[i][j] represent the coordinate offset of the top-left corner of each block, and end_x[i][j] and end[i][j] represent the coordinate offset of the bottom-right corner of each block. Then we have:
[0138] Block 00: start_x[0][0]=0, start_y[0][0]=0; end_x[0][0]=24, end_y[0][0]=14, cannot be stretched horizontally or vertically.
[0139] Block 01: start_x[0][1] = 24, start_y[0][1] = 0; end_x[0][1] = 36, end_y[0][1] = 14, horizontally stretchable, vertically non-stretchable.
[0140] Block 02: start_x[0][2] = 36, start_y[0][2] = 0; end_x[0][2] = 60, end_y[0][2] = 14, cannot be stretched horizontally or vertically.
[0141] Block 10: start_x[1][0]=0, start_y[1][0]=14; end_x[1][0]=24, end_y[1][0]=28, both can be stretched vertically.
[0142] Block 11: start_x[1][1] = 24, start_y[1][1] = 14; end_x[1][1] = 36, end_y[1][1] = 28, can be stretched horizontally and vertically.
[0143] Block 12: start_x[1][2] = 36, start_y[1][2] = 14; end_x[1][2] = 60, end_y[1][2] = 28, both can be stretched vertically.
[0144] Block 20: start_x[2][0]=0, start_y[2][0]=28; end_x[2][0]=24, end_y[2][0]=40, cannot be stretched horizontally or vertically.
[0145] Block 21: start_x[2][1] = 24, start_y[2][1] = 28; end_x[2][1] = 36, end_y[2][1] = 40, horizontally stretchable, vertically non-stretchable
[0146] Block 22: start_x[2][2] = 36, start_y[2][2] = 28; end_x[2][2] = 60, end_y[2][2] = 40, cannot be stretched horizontally or vertically.
[0147] (2) The content area that can be displayed is as follows: Figure 11 As shown in the dashed box in the image.
[0148] `disp_start_x` and `disp_start_y` are the coordinates of the top-left corner of the displayable content area, and `disp_end_x` and `disp_end_y` are the coordinates of the bottom-right corner of the displayable content area. Therefore, `disp_start_x` = 14, `disp_end_y` = 12, `disp_end_x` = 50, and `disp_end_y` = 26. These display area coordinates are provided to the app to tell it the area where text and other content can be displayed. Specifically, the displayable content area tells the application which areas can overlay new content. For example, if the user wants to display text information, the text can only be overlaid within the dashed box, not outside the dashed box.
[0149] S400: Based on the decoded data, stretch the target image to obtain the stretched display image.
[0150] It should be noted that the target image is determined based on the image data;
[0151] Based on the target image and its segmentation information, a 2D graphics acceleration engine is used to stretch the target image to obtain the stretched display image. The target image is divided into non-stretchable graphic blocks and stretchable image blocks based on the segmentation information. The stretching process includes the movement of non-stretchable image blocks and the movement and scaling of stretchable graphic blocks in the target image.
[0152] Specifically, the 2D GE (2D Graphics Engine) uses a command queue approach for processing, obtaining the RGB image to be processed and the corresponding stretchable / non-stretchable block information from the second part of the output processing results. Since the blocks are 9, as shown... Figure 12 As shown, GE splits the task into 9 tasks, and then merges the 9 tasks into a batch for processing.
[0153] Task: The smallest unit of task that the Graphics Engine (GE) can execute, such as a single blit operation.
[0154] Batch: The smallest unit of software control in GE (Executable Execution System), it is a collection of commands that can contain one or more Tasks.
[0155] Command Queue: A command queue that manages batches. Hardware reads control commands through the Command Queue.
[0156] Without a Command Queue, each task in a GE (Executable Execution Service) requires an interrupt. With a Command Queue, GE can execute multiple batches at once, requiring another interrupt, thus reducing system scheduling overhead.
[0157] The final stretched image is shown below. Figure 13 As shown, the sizes of blocks 0, 2, 6, and 8 remain unchanged, while blocks 1, 3, 4, 5, and 7 have been enlarged and can utilize the `blit` and `stretchblit` operations of Gestalt Engine (GE). This corresponds to nine GE tasks, including four `blit` operations and five `stretchblit` operations, which are combined into a single batch and executed together to output the enlarged, stretched image.
[0158] It should also be noted that the GE Blit / StretchBlit function description is as follows:
[0159] (1)Blit
[0160] The rectangular region of the original image is moved to the rectangular region of the target image without scaling, such as... Figure 14 As shown.
[0161] (2)StretchBlit
[0162] The rectangular region of the original image is moved to the rectangular region of the target image, and simultaneously enlarged or reduced, such as... Figure 15 As shown. Image scaling can be achieved using interpolation algorithms such as bilinear interpolation or bicubic interpolation.
[0163] in, Figure 14 and Figure 15 The annotations in the text are as follows:
[0164] Source Image Addr: Original image address;
[0165] Source Image Stride: Align the original image rows;
[0166] Dst Image Addr: Address of the target image;
[0167] Dst Image Stride: Target image alignment;
[0168] x_offset: The horizontal offset of the position coordinate to be operated on;
[0169] y_offset: The vertical offset of the position to be operated on;
[0170] W: Width of the image area to be manipulated;
[0171] H: The height of the image region to be manipulated.
[0172] It should also be noted that each block in the 9-point png uses the Blit / StretchBlit operation. You only need to specify the offset of the original image and the offset of the target image for the region to be operated on, and set the input width / height and the output width / height. If there are 9 blocks, 9 Blit / StretchBlit operations are required. If the command queue method is used, each Blit / StretchBlit is a task, and each task has its own command, which includes information such as the address / offset / width / height of the original image. If there are a total of 9 tasks, the commands of the 9 tasks are written to the command queue, and then GE is started together. GE executes the 9 configured tasks sequentially.
[0173] In summary, such as Figure 16 As shown, the hardware-software integrated 9-png display scheme proposed in this invention can run on operating systems such as Android, Linux, and RTOS. It mainly consists of three steps: image input, 9-png decoding and output, and 2D acceleration and output of stretched images. The first step reads a 9-png file with the suffix ".9.png" from a file. The second step involves decoding the 9-png. During decoding, the PNG header information is parsed by the software, which has a relatively low workload. The width, height, and other format information of the PNG can be parsed from the header file. It should be noted that the format of the 9-png is the same as the PNG compression format, but due to the presence of black borders, the width and height information parsed from the header file are larger than the actual width and height of the image to be displayed by 2. Since the black borders have been cropped, the width and height of the hardware-decoded RGB image output must be subtracted by 2 to obtain the actual RGB width and height of the hardware output. The third step uses 2D GE with a command queue to process the image, obtaining the RGB image to be processed and the corresponding stretched / non-stretchable block information from the processing results of the second step. Because the task is divided into 9 blocks, GE splits the task into 9 tasks, and then merges the 9 tasks into a single batch for processing. Compared to Android's existing framework, which cannot directly support images with the ".9.png" extension drawn directly by UI designers, but only supports PNG images that have been compiled and converted to contain "npTc" type chunks, this invention proposes a hardware-software combined method for displaying .9 images. The general idea is to offload the slow-processing parts of the software to the hardware. Due to the improved processing speed, the software processing flow can be simplified, and the app can directly use the ".9.png" images drawn by the UI designer without further conversion by processing tools. This invention can efficiently decode images with the ".9.png" extension, further improving the processing speed of .9png images.
[0174] On the other hand, embodiments of the present invention provide a hardware and software combined dot 9 image display system, including: a file acquisition module for acquiring a dot 9 image file to be processed; a software decoding module for parsing the header file of the dot 9 image file to be processed to obtain parsed data; wherein the parsed data includes image format information and image compression data; a hardware decoding module for classifying and decoding the compressed data to obtain decoded data; wherein the decoded data includes block information, image data and display area information; and a display module for stretching the target image according to the decoded data to obtain a stretched display image.
[0175] The content of the method embodiments of the present invention is applicable to the system embodiments. The specific functions implemented in the system embodiments are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0176] Another aspect of the present invention provides a hardware and software combined dot 9 image display device, including a processor and a memory;
[0177] The memory is used to store programs;
[0178] The processor executes the program to implement the method described above.
[0179] The content of the method embodiments of the present invention is applicable to the embodiments of the present electronic device. The specific functions implemented by the embodiments of the present electronic device are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0180] Another aspect of this invention provides a computer-readable storage medium storing a program that is executed by a processor to implement the methods described above.
[0181] The content of the method embodiments of the present invention is applicable to the computer-readable storage medium embodiments. The specific functions implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0182] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned method.
[0183] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is altered and sub-operations described as part of a larger operation are executed independently.
[0184] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the described functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.
[0185] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0186] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution means, apparatus, or device (such as a computer-based device, a processor-including device, or other means that can fetch and execute instructions from, or in conjunction with, an instruction execution means, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution means, apparatus, or device.
[0187] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0188] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution device. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0189] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0190] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
[0191] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.
Claims
1. A hardware-software integrated method for displaying 9-dot images, characterized in that, include: Obtain the image file for point 9 to be processed; The image file for point 9 to be processed is an image file with the file extension .9.png; The header file of the image file to be processed (point 9) is parsed using a software decoding module to obtain parsed data. The parsed data includes image format information and image compression data; the header file parsing includes: parsing the header data block of the image file to be processed (point 9) to obtain the image format information, and parsing the image data block to obtain the image compression data; The compressed data is classified and decoded using a hardware decoding module to obtain decoded data. The decoded data includes block information, image data, and display area information. The hardware decoding module performs classification decoding of the compressed data, including: the hardware decoding module receives the zlib compressed bitstream stripped by the software decoding module, and decodes it separately for three types of compression formats: uncompressed, fixed Huffman, and dynamic Huffman, using independent blocks as units; after the hardware decoding module completes decoding, it simultaneously performs: scanning the 1px marker pixels around the edges of the image file to be processed (point 9), calculating the horizontal / vertical stretching range and content display boundary coordinates, generating a nine-grid block information; and cropping the 1px marker black borders around the edges of the image file to be processed (point 9), outputting clean, unmarked RGB image data. Based on the decoded data, the target image is stretched to obtain the stretched display image; The step of stretching the target image based on the decoded data includes: splitting the image into 9 blocks according to the nine-grid block information, performing a non-scaling copy operation on the 4 corner blocks, performing a scaling operation on the 5 border blocks, merging them into a single command queue and sending them in batches to the 2D graphics acceleration engine to complete the regional rendering output of the entire image at one time.
2. The hardware-software combined point 9 image display method according to claim 1, characterized in that, The process of obtaining the image file of point 9 to be processed includes: Read the image file containing the .9.png extension from the target file directory; The target file directory includes the APK installation directory and the resource file directory.
3. The hardware-software combined point 9 image display method according to claim 1, characterized in that, The header file of the image file to be processed (point 9) is parsed to obtain parsed data, including: The image file of point 9 to be processed is subjected to data block classification and parsing to obtain parsed data; The image file at point 9 to be processed includes a header data block and an image data block.
4. The hardware-software combined point 9 image display method according to claim 3, characterized in that, The parsed data also includes palette information and transparency information. The image file of point 9 to be processed also includes palette data blocks and image transparency data blocks. The step of classifying and parsing the data blocks of the image file of point 9 to be processed to obtain the parsed data further includes: Parse the palette data block to obtain palette information; The transparency data block of the image is parsed to obtain transparency information.
5. The hardware-software combined point-9 image display method according to claim 1, characterized in that, The process of classifying and decoding the compressed data to obtain decoded data includes: Obtain the block data with the initial number from the compressed data, and use the block data with the initial number as the target block data; The compression format type of the target block data is determined; The compression format types include uncompressed format, fixed Huffman table compression format, and dynamic Huffman table compression format; Based on the compression format type of the target block data, the target block data is classified and decoded to obtain initial decoded data; Wherein, the uncompressed compressed data does not require decoding and the initial decoded data is obtained directly; The initial decoded data is classified to obtain decoded sub-data; The decoded sub-data is one of block information, image data, or display area information; The block data with the number incremented by one is used as the target block data. Then, the step of determining the compression format type of the target block data is returned until all block data in the compressed data has been decoded. The decoded data is the collection of all decoded sub-data.
6. The hardware-software combined point-9 image display method according to claim 1, characterized in that, The step of stretching the target image based on the decoded data to obtain the stretched display image includes: Based on the image data, determine the target image; Based on the target image and the segmentation information, the target image is stretched using a 2D graphics acceleration engine to obtain the stretched display image. The target image is divided into non-stretchable graphic blocks and stretchable image blocks based on the block information. The stretching process includes the moving of non-stretchable image blocks and the moving and scaling of stretchable graphic blocks in the target image.
7. A hardware and software integrated point-9 image display system, characterized in that, include: The file acquisition module is used to acquire the image file of point 9 to be processed; The image file for point 9 to be processed is an image file with the file extension .9.png; The software decoding module is used to parse the header file of the image file to be processed (point 9) to obtain parsed data; wherein, the parsed data includes image format information and image compression data; the header file parsing includes: parsing the header data block of the image file to be processed (point 9) to obtain the image format information, and parsing the image data block to obtain the image compression data; A hardware decoding module is used to classify and decode the compressed data to obtain decoded data. The decoded data includes block information, image data, and display area information. Classifying and decoding the compressed data using the hardware decoding module includes: the hardware decoding module receiving the zlib compressed bitstream stripped by the software decoding module, and classifying and decoding three types of compression formats—uncompressed, fixed Huffman, and dynamic Huffman—using independent blocks as units; after completing the decoding, the hardware decoding module synchronously performs the following: scanning the 1px marker pixels around the edges of the image file to be processed (point 9), calculating the horizontal / vertical stretching interval and content display boundary coordinates, and generating a nine-grid block information; and cropping the 1px marker black borders around the edges of the image file to be processed (point 9), outputting clean, unmarked RGB image data. The display module is used to stretch the target image based on the decoded data to obtain a stretched display image; The step of stretching the target image based on the decoded data includes: splitting the image into 9 blocks according to the nine-grid block information, performing a non-scaling copy operation on the 4 corner blocks, performing a scaling operation on the 5 border blocks, merging them into a single command queue and sending them in batches to the 2D graphics acceleration engine to complete the regional rendering output of the entire image at one time.
8. A hardware and software combined dot 9 image display device, comprising a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The storage medium stores a program that is executed by a processor to implement the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Image decoding method and device, electronic equipment and storage medium
CN111314699A
Method for realizing point nine effect picture display in MacOS system and related equipment
CN114546378A
