Code rate control method and device, computer equipment, storage medium and computer program product
By dynamically adjusting the encoding budget and target encoding size of the data block, the bit rate control method with adjustable compression ratio is realized, and the storage space waste caused by fixed compression ratio in the prior art is solved, and the storage efficiency of the panel display driver chip is improved.
Patent Information
- Application Number
- CN202411082739.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-08-07
AI Technical Summary
In the prior art, compression method or lookup table method based on airspace downsampling occupies a lot of storage space in the ROM resources of the compression panel display driver chip, and the compression ratio is fixed, so ROM resources cannot be effectively saved.
A code rate control method is provided. By obtaining the data to be compressed and the target compression magnification, after blocking and grouping, the encoding budget and target encoding size of each data block are dynamically adjusted to achieve adjustable compression magnification, thereby optimizing the utilization of storage space.
It realizes flexibly adjusting the compression ratio according to different storage space needs, saving ROM resources, and improving the storage efficiency of the panel display driver chip.
Smart Images

Figure CN119011849A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data compression technology, and in particular to a rate control method, device, computer equipment, storage medium and computer program product. Background Art
[0002] Due to the limitation of the screen manufacturing process, each pixel displays uneven brightness at the same grayscale. We call this phenomenon MURA (uneven) effect. In order to eliminate the MURA effect of the panel, the compensation value of each pixel at a few specific grayscales is usually burned into the ROM (read-only memory) of the panel display driver chip. The amount of burned data will increase significantly with the increase of panel size. For example, a panel with a size of 2560x1600 needs to store compensation values of 3 grayscales, each compensation value is 6 bits, then a total of 221.184Mb of ROM resources are required to store the compensation values of the three RGB channels.
[0003] In order to save ROM resources and reduce chip costs, the compensation value is usually compressed and the compressed binary bit stream is burned into the ROM.
[0004] However, the compression ratio of the currently known compression methods based on spatial downsampling or other lookup table methods is fixed, resulting in more occupied storage space. Summary of the invention
[0005] Based on this, it is necessary to provide a rate control method, apparatus, computer device, computer-readable storage medium and computer program product capable of adjusting the compression ratio in order to solve the above technical problems.
[0006] In a first aspect, the present application provides a rate control method, the method comprising:
[0007] Acquire the data to be compressed and the set target compression ratio, and obtain the total coding budget after compression based on the data to be compressed and the target compression ratio;
[0008] Dividing the data to be compressed into a plurality of data blocks, and grouping each row of data blocks into a data block group;
[0009] Based on the total coding budget, obtain an initial coding budget for a first data block group of each data block row and a target coding budget for a first data block;
[0010] Obtaining a current coding budget for a current data block group and a target coding budget for a current data block to be compressed; the first current data block group is a first data block group of a first data block row;
[0011] Determine each coding budget consumed by each coding mode of the current data block to be compressed, and determine a target coding size of the current data block to be compressed based on each coding budget consumed by each coding mode and the target coding budget;
[0012] updating the current encoding budget based on the target encoding size, and obtaining the current number of remaining data blocks to be compressed in the current data block group;
[0013] Based on the current coding budget and the current number, a target coding budget for the next data block is obtained, the next data block is used as the current data block, and the step of determining the initial coding budgets consumed by the coding modes of the current data block to be compressed is continued until the coding of the data to be compressed is completed.
[0014] In one embodiment, obtaining the initial coding budget of the first data block group of each data block row and the target coding budget of the first data block based on the total coding budget includes:
[0015] Identify the data to be compressed to obtain frame-level information, and perform frame-level bit rate control based on the frame-level information and the total coding budget to obtain a basic coding budget for each data block row;
[0016] The data to be compressed is identified to obtain row information of the data block row, and data block row-level code rate control is performed based on the row information of the data block row, the first number of data blocks in each of the data block groups, and the basic coding budget of each data block row, to obtain an initial coding budget for the first data block group of each of the data block rows and a target coding budget for the first data block.
[0017] In one embodiment, the frame-level rate control is performed based on the frame-level information and the total coding budget to obtain a basic coding budget for each data block row, including:
[0018] Determining a total data block coding budget based on the total coding budget and the size of the frame level information;
[0019] A basic coding budget for each data block row is obtained based on the total data block coding budget and the second number of the data blocks in each data block row.
[0020] In one embodiment, the data block row level rate control is performed based on the row information of the data block row, the first number of data blocks in each of the data block groups, and the basic coding budget of each of the data block rows to obtain the initial coding budget of the first data block group of each of the data block rows and the target coding budget of the first data block, including:
[0021] Based on the basic coding budget of each data block row, the size of the row information and the second quantity, obtain a basic coding budget for each data block and a remaining coding budget for the data block row;
[0022] Based on the basic coding budget of each data block and the first number, obtain a basic coding budget for each data block group;
[0023] Obtaining an initial coding budget for a first data block group of the data block row based on the basic coding budget of each data block, the remaining coding budget of the data block row, and the remaining coding budget of the previous data block row;
[0024] A target coding budget for the first data block is obtained based on the basic coding budget of each data block group, the remaining coding budget of the data block row, and the remaining coding budget of the previous data block row.
[0025] In one of the embodiments, updating the current encoding budget based on the target encoding size includes:
[0026] When the current data block to be compressed is not the last data block of the current data block group and is not the first data block of the first data block group of the current data block row, obtaining the updated current coding budget based on the current coding budget before updating and the target coding size;
[0027] When the current data block to be compressed is the last data block of the current data block group, the updated current coding budget is obtained based on the target coding size, the basic coding budget of each data block group and the current coding budget before updating.
[0028] In one embodiment, obtaining a target coding budget for a next data block based on the current coding budget and the current quantity includes:
[0029] Obtaining an average coding budget of the remaining data blocks to be compressed according to the current coding budget and the current number;
[0030] Obtaining a remainder compression budget based on the current encoding budget, the current number, and the average compression budget;
[0031] A target coding budget for a next data block is obtained based on the average compression budget and the residual compression budget.
[0032] In one embodiment, the method further comprises:
[0033] The available capacity of the on-chip memory is obtained, and a target compression ratio is obtained based on the available capacity.
[0034] In a second aspect, the present application further provides a rate control device, the device comprising:
[0035] A total coding budget determination module, used to obtain the data to be compressed and a set target compression ratio, and obtain a total coding budget after compression based on the data to be compressed and the target compression ratio;
[0036] A grouping module, used for dividing the data to be compressed into a plurality of data blocks, and grouping each row of data blocks into a data block group;
[0037] A row-level coding budget determination module, configured to obtain an initial coding budget for a first data block group of each data block row and a target coding budget for a first data block based on the total coding budget;
[0038] A data block coding budget determination module is used to obtain a current coding budget for a current data block group and a target coding budget for a current data block to be compressed; the first current data block group is a first data block group of a first data block row;
[0039] A target coding size determination module, used to determine each initial coding budget consumed by each coding mode of the current data block to be compressed, and determine the target coding size of the current data block to be compressed based on each of the initial coding budgets and the target coding budget;
[0040] An updating module, configured to update the current encoding budget based on the target encoding size, and obtain the current number of remaining data blocks to be compressed in the current data block group;
[0041] A loop module is used to obtain a target coding budget for a next data block based on the current coding budget and the current number, take the next data block as the current data block, and continue to execute the step of determining each initial coding budget consumed by each coding mode of the current data block to be compressed until the coding of the data to be compressed is completed.
[0042] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0043] In a fourth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0044] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0045] The above-mentioned rate control method, device, computer equipment, storage medium and computer program product can arbitrarily set the compression ratio, so that rate control can be achieved based on the target compression ratio. The specific rate control includes obtaining the total coding budget after compression based on the data to be compressed and the target compression ratio; dividing the data to be compressed into blocks to obtain a plurality of data blocks, and grouping each row of data blocks to obtain a data block group; obtaining the current coding budget of the current data block group and the target coding budget of the current data block to be compressed; wherein the initial coding budget of each data block row and the target coding budget of the first data block are obtained based on the total coding budget; determining each initial coding budget consumed by each coding mode of the current data block to be compressed, Based on each initial coding budget and the target coding budget, determine the target coding size of the current data block to be compressed; based on the target coding size, update the current coding budget, and obtain the current number of remaining data blocks to be compressed in the current data block group; based on the current coding budget and the current number, obtain the target coding budget for the next data block, take the next data block as the current data block, and continue to execute the steps of determining each initial coding budget consumed by each coding mode of the current data block to be compressed until the coding of the data to be compressed is completed. In this way, no matter what target compression ratio is set, the coding bit rate control can be achieved based on the target compression ratio, so that the storage of compensation values of different quality can be achieved based on different storage spaces. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 is a schematic flow chart of a rate control method in an embodiment;
[0048] Figure 2 is a schematic diagram of a compression process in one embodiment;
[0049] Figure 3 A block diagram in one embodiment;
[0050] Figure 4 A schematic diagram of data block group level encoding in one embodiment;
[0051] Figure 5 is a flow chart of a rate control method in another embodiment;
[0052] Figure 6 is a schematic diagram of frame-level bit rate control in one embodiment;
[0053] Figure 7 is a schematic diagram of a bank-level rate control according to an embodiment;
[0054] Figure 8 is a structural block diagram of a bit rate control device in an embodiment;
[0055] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0057] In one embodiment, Figure 1 As shown, a rate control method is provided. This embodiment uses the method applied to a terminal as an example for illustration. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0058] S102: Acquire the data to be compressed and the set target compression ratio, and obtain the total coding budget after compression based on the data to be compressed and the target compression ratio.
[0059] Among them, the data to be compressed can be any data. In this embodiment, the data to be compressed is the compensation value data of the screen. Taking a panel with a size of 2560x1600 as an example, and it is necessary to store 3 grayscale compensation values, each compensation value is 6 bits, then the data to be compressed is 221.184Mb.
[0060] The target compression ratio is set to be any value within the compression ratio range, for example, the compression ratio range may be [N, M], the lower limit of the compression ratio is N, and the upper limit of the compression ratio is M, that is, the present embodiment can achieve that the compression ratio within the range of [N, M] can be adjusted arbitrarily. Since the compression system uses many compression modes, in order to ensure that the target bit rate is achieved after the compression is completed, a mode is set, which can always achieve M times compression for any data block in the compensation value.
[0061] In this embodiment, only one example of a mode that can achieve any compression ratio in the above compression ratio range is given. It should be noted that this mode that can always achieve M-fold compression is not fixed. It is assumed that M is 6, that is, the maximum compression ratio of the compensation value compression system is 6 times, so it is necessary to determine a mode that can always achieve 6 times compression regardless of the data characteristics of the data block. Here, a simple spatial domain downsampling and bit truncation method is given to achieve a 6-fold compression ratio.
[0062] Assuming that the original compensation value is 6 bits wide and the data block size is 8x4, we can perform 2x2 downsampling on the original 8x4 data block to obtain a 4x2 data block. In addition, for each 6-bit compensation value in the 4x2 data block, only the high 4 bits are retained. At this point, the compressed data size of an 8x4 original block is 32 bits, and its original size is 192 bits, with a compression ratio of 6 times. For details, see Figure 2 .
[0063] In one optional embodiment, the method further includes: obtaining the available capacity of the on-chip memory, and obtaining the target compression ratio based on the available capacity. For example, when the on-chip memory capacity is large, a lower compression ratio can be set to obtain better compression quality, and when the on-chip memory capacity is small, a larger compression ratio can be set to meet storage requirements.
[0064] S104: Divide the data to be compressed into several data blocks, and group each row of data blocks into a data block group.
[0065] Combination Figure 3 As shown, the input compensation value of the OLED screen to be compressed is divided into blocks, that is, the data to be compressed is divided into blocks. Assuming that the width of the OLED screen is W and the height of the OLED screen is H, the data volume is WxH. First, the input two-dimensional compensation value data is divided into blocks, and the data block size is wxh. The compression system compresses each data block in a raster scanning order, and uses bit rate control for each data block to achieve the target bit rate.
[0066] S106: Obtaining an initial coding budget for the first data block group of each data block row and a target coding budget for the first data block based on the total coding budget.
[0067] Among them, in this embodiment, in order to achieve bit rate control, bit rate control is performed in each layer. In this step, data block row level bit rate control is performed, and its purpose is to obtain the initial coding budget of the first data block group of each data block row and the target coding budget of the first data block.
[0068] S108: Obtain a current coding budget of a current data block group and a target coding budget of a current data block to be compressed; the first current data block group is the first data block group of the first data block row.
[0069] When the current data block group is the first data block group of the first data block row, the current coding budget of the current data block group is the coding budget of the first data block group of the first data block row; the target coding budget of the current data block to be compressed is the target coding budget of the first data block of the first data block group of the first data block row, and the subsequent current coding budget of the current data block group is obtained based on the remaining coding budget of the previous data block group and the basic coding budget of the data block group; if the current data block group is the first data block group of each row, the current coding budget is obtained based on the initial coding budget of the first data block group of each row calculated based on the total coding budget and the remaining coding budget of the previous data block row; if the current data block to be compressed is not the first data block of the data block group, the target coding budget of the current data block to be compressed is obtained based on the remaining coding budget of the previous data block and the basic coding budget of the data block. If the current data block to be compressed is the first data block of the data block group, it is obtained based on the remaining coding budget of the previous data block group and the basic coding budget of the data block.
[0070] S110: Determine each initial coding budget consumed by each coding mode of the current data block to be compressed, and determine a target coding size of the current data block to be compressed based on each coding budget consumed by each coding mode and a target coding budget.
[0071] The number of bits consumed corresponding to each coding mode is different. Therefore, based on the coding budgets consumed by each coding mode and the target coding budget, the target coding size of the current data block to be compressed is determined. For example, assuming that the target coding budget is A, the coding budgets consumed by each coding mode are B1, B2 and B3 respectively, and A is greater than B1 and less than B2 and B3. Therefore, only the coding mode corresponding to B1 can be used to determine that the target coding size of the current data block to be compressed is B1.
[0072] S112: Update the current encoding budget based on the target encoding size, and obtain the current number of remaining data blocks to be compressed in the current data block group.
[0073] S114: Based on the current coding budget and the current number, obtain the target coding budget for the next data block, take the next data block as the current data block, and continue to execute the step of determining the initial coding budgets consumed by each coding mode of the current data block to be compressed until the coding of the data to be compressed is completed.
[0074] The current coding budget is updated based on the target coding size, that is, the current coding budget is equal to the current coding budget minus the target coding size, so as to obtain the remaining coding budget of the current data block group, which is used for the coding budget of other remaining data blocks in the data block group.
[0075] If there are remaining data blocks in the data block group, the target coding budget for the next data block is obtained based on the current number of remaining data blocks and the current coding budget. For example, the current coding budget is divided by the current number to obtain the quotient and the remainder, and the target coding budget for the next data block is the quotient plus the remainder.
[0076] If the data block group has no remaining data blocks, the remaining coding budget of the current data block group is added to the coding budget of the next data block group; in addition, if the data block group is the last data block group of the data block row and all the data blocks of the data block group have been encoded, the remaining coding budget of the current data block group is added to the first data block group of the next data block row.
[0077] In this embodiment, since the compression quality of the Deura value affects the subjective viewing effect of the OLED panel, in a block-based compression framework, in order to prevent the last few data blocks in a row of data blocks from having poor compression effects due to insufficient coding bit budget, this application proposes data block-level rate control based on data block groups, that is, when performing data block-level rate control, the data blocks will be grouped, that is, when performing rate control on the current data block, the subsequent uncoded data blocks in the group where the current data block is located will be considered. Assume that the number of data blocks in each group is N, and the size of N is not limited here. It can be any positive integer greater than 0 and less than LineBlkN, where LineBlkN is the total number of data blocks in each row of data blocks. After the encoding of each group of data blocks is completed, if the group of data blocks has excess coding bit budget, the excess coding bit budget will be used for the next group of data blocks, see Figure 4 shown.
[0078] The above-mentioned code rate control method can arbitrarily set the compression ratio, so that the code rate control can be achieved based on the target compression ratio. The specific code rate control includes obtaining the total coding budget after compression based on the data to be compressed and the target compression ratio; dividing the data to be compressed into blocks to obtain a plurality of data blocks, and grouping each row of data blocks to obtain a data block group; obtaining the current coding budget of the current data block group and the target coding budget of the current data block to be compressed; wherein the initial coding budget of each data block row and the target coding budget of the first data block are obtained based on the total coding budget; determining each initial coding budget consumed by each coding mode of the current data block to be compressed, and based on each initial coding budget The target coding size of the current data block to be compressed is determined based on the calculation and the target coding budget; the current coding budget is updated based on the target coding size, and the current number of the remaining data blocks to be compressed in the current data block group is obtained; based on the current coding budget and the current number, the target coding budget of the next data block is obtained, the next data block is used as the current data block, and the steps of determining the initial coding budgets consumed by the various coding modes of the current data block to be compressed are continued until the coding of the data to be compressed is completed, so that no matter what target compression ratio is set, the coding bit rate control can be achieved based on the target compression ratio, so that the storage of different quality compensation values can be achieved based on different storage spaces.
[0079] In one of the optional embodiments, an initial coding budget for the first data block group of each data block row and a target coding budget for the first data block are obtained based on the total coding budget, including: identifying the data to be compressed to obtain frame-level information, and performing frame-level rate control based on the frame-level information and the total coding budget to obtain a basic coding budget for each data block row; identifying the data to be compressed to obtain row information of the data block row, and performing data block row-level rate control based on the row information of the data block row, the first number of data blocks in each data block group, and the basic coding budget for each data block row to obtain an initial coding budget for the first data block group of each data block row and a target coding budget for the first data block.
[0080] In order to achieve precise control of the bit rate, the present application implements three-level bit rate control, the first level is the frame level, the second is the data block row level, and the third is the data block level.
[0081] Specifically, combined Figure 5As shown, the total coding budget is first obtained based on the data to be compressed and the set target compression ratio, and then the frame-level information is obtained to perform frame-level rate control. In one optional embodiment, the frame-level rate control, that is, based on the frame-level information and the total coding budget, the frame-level rate control is performed to obtain the basic coding budget for each data block row, including determining the total data block coding budget based on the total coding budget and the size of the frame-level information; and obtaining the basic coding budget for each data block row based on the total data block coding budget and the second number of data blocks in each row of data blocks.
[0082] Specifically, frame-level rate control occurs at the beginning of data block encoding, and frame-level information has been encoded. The size of the frame-level information, such as the number of encoding bits consumed by the frame-level information encoding, is counted. Assuming that the number of encoding bits consumed by the frame-level encoding is HdrCons_Frm, the process of frame-level rate control is shown in the following formula:
[0083] (1)
[0084] Where S is the data to be compressed, that is, the size of the uncompressed demora compensation value in binary bits, R is the set target compression ratio, and LineBit_Avr is the result after frame-level bit rate control, which is the total coding bit budget for all data blocks in each data block row.
[0085] In one of the optional embodiments, after the frame-level rate control is completed, the data block row-level rate control is performed. The step of row-level rate control may include first removing the data block row information, such as the data block row header information, and then performing the data block row-level rate control, that is, performing the data block row-level rate control based on the row information of the data block row, the first number of data blocks in each data block group, and the basic coding budget of each data block row, and obtaining the initial coding budget of the first data block group of each data block row and the target coding budget of the first data block, including: obtaining the basic coding budget of each data block and the remaining coding budget of the data block row based on the basic coding budget of each data block row, the size of the row information, and the second number; obtaining the basic coding budget of each data block group based on the basic coding budget of each data block and the first number; obtaining the initial coding budget of the first data block group of the data block row based on the basic coding budget of each data block, the remaining coding budget of the data block row, and the remaining coding budget of the previous data block row; obtaining the target coding budget of the first data block based on the basic coding budget of each data block group, the remaining coding budget of the data block row, and the remaining coding budget of the previous data block row.
[0086] The goal of data block row-level rate control is to allocate an initial coding bit budget to each data block group in the current data block row. The input of the row-level rate control for each row of data blocks is the remaining coding bit budget after the last data block group in the previous row is encoded, the number of coding bits consumed by encoding the header information of the current data block row, and the output LineBit_Avr of the frame-level rate control.
[0087] After the data block row header information is encoded, the data block row level rate control starts. Assuming that the number of encoding bits consumed by the data block row header information encoding is HdrCons_LineX, the data block row level rate control process is as follows:
[0088] (2)
[0089] in is the basic coding bit budget for each data block group, LineBlkNum is the total number of data blocks in the current data block row, is the remaining coding bit budget after the last data block group of the previous data block row is encoded, that is, the remaining coding budget of the previous data block row in itself; is the total coding bit budget for the next data block group, that is, the current coding budget in this application, is the coding bit budget of the next data block to be encoded, that is, the target coding budget in this application. After that, with the start of data block level rate control, Will change dynamically.
[0090] After completing the data block row-level code rate control, data block-level code rate budgeting is also required. In one optional embodiment, the current coding budget is updated based on the target coding size, including: when the current data block to be compressed is not the last data block of the current data block group and is not the first data block of the first data block group of the current data block row, the updated current coding budget is obtained based on the current coding budget before updating and the target coding size; when the current data block to be compressed is the last data block of the current data block group, the updated current coding budget is obtained based on the target coding size, the basic coding budget of each data block group and the current coding budget before updating.
[0091] In one of the optional embodiments, based on the current coding budget and the current number, a target coding budget for the next data block is obtained, including: obtaining an average coding budget for the remaining data blocks to be compressed based on the current coding budget and the current number; obtaining a remainder compression budget based on the current coding budget, the current number and the average compression budget; and obtaining a target coding budget for the next data block based on the average compression budget and the remainder compression budget.
[0092] After the current data block is encoded, assume that the number of encoding bits consumed by the current data block encoding is BlkConsBit.
[0093] If the current data block is not the last data block of the data block group, the data block level rate control process is as follows:
[0094] (3)
[0095] If the current block is the last block in the data block group, the block-level rate control process is as follows:
[0096] (4)
[0097] GrpRemBlkNum is the total number of data blocks that have not been encoded in the current data block group.
[0098] For ease of understanding, a specific embodiment is given. Assume that the number of data blocks in each data block group during the bit rate control process is 4, that is, N in formula (2) is 4. The resolution of the OLED screen corresponding to the demura compensation value to be compressed is 720x2400, the number of grayscales to be compressed is 3, the channels to be compressed are R, G, and B, and the original bit width of each compensation value is 6 bits. Then, the storage space required for the compensation value before compression is:
[0099]
[0100] Assuming that the compensation value needs to be compressed 6 times, the total coding bit budget is:
[0101]
[0102] After the original compensation value enters the compression system, the compensation value is first globally analyzed to obtain frame-level information, and then the frame-level information is encoded. Assuming that the number of encoding bits consumed by the frame-level information encoding is 2000 bits, Figure 6 Schematic diagram of frame level coding shown.
[0103] After the frame-level information is encoded, the remaining coding bit budget is 15,550,000 bits. Since the compressed compensation value corresponds to the OLED screen height of 2400 and the data block height is 4, the number of data block rows is 600. The coding bit budget allocated to each row of data blocks is:
[0104]
[0105] Since integer division is used to calculate line_avr_bgt, after calculating the average coding bit budget for each block line, there is still some coding bit budget left, as shown below:
[0106]
[0107] frm_bgt_remain is assigned to the first data block row.
[0108] After the frame-level information is encoded, the data block row-level encoding begins. For each row of data blocks, the encoder first analyzes all data blocks in the current data block row, extracts the data block row-level information, and then performs data block row-level encoding. Assume that the current encoding is the first data block row, and the consumed encoding bit budget is 300 bits, such as Figure 7 The data blocks shown are row-level encoded.
[0109] like Figure 7 As shown in the figure, after the data block row-level information is encoded, the remaining coding bit budget for the current data block row is 26,016 bits, the width of the data block is 24, and the number of data blocks in the current data block row is 30. The average coding bit budget allocated to each data block is:
[0110]
[0111] Since the calculation of line_blk_avr_bgt is integer division, after the calculation is completed, the remaining coding bit budget will be allocated to the first group of data blocks in the current data block line, as shown below:
[0112]
[0113] Assume that the data block group currently being encoded is the first group of data blocks in the current data block row. Since the average coding bit budget allocated to each data block in the current data block row is 867 bits, the coding bit budget of the data block group is:
[0114]
[0115] The coding bit budget of the first data block of the current data block group is:
[0116]
[0117] After completing the data block row-level code rate control, start encoding the data block. Assume that the optional compression mode of the current data block and the number of bits consumed by its encoding are as follows:
[0118]
[0119] As can be seen from the above table, there are 36 mode combinations for the three channels of R, G, and B, but not all combinations meet the coding bit budget requirements of the current data block group. The following table gives some mode combinations and the number of coding bits they consume:
[0120]
[0121] The Ffit mode combination shown in the above table consumes a total of 866 bits of coding bits, which is less than the coding bit budget of 970 bits of the data block. The Ffit mode combination can always meet the coding bit budget of the data block.
[0122] The total number of consumed coding bits of combinations 3 and 4 in the above table is not within the coding bit budget of the current data block, so mode combinations 3 and 4 will not be selected as the final coding mode.
[0123] The rate control will comprehensively select the final coding mode of the current data block from all mode combinations that meet the coding bit budget, combining the coding quality of each mode combination. Assuming that the best mode combination selected after the current data block is decision-making is combination 1, the remaining coding bit budget after the current data block is encoded is:
[0124]
[0125] After the current data block is encoded, the data block level bit rate control will be performed to calculate the coding bit budget of each remaining data block in the current data block group. Since the number of data blocks in each data block group is 4, after encoding the first data block of the current data block group, the number of data blocks remaining in the current data block group is 3, then the coding bit budget of the second data block of the current data block group is:
[0126]
[0127] The following table shows the mode of the last data block of the current data block group and the number of coded bits corresponding to the mode:
[0128]
[0129] Assuming that the mode combination finally selected by the encoder is Ffit0 / Ffit1 / Ffit2, after encoding the data block, the remaining coding bit budget of the current data block group is:
[0130]
[0131] The coding bit budget for the third data block of the current data block group is:
[0132]
[0133] Assuming that the number of coding bits consumed by the best mode combination selected for the third data block is 700 bits, after the encoding of data block 3 is completed, the remaining coding bit budget of the current data block group is:
[0134]
[0135] The coding bit budget of data block 4 of the current data block group is:
[0136]
[0137] Assuming that the number of coding bits consumed by the best mode combination selected for data block 4 of the current data block group is 900 bits, after the coding of data block 4 is completed, the coding bit budget for the next data block group is:
[0138]
[0139] The coding bit budget for the first data block of the next data block group is:
[0140]
[0141] The code rate control of each data block level in the next data block group is the same as that of the previous data block group. After the encoding of all data blocks in the current data block row is completed, the encoding and code rate control of the next data block row will begin until the encoding of all data block rows is completed.
[0142] Compared with the traditional fixed-ratio compression of the demura compensation value, the main advantage of this application is that the compression ratio can be adjusted within a certain range.
[0143] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0144] Based on the same inventive concept, the embodiment of the present application further provides a rate control device for implementing the rate control method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more rate control device embodiments provided below can refer to the limitations of the rate control method above, and will not be repeated here.
[0145] In an exemplary embodiment, Figure 8 As shown, a bit rate control device is provided, comprising:
[0146] The total coding budget determination module 801 is used to obtain the data to be compressed and the set target compression ratio, and obtain the total coding budget after compression based on the data to be compressed and the target compression ratio;
[0147] A grouping module 802 is used to divide the data to be compressed into blocks to obtain a plurality of data blocks, and to group each row of data blocks to obtain a data block group;
[0148] A row-level coding budget determination module 803, configured to obtain an initial coding budget for a first data block group of each data block row and a target coding budget for a first data block based on the total coding budget;
[0149] The data block coding budget determination module 804 is used to obtain the current coding budget of the current data block group and the target coding budget of the current data block to be compressed; the first current data block group is the first data block group of the first data block row;
[0150] The target coding size determination module 805 is used to determine each initial coding budget consumed by each coding mode of the current data block to be compressed, and determine the target coding size of the current data block to be compressed based on each initial coding budget and the target coding budget;
[0151] An updating module 806, configured to update the current encoding budget based on the target encoding size, and obtain the current number of remaining data blocks to be compressed in the current data block group;
[0152] The loop module 807 is used to obtain the target coding budget of the next data block based on the current coding budget and the current number, take the next data block as the current data block, and continue to execute the step of determining the initial coding budgets consumed by each coding mode of the current data block to be compressed until the coding of the data to be compressed is completed.
[0153] In one of the optional embodiments, the above device further includes:
[0154] A frame-level bit rate control module is used to identify the data to be compressed to obtain frame-level information, and based on the frame-level information and the total coding budget, perform frame-level bit rate control to obtain a basic coding budget for each data block row;
[0155] The above-mentioned row-level coding budget determination module 803 is also used to identify the data to be compressed to obtain row information of the data block row, and perform data block row-level code rate control based on the row information of the data block row, the first number of data blocks in each data block group and the basic coding budget of each data block row, to obtain the initial coding budget of the first data block group of each data block row and the target coding budget of the first data block.
[0156] In one of the optional embodiments, the frame-level bit rate control module is specifically used to determine the total data block coding budget based on the total coding budget and the size of the frame-level information; and obtain the basic coding budget for each data block row based on the total data block coding budget and the second number of data blocks in each row of data blocks.
[0157] In one of the optional embodiments, the row-level coding budget determination module 803 is specifically used to obtain the basic coding budget of each data block and the remaining coding budget of the data block row based on the basic coding budget of each data block row, the size of the row information and the second quantity; obtain the basic coding budget of each data block group based on the basic coding budget of each data block and the first quantity; obtain the initial coding budget of the first data block group of the data block row based on the basic coding budget of each data block, the remaining coding budget of the data block row and the remaining coding budget of the previous data block row; obtain the target coding budget of the first data block based on the basic coding budget of each data block group, the remaining coding budget of the data block row and the remaining coding budget of the previous data block row.
[0158] In one of the optional embodiments, the above-mentioned update module 805 is specifically used to obtain the updated current coding budget based on the current coding budget before updating and the target coding size when the current data block to be compressed is not the last data block of the current data block group and is not the first data block of the first data block group of the current data block row; and to obtain the updated current coding budget based on the target coding size, the basic coding budget of each data block group and the current coding budget before updating when the current data block to be compressed is the last data block of the current data block group.
[0159] In one of the optional embodiments, the above-mentioned loop module 806 is specifically used to obtain the average coding budget of the remaining data blocks to be compressed based on the current coding budget and the current number; obtain the remainder compression budget based on the current coding budget, the current number and the average compression budget; and obtain the target coding budget for the next data block based on the average compression budget and the remainder compression budget.
[0160] In one of the optional embodiments, the above-mentioned device further includes: a target compression ratio determination module, which is used to obtain the available capacity of the on-chip memory and obtain the target compression ratio based on the available capacity.
[0161] Each module in the above-mentioned bit rate control device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0162] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig. 9 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a code rate control method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0163] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0164] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0165] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0166] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0167] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0168] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0169] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A rate control method, characterized in that: The method comprises: Acquire the data to be compressed and the set target compression ratio, and obtain the total coding budget after compression based on the data to be compressed and the target compression ratio; Dividing the data to be compressed into a plurality of data blocks, and grouping each row of data blocks into a data block group; Based on the total coding budget, obtain an initial coding budget for a first data block group of each data block row and a target coding budget for a first data block; Obtaining a current coding budget for a current data block group and a target coding budget for a current data block to be compressed; the first current data block group is a first data block group of a first data block row; Determine each coding budget consumed by each coding mode of the current data block to be compressed, and determine a target coding size of the current data block to be compressed based on each coding budget consumed by each coding mode and the target coding budget; updating the current encoding budget based on the target encoding size, and obtaining the current number of remaining data blocks to be compressed in the current data block group; Based on the current coding budget and the current number, a target coding budget for the next data block is obtained, the next data block is used as the current data block, and the step of determining the initial coding budgets consumed by the coding modes of the current data block to be compressed is continued until the coding of the data to be compressed is completed.
2. The method according to claim 1, characterized in that The obtaining, based on the total coding budget, an initial coding budget for the first data block group of each data block row and a target coding budget for the first data block includes: Identify the data to be compressed to obtain frame-level information, and perform frame-level bit rate control based on the frame-level information and the total coding budget to obtain a basic coding budget for each data block row; The data to be compressed is identified to obtain row information of the data block row, and data block row-level code rate control is performed based on the row information of the data block row, the first number of data blocks in each of the data block groups, and the basic coding budget of each data block row, to obtain an initial coding budget for the first data block group of each of the data block rows and a target coding budget for the first data block.
3. The method according to claim 2, characterized in that The frame-level bit rate control is performed based on the frame-level information and the total coding budget to obtain a basic coding budget for each data block row, including: Determining a total data block coding budget based on the total coding budget and the size of the frame level information; A basic coding budget for each data block row is obtained based on the total data block coding budget and the second number of the data blocks in each data block row.
4. The method according to claim 3, characterized in that The data block row level code rate control is performed based on the row information of the data block row, the first number of data blocks in each of the data block groups, and the basic coding budget of each of the data block rows to obtain an initial coding budget for the first data block group of each of the data block rows and a target coding budget for the first data block, including: Based on the basic coding budget of each data block row, the size of the row information and the second quantity, obtain a basic coding budget of each data block and a remaining coding budget of the data block row; Based on the basic coding budget of each data block and the first number, obtain a basic coding budget for each data block group; Based on the basic coding budget of each data block, the remaining coding budget of the data block row and the remaining coding budget of the previous data block row, an initial coding budget of a first data block group of the data block row is obtained; A target coding budget for the first data block is obtained based on the basic coding budget of each data block group, the remaining coding budget of the data block row, and the remaining coding budget of the previous data block row.
5. The method according to claim 4, characterized in that The updating the current encoding budget based on the target encoding size comprises: When the current data block to be compressed is not the last data block of the current data block group and is not the first data block of the first data block group of the current data block row, obtaining the updated current coding budget based on the current coding budget before updating and the target coding size; When the current data block to be compressed is the last data block of the current data block group, the updated current coding budget is obtained based on the target coding size, the basic coding budget of each data block group and the current coding budget before updating.
6. The method according to any one of claims 1 to 5, characterized in that: The obtaining a target coding budget for a next data block based on the current coding budget and the current quantity includes: Obtaining an average coding budget of the remaining data blocks to be compressed according to the current coding budget and the current number; Obtaining a remainder compression budget based on the current encoding budget, the current number, and the average compression budget; A target coding budget for a next data block is obtained based on the average compression budget and the residual compression budget.
7. The method according to claim 1, characterized in that The method further comprises: The available capacity of the on-chip memory is obtained, and a target compression ratio is obtained based on the available capacity.
8. A bit rate control device, characterized in that: The device comprises: A total coding budget determination module, used to obtain the data to be compressed and a set target compression ratio, and obtain a total coding budget after compression based on the data to be compressed and the target compression ratio; A grouping module, used for dividing the data to be compressed into a plurality of data blocks, and grouping each row of data blocks into a data block group; A row-level coding budget determination module, configured to obtain an initial coding budget for a first data block group of each data block row and a target coding budget for a first data block based on the total coding budget; A data block coding budget determination module is used to obtain a current coding budget for a current data block group and a target coding budget for a current data block to be compressed; the first current data block group is a first data block group of a first data block row; A target coding size determination module, used to determine each initial coding budget consumed by each coding mode of the current data block to be compressed, and determine the target coding size of the current data block to be compressed based on each of the initial coding budgets and the target coding budget; An updating module, configured to update the current encoding budget based on the target encoding size, and obtain the current number of remaining data blocks to be compressed in the current data block group; A loop module is used to obtain a target coding budget for a next data block based on the current coding budget and the current number, take the next data block as the current data block, and continue to execute the step of determining each initial coding budget consumed by each coding mode of the current data block to be compressed until the coding of the data to be compressed is completed.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Video data compression or decompression method and system
CN103581673A
Reference frame cache data compression method, computer device and computer readable storage medium
CN112887725A
Image processing apparatus and method, and industrial camera
CN118250535A
Advanced picture quality oriented rate control for low-latency streaming applications
US20170289551A1
