Decompression test case generation method and device based on PDC compression algorithm and medium
By generating compressed data of a specified size, the problem of generating test cases in the PDC compression algorithm is solved, efficient compressed data verification is achieved, verification scenarios are enriched, design defects are discovered, and the effectiveness of the compression algorithm is improved.
Patent Information
- Application Number
- CN202411596685.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-11-11
AI Technical Summary
The prior art is difficult to efficiently generate decompression/compression test cases that can specify the compression size of image data, especially in the design implementation of PDC compression algorithms. Failure to effectively verify whether the test cases are compressible and compressed, resulting in difficult design implementation.
By determining the compression rate of the test case, the compressed data length is randomly generated, and the BLH value and difference value of each pixel are generated based on the length, compressed data is generated to ensure the randomness of the compressed data and the specified size, thereby generating compressed test cases.
It realizes efficient generation of random compressed data test vectors, enriches the verification scenarios, discovers defects and problems in the design implementation in advance, and ensures the effectiveness and efficiency of the PDC compression algorithm.
Smart Images

Figure CN119135883A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing, and in particular to a method, device and medium for generating a decompression test case based on a PDC compression algorithm. Background Art
[0002] Usually, image data transmission consumes a lot of bandwidth. Unprocessed image data transmission is inefficient and power-hungry. Lossless image compression is a technology that converts the original image data into a format with a smaller storage unit for storage and transmission after some specific processing, and then restores it after specific processing. Predictable_Delta_Compress (PDC) compression is a compression and decompression method that can compress 128B / 256B original image data into different sizes such as 32B / 64B / 94B… / 224B. Because there is a lot of uncertainty in the scenario of whether image data can be compressed, it is necessary to know in advance whether the generated test case is compressible data and the size to which the test case can be compressed when designing the module. This brings certain difficulties to the verification of the design and implementation of the PDC compression algorithm.
[0003] Therefore, how to efficiently generate decompression / compression test cases that can specify the compression size of image data based on the PDC compression algorithm is an urgent problem to be solved. Summary of the invention
[0004] The object of the present invention is to provide a method, device and medium for generating a decompression test case based on a PDC compression algorithm, so as to at least partially solve the above-mentioned problem.
[0005] According to one aspect of the present disclosure, a method for generating a decompression test case based on a PDC compression algorithm is proposed, comprising: Step S1, determine the compression rate comp_rate of the test case, Step S2, randomly generate the length of the compressed data comp_data_len according to comp_rate, where comp_data_len>=240bit, Step S3, randomly generate the lengths of Pu_data_ra and pu_data_gb according to the compressed data length comp_data_len, where pu_data_ra_len + pu_data_bg_len = comp_data_len, and pu_data_ra_len>=120, pu_data_bg_len>=120, Step S4, randomly generate the BLH values of the four types of pixels R, G, B, and A of each group in the tile, BLH_A_0~BLH_A_3, BLH_R_0~BLH_R_3, BLH_B_0~BLH_B_3, BLH_G_0~BLH_G_3, and the value range of each BLH is 1~7, where, (BLH_A_0 + BLH_A_1 + BLH_A_2 + BLH_A_3 + BLH_R_0 + BLH_R_1 + BLH_R_2+ BLH_R_3) * 8 + 56 = pu_data_ra_len Among them, BLH is the most significant bit of the maximum number of bits required for the difference res of each pixel pix in each group. Step S5, generate the difference res_m_n[i] of each pixel pix according to the BLH value of each group, the difference value range is: 0~(2*BLH_m_n)-1, and for each group of 8 res, at least one of res_m_n [BLH_m_n-1] is 1, where m is R, A, B, G, n is 0~3, i is 0~7, Step S6, according to the res value of each pix, generate the difference values of each group of four kinds of pixels R, A, B, and G, pack_data_R, pack_data_A, pack_data_B, pack_data_G, respectively. Step S7, randomly generate the mean value of each pixel of RGBA, that is, the value of DC_R, DC_A, DC_B, DC_G, Step S8, generate Pu_data_ra, pu_data_gb, where: Pu_data_ra = { Pack_data_R , Pack_data_A, DC_R, DC_A, BLH_R_3, BLH_R_2, BLH_R_1, BLH_R_0, BLH_A_3, BLH_A_2, BLH_A_1, BLH_A_0, pu_data_ra_len}, Pu_data_bg = { Pack_data_B, Pack_data_G, DC_B, DC_G, BLH_B_3, BLH_B_2, BLH_B_1, BLH_B_0, BLH_G_3, BLH_G_2, BLH_G_1, BLH_G_0, pu_data_bg_len}, Step S9, generating compressed data Comp_data, Comp_data = { Pu_data_ra , Pu_data_bg}, Step S10, generating a compression test case Final_Comp_data, Final_Comp_data = {RDC, comp_data}, where RDC is the high bit of comp_data padded with 0 to align the corresponding byte according to the comp rate in the first step.
[0006] In some embodiments, the decompression test case generation method based on the PDC compression algorithm further includes the comp_rate being specifically the compressed data length, which is aligned to 32B.
[0007] According to another aspect of the present disclosure, a method for generating a compression test case based on a PDC compression algorithm is proposed, comprising: Step S1, determine the compression rate comp_rate of the test case, Step S2, randomly generate the length of the compressed data comp_data_len according to comp_rate, where comp_data_len>=240bit, Step S3: randomly generate the lengths of Pu_data_ra and pu_data_gb according to the compressed data length comp_data_len, where pu_data_ra_len + pu_data_bg_len = comp_data_len, and pu_data_ra_len>=120, pu_data_bg_len>=120, Step S4, randomly generate the BLH values of the four types of pixels R, G, B, and A of each group in the tile, BLH_A_0~BLH_A_3, BLH_R_0~BLH_R_3, BLH_B_0~BLH_B_3, BLH_G_0~BLH_G_3, and the value range of each BLH is 1~7, where, (BLH_A_0 + BLH_A_1 + BLH_A_2 + BLH_A_3 + BLH_R_0 + BLH_R_1 + BLH_R_2+ BLH_R_3) * 8 + 56 = pu_data_ra_len Among them, BLH is the most significant bit of the maximum number of bits required for the difference res of each pixel pix in each group. Step S5, according to the BLH value of each group, generate the difference res_m_n[i] of each pixel pix, the value range of the difference is: 0~(2*BLH_m_n)-1, and for each group of 8 res, at least one of res_m_n [BLH_m_n-1] is 1, where m is R, A, B, G, n is 0~3, i is 0~7, Step S6, according to the res value of each pix, generate the difference values of each group of four kinds of pixels R, A, B, and G, pack_data_R, pack_data_A, pack_data_B, pack_data_G, respectively. Step S7, randomly generate the mean value of each pixel of RGBA, that is, the value of DC_R, DC_A, DC_B, DC_G, Step S8, calculate the value of each pixel, pix[i] = res[i] + pred_pix[i], Step S9, using the above pix values, according to the data format, combine the uncompressed data raw_data_pix[n] of each pixel in the tile, Step S10, combining the uncompressed data raw_data of all pixels in the tile according to the data format.
[0008] In some embodiments, the decompression test case generation method based on the PDC compression algorithm further includes the comp_rate being specifically the compressed data length, which is aligned to 32B.
[0009] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the steps in any of the above embodiment methods by calling the computer program stored in the memory.
[0010] An embodiment of the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program executes the steps in any of the above method embodiments when executed by a processor.
[0011] The present application provides a method, device and medium for generating decompression test cases based on the PDC compression algorithm. Based on the PDC compression algorithm, the compression rate is first determined, and the compressed data length comp_data_len is randomly generated according to the compression rate, and the BLH values of the four types of pixels R, G, B, and A of each group in the tile are randomly generated. According to the BLH values of each group, the difference of each pixel pix is generated, and according to the res value of each pix, the difference of each group of four types of pixels R, A, B, and G is generated respectively, and the mean of each type of pixel of RGBA is randomly generated, and then compressed data is generated. According to the method provided by the present disclosure, a sufficiently random compressed data test vector can be efficiently generated, and a verification method for efficiently generating a test stimulus that can specify the compression size of image data can be used, which greatly enriches the verification scenarios and discovers defects in the design implementation in advance. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 A schematic diagram of a method for generating decompression test cases based on a PDC compression algorithm provided in an embodiment of the present application.
[0013] Figure 2 A schematic diagram of a method for generating compression test cases based on a PDC compression algorithm provided in an embodiment of the present application.
[0014] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0015] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments 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.
[0016] In the description of the present invention, it should be understood that the terms "upper", "upper", "lower", "front", "rear", etc., indicating the orientation or positional relationship are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In the description of the invention, "plurality" means two or more, unless otherwise precisely and specifically specified.
[0017] The present application embodiment provides a method for generating a decompression test case based on a PDC compression algorithm. Specifically, Figure 1 shown.
[0018] Predictable_Delta_Compression (PDC) compression is a lossless compression algorithm for color cache data. Color cache data is generally divided into 128B and 256B modes. Usually, the upstream sends the complete 128B and 256B color data to the compression module. The PDC compression module compresses it according to the data characteristics and aligns it with 32B according to the length of the compressed data. That is, 128B data can be compressed to 32B, 64B, and 96B. If it exceeds 96B, it is considered that the compression has failed, and the compressed data is still the original data before compression. 256B data can be compressed to 32B, 64B, 96B, 128B, 160, 192, and 224B. If it exceeds 224B, it is considered that the compression has failed, and the compressed data is still the original data before compression.
[0019] Color data has a variety of formats, and various formats are generally composed of three types of pixel data: R, G, and B, or four types of pixel data: R, G, B, and A, such as ARGB8, ARGB16, A2RGB10, etc. For example, ARGB8 has the following format:
[0020] The ARGB16 format is
[0021] Unless otherwise specified, this disclosure takes ARGB8 as an example.
[0022] Color compression is usually performed in tile units. Tiles are of various types, such as 8*4, 8*8, and 4*4. Color data compression can also be performed separately based on the pixel type.
[0023]
[0024] Taking 8*4 tile as an example, as shown in the following table, it can be divided into 4 groups, each with 8 pixels.
[0025] Group0 = {p7, p6, p5, p4, p3, p2, p1, p0} correspond to the pixels in the tile {pix28, pix24, pix12, pix8, pix20, pix16, pix4, pix0}, Group1 = {p7, p6, p5, p4, p3, p2, p1, p0} correspond to the pixels in the tile {pix30, pix26, pix14, pix10 pix22, pix18, pix6, pix2}, Group2 = {p7, p6, p5, p4, p3, p2, p1, p0} correspond to the pixels in the tile {pix15, pix11, pix13, pix9 pix7, pix3, pix5, pix1}, Group1 = {p7, p6, p5, p4, p3, p2, p1, p0} correspond to the pixels in the tile {pix31, pix27, pix29, pix25 pix23, pix19, pix21, pix17}, The pixels of each grouup are evenly distributed in the tile, so that the overall difference is as small as possible. The smaller the difference, the easier it is to be compressed successfully.
[0026] Exemplarily, the PDC compression process is roughly as follows: Step 1: Calculate the DC value, DC = (pix0 + pix16 + pix8 + pix24 + 3) / 4. The DC value is the average of the pixes in group0. The +3 in the formula is to round up. The pixels in the group are selected to make the pixels for calculating the average dispersed in the tile, so as to minimize the difference between the pixels.
[0027] Step 2: Calculate the predicted value prd_pix* of each pixel in each group. Group0: pix0,16,8,24: prd_pix=DC prd_pix4 = (pix0 + pix16 + 1) / 2 prd_pix12 = (pix8 + pix24 + 1) / 2 prd_pix20 = pix16 prd_pix28 = pix24 Group1: Pix2, 6,18,22, prd_pix[i]=(pix[i-2] + pix[i+6]+1) / 2 Pix10,14,26,30, prd_pix = pix[i-2]; Group2: Pix1,3,9,11, prd_pix[i]=(pix[i-1]+[ix[i+3]+1) / 2 Pix5,7,13,15, prd_pix[i]=(pix[i-1]+pix[i+11]+1) / 2 Group3 Pix17,19,25,27, prd_pix[i]=(pix[i-1]+pix[i+3]+1) / 2 Pix21,23,29,31, prd_pix[i] =pix[i-1] in, 1. For group 0, except for the pixel whose DC value is calculated above, the predicted value of other pixels is the average of the two pixels on the left and right in group 0. If there is no group 0 on the right, such as pixel (20,28), the predicted value is the value on the left in group 0. 2. For grou1, if there are group0 pixels above and below it in the tile, the predicted value is the average of the two pixels above and below. If there is only a group0 pixel above and no pixel below (10, 14, 26, 30), the predicted value is the value of the group0 pixel above it.
[0028] 3. For group2, if there are group0 pixels on both sides of the tile, the predicted value is the average of the left and right group0 pixels. 4. For group3, if there are pixels on both sides of the pixel, the predicted value is the mean of the left and right pixels. If there is only a pixel on the left side, such as pixel (21,23,29,31), the predicted value is the value of the pixel on its left side. The +1 in the formula is to round up.
[0029] The third step is to calculate the difference between each pix: Res, Among them, Res[i] = pix[i]– prd_pix[i]; that is, the pixel value of each pixel minus its predicted value, Step 4: Determine whether the tile can be compressed successfully based on the difference between each pix For each group, SB_location[8:0]= {res[0][8]^res[0][7], res[0][7]^res[0][6], res[0][6]^res[0][5], res[0][5]^res[0][4], res[0][4]^res[0][3], res[0][3]^res[0][2],res[0][2]^res[0][1], res[0][1]^res[0][0], res[0][0]} {res[1][8]^res[1][7], res[1][7]^res[1][6], res[1][6]^res[1][5], res[1][5]^res[1][4], res[1][4]^res[1][3], res[1][3]^res[1][2],res[1][2]^res[1][1], res[1][1]^res[1][0], res[1][0]} | … {res[7][8]^res[7][7], res[7][7]^res[7][6], res[7][6]^res[7][5], res[7][5]^res[7][4], res[7][4]^res[7][3], res[7][3]^res[7][2],res[7][2]^res[7][1], res[7][1]^res[7][0], res[7][0]} |, Among them, SB_location[8:0] is used to mark the maximum number of bits required for each pix difference. Take res[0][8:0] as an example, if res[0][8:0]=9'b0_0010_0001, then res[0][8]^res[0][7]=0, res[0][7]^res[0][6]=0, Res[0][6]^res[0][5]=1, Res[0][5]^res[0][4]=1, That is, the first 1 bit, bit 6 (most significant bit) of res_xor0.
[0030] As mentioned above, the entire SB_location[8:0] calculation is divided into two steps. The first step is: 1. Calculate the XOR value of each bit of res of each pix. Take pix0 as an example. The value of the 0th bit of res_xor[8:0] is itself res[0][0] (the 0b in front represents the 0th pix, and the 0b behind represents the 0th bit of pix0 res). res_xor[1] is the XOR of res[0][1] and res[0][0], and res_xor[2] is the XOR of res[0][2] and res[0][1]. That is, except for the 0th bit, the values of res_xor[0][n] are the XOR values of res[0][n] and res[0][n-1]. (The ^ in the formula is XOR, that is, if the left and right values are the same, the result is 0, and if the left and right values are different, the result is 1) 2. Perform a bitwise OR operation on the res_xor of each pix0~pix7 in the group, that is, SB_location[[8:0]=res_xor[0]|res_xor[1]|…|res_xor[7] (the | in the formula is a bitwise OR operation, that is, the corresponding bits of the numbers on the left and right sides are ORed. If one of the two bits is 1, the result is 1, and if both bits are 0, the result is 0).
[0031] If sb_location[8]|[7]=1, it means that the delta value of the pixel in this group is too large and compression fails. If compression fails, the original data is output. If compression succeeds, BLH is calculated based on the most significant bit of sb_location, that is, from bit6 to bit0. If sb_location[i]=1, BLH=i+1. BLH represents the most significant bit of Sb_location. From the calculation of sb_location above, we can know the res values of the 8 pixels in this group.
[0032] Sb_location is the OR of the res values of each pix in the group. Take sb_location[8] as an example. If one of res[0][8]~res[7][8] is 1, then sb_location[8]=1. Similarly, if one of res[0][7]~res[7][7] is 1, then sb_location[7]=1. Therefore, if sb_location[8]|sb_location[7]=1, that is, at least one of the 7th and 8th bits of res[0]~res[7] is 1, it can be considered that the difference in the group is too large and compression fails.
[0033] The fifth step is to calculate the pack_data of each pixel type. Pack_data_*={grp3_res, grp2_res, grp1_res, grp0_res}; Among them, pack_data represents the compressed data of 4 types of pixels RGBA, namely packk_data_R, pack_data_G, pack_data_B, pack_dataA. The 4 types of pixels are compressed separately and then assembled together. The calculation process is the Res[i] calculated in the above steps. Each pixel has 4 groups, so it is represented by grp3_res, grp2_res, grp1_res, grp0_res. The * in the previous Pack_data_* represents the 4 types of pixels, namely Pack_data_R, Pack_data_G, Pack_data_B, Pack_data_A.
[0034] Step 6: Calculate compressed data Comp_data= {pu_data0, pu_data1}; Pu_data0 = {pack_data_R, pack_data_A, DC_R[7:0], DC_A[7:0], BLH_R_3[3:0], BLH_R_2[3:0], BLH_R_1[3:0], BLH_R_0[3:0], BLH_A_3[3:0], BLH_A_2[3:0],BLH_A_1[3:0], BLH_A_0[3:0], LEN_RA[7:0]} Pu_data1 = {pack_data_B, pack_data_G, DC_B[7:0], DC_G[7:0], BLH_B_3[3:0], BLH_B_2[3:0], BLH_B_1[3:0], BLH_B_0[3:0], BLH_G_3[3:0], BLH_G_2[3:0],BLH_G_1[3:0], BLH_G_0[3:0], LEN_BG[7:0]} Among them, LEN_RA, LEN_BG are the effective lengths of pu_data0, pu_data1 respectively. BLH is a fixed length of 4 bits, and DC data is a fixed length of 8 bits. Among them, Among them, DC_R[7:0] represents the DC value of pixel R, DC_A[7:0] represents the DC value of pixel A, and the DC value is the DC value of the first step above. BLH_R_3, BLH_R_2, BLH_R_1, BLH_R_0 are the BLH values of pixel R, that is, the BLH values of pixel R in the fourth step above. Because the BLH value is 1~7, BLH is represented by 4 bits. Similarly, BLH_A3 / 2 / 1 / 0 are the BLH values of pixel A calculated in the fourth step above. LEN_RA is the total length of pu_data0.
[0035] PDC decompression is a reverse process of the above compression, and its principle will not be described in detail.
[0036] like Figure 1 As shown, based on the above PDC compression data algorithm, an example of generating a decompression test case is described as follows.
[0037] Decompression is to decompress the compressed data to the corresponding size according to the compression mode. Therefore, during testing, it is necessary to generate compressed data according to the test requirements, that is, decompression test cases.
[0038] Table 1
[0039] Table 1 is the format of compressed data, which includes two parts. Pu_data0 is the compressed data of pixels R and A, and Pu_data1 is the compressed data of pixels B and G. Pu_data0 and Pu_data1 have the same format. Taking Pu_data0 as an example, the compressed data format is shown in Table 2: Table 2
[0040] Pu_data consists of 6 parts, Pack_data_R and Pack_data_A are the differences between the groups of pixels R and A, DC is the DC value of pixels R and A, BLH_R and BLH_A are the BLH values of pixels R and A.
[0041] Pu_data0_len is the total length of pu_data (in bytes), with a fixed length of 8 bits.
[0042] The format of BLH_R and BLH_A is the same. Take BLH_R as an example, as shown in Table 3, it consists of BLH_R_0~BLH_R_3, where 0~3 are the four groups of pixel R in the tile. Each BLH_R_* is a fixed length of 4 bits.
[0043] Table 3
[0044] As shown in Table 4, DC is the DC value of pixel R, A, which is composed of DC_R, DC_A respectively, and each DC_* is of fixed length 8 bits.
[0045] Table 4
[0046] Pack_data_R and Pack_data_A have the same format. Taking Pack_data_R as an example, as shown in Table 5, it is composed of the res of each pixel in the four groups of pixel R in the tile. Taking RES_R_G0 as an example, RES_R_G0= {res_r_g0_7, res_r_g0_6, res_r_g0_5, res_r_g0_4, res_r_g0_3, res_r_g0_2, res_r_g0_1, res_r_g0_0}; The length of RES_R_G[n] is: BLH_R_[n]*8, n is 0~3.
[0047] Table 5
[0048] Step S101: Specify the compression rate of the test stimulus, comp_rate 128B mode: 32B, 64B, 96B, 128B, that is, the original data of 128B can be compressed to 32B, 64B, 96B or 128B according to the compression rate. 256B mode: 32B, 64B, 96B, 128B, 160B, 192B, 224B, 256B, In some embodiments, the compressed data is aligned to 32B. It is understandable that the compression ratio can be selected according to actual needs, and the present disclosure does not limit it.
[0049] Step S102: According to comp_rate, randomly generate the length of the compressed data, comp_data_len, as shown in Table 6 below.
[0050] Table 6 Compression Compressed data length 32B 240~256bit 64B 257~512bit 96B 513~768bit 128B 769~1024bit 160B 1025~1280bit 192B 1281~1536bit 224B 1537~1792bit 256B 1783~2048bit The minimum compressed data length is 240 bits: When BLH is 1, the data length is: 1*8pix*4group*2 elem+8*2dc+4*8blh+8 length Step S103: randomly generate the lengths of Pu_data_ra and pu_data_gb according to the compressed data length comp_data_len, requiring: pu_data_ra_len + pu_data_bg_len = comp_data_len, and pu_data_ra_len>=120, pu_data_bg_len>=120 Step S104: Randomly generate the BLH value of each group, BLH_A_0~BLH_A_3, BLH_R_0~BLH_R_3, BLH_B_0~BLH_B_3, BLH_G_0~BLH_G_3, the range of each BLH is: 1~7, and the requirements are: (BLH_A_0 + BLH_A_1 + BLH_A_2 + BLH_A_3 + BLH_R_0 + BLH_R_1 + BLH_R_2+ BLH_R_3) * 8 + 56 = pu_data_ra_len, Among them, DC_R has a fixed length of 8 bits, DC_A has a fixed length of 8 bits, BLH_A_0~BLH_A_3, BLH_R_0~BLH_R_3, have a fixed length of 3 bits, Pu_data_ra_len has a fixed length of 8 bits, (BLH_B_0 + BLH_B_1 + BLH_B_2 + BLH_B_3 + BLH_G_0 + BLH_G_1 + BLH_G_2+ BLH_G_3) * 8 +56 = pu_data_bg_len Among them, DC_B has a fixed length of 8 bits, DC_G has a fixed length of 8 bits, BLH_B0~BLH_B3, BLH_G_0~BLH_G_3 have a fixed length of 3 bits, and Pu_data_bg_len has a fixed length of 8 bits.
[0051] Step S105: Generate the res_m_n[i] value of each pix according to the BLH value of each group, ranging from 0 to (2*BLH_m_n)-1; and for each group's 8 res, at least one of res_m_n[BLH_m_n-1] is 1. Where m is R, A, B, G, n is 0-3, and i is 0-7.
[0052] Step S106: Generate pack_data_R, pack_data_A, pack_data_B, pack_data_G according to the res value of each pix: Pack_data_R = {RES_R_G3, RES_R_G2, RES_R_G1, RES_R_G0}; RES_R_G0 = {res_r_g0_7, res_r_g0_6, res_r_g0_5, res_r_g0_4, res_r_g0_3, res_r_g0_2, res_r_g0_1, res_r_g0_0}; … RES_R_G3 = {res_r_g3_7, res_r_g3_6, res_r_g3_5, res_r_g3_4, res_r_g3_3, res_r_g3_2, res_r_g3_1, res_r_g3_0}; Similarly Pack_data_A = {RES_A_G3, RES_A_G2, RES_A_G1, RES_A_G0}; Pack_data_B = {RES_B_G3, RES_B_G2, RES_B_G1, RES_B_G0}; Pack_data_G = {RES_G_G3, RES_G_G2, RES_G_G1, RES_G_G0}; Step S107: Randomly generate the values of DC_R, DC_A, DC_B, and DC_G; Step S108: Generate Pu_data_ra, pu_data_gb Pu_data_ra = { Pack_data_R, Pack_data_A, DC_R, DC_A, BLH_R_3, BLH_R_2, BLH_R_1, BLH_R_0, BLH_A_3, BLH_A_2, BLH_A_1, BLH_A_0, pu_data_ra_len} Pu_data_bg = { Pack_data_B, Pack_data_G, DC_B, DC_G, BLH_B_3, BLH_B_2, BLH_B_1, BLH_B_0, BLH_G_3, BLH_G_2, BLH_G_1, BLH_G_0, pu_data_bg_len} Step S109: Generate compressed data Comp_data = { Pu_data_ra , Pu_data_bg} Step S110: Generate a compressed test vector Final_Comp_data = {RDC, comp_data}; RDC is to fill the high bits of comp_data with 0 to the corresponding byte according to the comp rate in the first step. For example, if comp rate = 32B and comp_data is 31B, 8 0s need to be added to the high bits to align to 32B, that is, RDC = 8'h00.
[0053] According to the above steps S1-S10, a test vector of the compression algorithm can be generated.
[0054] Another embodiment of the present application provides a method for generating a compression test case based on a PDC compression algorithm. Specifically, Figure 2 shown.
[0055] Step S201: Specify the compression rate of the test stimulus, comp_rate 128B mode: 32B, 64B, 96B, 128B 256B mode: 32B, 64B, 96B, 128B, 160B, 192B, 224B, 256B As described in the previous embodiment, in some embodiments, the compressed data is aligned to 32B. It is understandable that the compression ratio can be selected according to actual needs, and the present disclosure does not limit it. Step S202, using steps S101 to S107 of the above-mentioned decompressed test vector generation method, generate DC, BLH of each pixel type and res value of each pixel, that is, steps S202-S207 correspond to S102-S107 of the previous embodiment, and will not be repeated in this embodiment.
[0056] Step S208, calculate the value of each pixel, pix[j] = res[j] + pred_pix[j], where j refers to the pixel number of each pixel type R, A, B, G in the tile. In this embodiment, the tile is 8*4, so the range of j is 0~31, that is, there are 32 pixels of each type. Or it can be written as pix[m][j] = res[m][j] + pred_pix[m][j], m refers to the pixel type R, A, B, G, and j is 0~31.
[0057] Take the R pixel type as an example: Group0 Pix[n] = res[n]+DC_R; n=0,16,8,24 Pix[4] =res[4]+pred_pix[4], pred_pix[4] = (pix[0]+pix
[16] +1) / 2 Pix
[12] = res
[12] +pred_pix
[12] , pred_pix
[12] = (pix[8]+pix
[24] +1) / 2 Pix
[20] = res
[20] +pred_pix
[20] ,pred_pix
[20] = pix
[16] Pix
[28] = res
[28] + pred_pix
[28] ,pred_pix
[28] = pix
[24] Group1 Pix[n] = res[n]+pred_pix[n],pred_pix[n] = (pix[n-2]+pix[n+6]+1) / 2, n=2,6,18,22 Pix[m]= res[m]+ pred_pix[m],pred_pix[m]=pix[m-2], m=10,14,26,30 Group2 Pix[n] = res[n]+pred_pix[n],pred_pix[n] = (pix[n-1]+pix[n+3]+1) / 2, n=1,3,9,11 Pix[m]= res[m]+ pred_pix[m],(pix[m-1]+pix[m+11]+1) / 2, m=5,7,13,15 Group3 Pix[n] = res[n]+pred_pix[n],pred_pix[n] = (pix[n-1]+pix[n+3]+1) / 2, n=17,19,25,27 Pix[m] = res[m]+ pred_pix[m],pred_pix[m]=pix[m-1], m= 21,23,29,32 Step S209, using the above pix values, according to the data format, combine the uncompressed data raw_data_pix[j] of each pixel in the tile, where j is the number of the pixel in the tile. Taking the ARGB8 format as an example, raw_data_pix[0]={pix[A][0][7:0], pix[R][0][7:0],pix[G][0][7:0], pix[B][0][7:0]}, as shown in Table 7 below: Table 7
[0058] Step S210, according to the data format, the uncompressed data raw_data of all pixels in the tile are combined, taking the tilemode as 128B mode as an example, as shown in the following Table 8: Table 8
[0059] According to the above steps, the test vector of the compression algorithm can be generated.
[0060] Accordingly, an embodiment of the present application further provides an electronic device, which may be a terminal or a server. Figure 3 As shown, Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0061] The electronic device 300 includes a processor 301 having one or more processing cores, a memory 302 having one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 is electrically connected to the memory 302. Those skilled in the art will appreciate that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0062] The processor 301 is the control center of the electronic device 300. It uses various interfaces and lines to connect various parts of the entire electronic device 300, and executes various functions of the electronic device 300 and processes data by running or loading software programs (computer programs) and / or units stored in the memory 302, and calling data stored in the memory 302, thereby monitoring the electronic device 300 as a whole.
[0063] In the embodiment of the present application, the processor 301 in the electronic device 300 will load the instructions corresponding to the processes of one or more applications into the memory 302 according to the following steps, and the processor 301 will run the applications stored in the memory 302 to implement various functions. The specific implementation of each operation to implement the function can be referred to the aforementioned embodiment, which will not be repeated here.
[0064] Optional, such as Figure 3 As shown, the electronic device 300 further includes: a test case generation module 303, a communication module 304, an input unit 305 and a power supply 306. The processor 301 is electrically connected to the test case generation module 303, the communication module 304, the input unit 305 and the power supply 306 respectively. Those skilled in the art can understand that Figure 3 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0065] The test case generation module can be used to generate decompression / compression test cases.
[0066] The communication module 304 can be used to communicate with other devices.
[0067] The input unit 305 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0068] The power supply 306 is used to supply power to various components of the electronic device 300. Optionally, the power supply 306 can be logically connected to the processor 301 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 306 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0069] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0070] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0071] To this end, an embodiment of the present application provides a computer-readable storage medium, which stores multiple computer programs. The computer programs can be loaded by a processor to execute the steps of a decompression test case generation method based on a PDC compression algorithm provided in an embodiment of the present application.
[0072] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0073] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0074] Since the computer program stored in the storage medium can execute the steps in any one of the decompression test case generation methods based on the PDC compression algorithm provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the decompression test case generation methods based on the PDC compression algorithm provided in the embodiments of the present application can be achieved. Please see the previous embodiments for details and will not be repeated here.
[0075] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0076] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0077] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0078] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions and variations of these embodiments are made without departing from the principles and spirit of the present invention, and still fall within the scope of protection of the present invention.
Claims
1. A method for generating decompression test cases based on a PDC compression algorithm, characterized in that: The method comprises: Step S1, determine the compression rate comp_rate of the test case, Step S2, randomly generate the length of the compressed data comp_data_len according to comp_rate, where comp_data_len>=240bit, Step S3, randomly generate the lengths of pu_data_ra and pu_data_gb according to the compressed data length comp_data_len, that is, pu_data_ra_len and pu_data_gb_len, wherein pu_data_ra_len + pu_data_gb_len =comp_data_len, and pu_data_ra_len>=120bit, pu_data_gb_len>=120bit, Step S4, randomly generate the BLH values of the four types of pixels R, G, B, and A of each group in the tile, and the value range of each BLH is 1 to 7, where BLH is the most significant bit of the maximum required number of bits of the difference res of each pixel pix in each group. Step S5, according to the BLH value of each group, generate the difference res_m_n[i] of each pixel pix, where 0<= res_m_n[i]<=(2*BLH_m_n)-1, and for each group, at least one of res and res_m_n [BLH_m_n-1] is 1, where m represents the pixel type number R, A, B, G, n represents the group number in the tile, 0<=n<=3, i represents the pixel number in the group, 0<=i<=7, Step S6, according to the res value of each pix, generate the difference values of each group of four kinds of pixels R, A, B, and G, pack_data_R, pack_data_A, pack_data_B, pack_data_G, respectively. Step S7, randomly generate the mean value of each pixel of RGBA, that is, the value of DC_R, DC_A, DC_B, DC_G, Step S8, generating pu_data_ra, pu_data_gb, wherein, Pu_data_ra = { Pack_data_R, Pack_data_A, DC_R, DC_A, BLH_R_3, BLH_R_2, BLH_R_1, BLH_R_0, BLH_A_3, BLH_A_2, BLH_A_1, BLH_A_0, pu_data_ra_len}, Pu_data_bg = { Pack_data_B, Pack_data_G, DC_B, DC_G, BLH_B_3, BLH_B_2, BLH_B_1, BLH_B_0, BLH_G_3, BLH_G_2, BLH_G_1, BLH_G_0, pu_data_bg_len}, Step S9, generating compressed data Comp_data, Comp_data = { Pu_data_ra , Pu_data_bg}, Step S10, generating a compression test case Final_Comp_data, Final_Comp_data = {RDC, comp_data}, where RDC is the high bit of comp_data padded with 0 to align the corresponding byte according to the comp rate in the first step.
2. The method according to claim 1, further comprising: The comp_rate is specifically the length of the compressed data, which is aligned to 32B.
3. A method for generating compression test cases based on a PDC compression algorithm, characterized in that: The method comprises: Step S1, determine the compression rate comp_rate of the test case, Step S2, randomly generate the length of the compressed data comp_data_len according to comp_rate, where comp_data_len>=240bit, Step S3, randomly generate the lengths of Pu_data_ra and pu_data_gb according to the compressed data length comp_data_len, that is, pu_data_ra_len and pu_data_gb_len, wherein pu_data_ra_len + pu_data_gb_len =comp_data_len, and pu_data_ra_len>=120bit, pu_data_bg_len>=120bit, Step S4, randomly generate the BLH values of the four types of pixels R, G, B, and A of each group in the tile, and the value range of each BLH is 1 to 7, where BLH is the most significant bit of the maximum required number of bits of the difference res of each pixel pix in each group, Step S5, according to the BLH value of each group, generate the difference res_m_n[i] of each pixel pix, where 0<= res_m_n[i]<= (2*BLH_m_n)-1, and for each group, at least one of res and res_m_n [BLH_m_n-1] is 1, where m represents R, A, B, G, n represents the number of the group in the tile, 0<=n<=3, i represents the number of the pixel in the group, 0<=i<=7, Step S6, according to the res value of each pix, generate the difference values of each group of four kinds of pixels R, A, B, and G, pack_data_R, pack_data_A, pack_data_B, pack_data_G, respectively. Step S7, randomly generate the mean value of each pixel of RGBA, that is, the value of DC_R, DC_A, DC_B, DC_G, Step S8, calculate the value of each pixel, pix[j] = res[j] + pred_pix[j], where j represents all pixel numbers corresponding to each pixel type in the tile, 0<=j<=31, Step S9, using the above pix values, according to the data format, combine the uncompressed data raw_data_pix[j] of each pixel in the tile, Step S10, combining the uncompressed data raw_data of all pixels in the tile according to the data format.
4. The method according to claim 3, further comprising: The comp_rate is specifically the length of the compressed data, which is aligned to 32B.
5. An electronic device, characterized in that: It comprises a memory storing executable program code and a processor coupled to the memory; wherein the processor calls the executable program code stored in the memory to execute the method according to any one of claims 1-4.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is performed.
Citation Information
Patent Citations
Methods and decompression units for decompressing a compressed block of image data
GB201912800D0
Shape-adaptive model-based codec for lossy and lossless compression of images
WO2017143988A1
Data decompression method and system, and processor and computer storage medium
WO2021237510A1
