Method and apparatus for code rate control, computer device, storage medium and computer program product

By dynamically adjusting the compression ratio and using a bitrate control method, screen compensation value data is processed in blocks and groups, solving the problems of uneven screen brightness and excessive ROM resource consumption, and achieving flexible encoding control and storage space optimization.

CN119011849BActive Publication Date: 2025-10-17GLENFLY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411082739.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2025-10-17
Estimated Expiration
2044-08-07

AI Technical Summary

Technical Problem

The existing screen display brightness unevenness phenomenon (MURA effect) leads to excessive ROM resource consumption, and the existing compression method has a fixed compression ratio, which cannot effectively save storage space.

Method used

By dynamically adjusting the compression ratio, the data to be compressed is processed in blocks and groups, and the encoding budget and encoding mode of each data block are dynamically determined, thus achieving flexible encoding control.

Benefits of technology

It enables flexible adjustment of encoding quality under different storage spaces, effectively saving ROM resources and reducing chip costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119011849B_ABST
    Figure CN119011849B_ABST
Patent Text Reader

Abstract

The application relates to a code rate control method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: obtaining to-be-compressed data and a set target compression rate, and obtaining a total encoding budget after compression; the to-be-compressed data is divided into a plurality of data blocks, and each row of data blocks is grouped to obtain a data block group; an initial value is determined based on the total encoding budget, a current encoding budget of the current data block group and a target encoding budget of a current to-be-compressed data block are obtained; the encoding budgets consumed by each encoding mode of the current to-be-compressed data block are determined, so that the target encoding size of the current to-be-compressed data block is determined; the current encoding budget is updated based on the target encoding size, and the current number of to-be-compressed data blocks remaining in the current data block group is obtained; the target encoding budget of a next data block is obtained based on the current encoding budget and the current number, and the next data block is taken as the current data block until the end. The method can adjust the compression rate.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data compression, in particular to a code rate control method and device, computer equipment, storage medium and computer program product. BACKGROUND

[0002] Due to the limitation of the manufacturing process, the display brightness of each pixel is not uniform at the same gray level, which is called MURA (uneven) effect. In order to eliminate the MURA effect of the panel, the compensation value of each pixel at a certain gray level is usually burned into the ROM (read only memory) of the panel display driving chip. The amount of data burned will increase significantly with the increase of the size of the panel. Taking a panel with a size of 2560x1600 as an example, and the compensation value of 3 gray levels needs to be stored, and each compensation value is 6 bits, so the total compensation value of RGB three channels needs 221.184Mb of ROM resources.

[0003] In order to save ROM resources and reduce chip cost, the compensation value is usually compressed and the compressed binary bit stream is burned into the ROM.

[0004] However, the compression method based on spatial downsampling or other lookup table known at present has a fixed compression ratio, resulting in a large storage space. SUMMARY

[0005] Therefore, it is necessary to provide a code rate control method and device, computer equipment, computer readable storage medium and computer program product capable of adjusting the compression ratio in view of the above technical problems.

[0006] In a first aspect, the present application provides a code rate control method, which comprises:

[0007] obtaining to-be-compressed data and a set target compression ratio, and obtaining a total encoding budget after compression based on the to-be-compressed data and the target compression ratio;

[0008] dividing the to-be-compressed data into a plurality of data blocks, and grouping each row of data blocks into a data block group;

[0009] obtaining an initial encoding budget of a first data block group of each row of data blocks and a target encoding budget of a first data block based on the total encoding budget;

[0010] obtaining a current encoding budget of a current data block group and a target encoding budget of a current to-be-compressed data block; the first current data block group is the first data block group of the first row of data blocks;

[0011] determining an initial encoding budget consumed by each encoding mode of a current data block to be compressed, and determining a target encoding size of the current data block to be compressed based on the initial encoding budget consumed by each encoding mode and a target encoding budget;

[0012] updating the current encoding budget based on the target encoding size, and obtaining a current number of data blocks to be compressed remaining in the current data block group;

[0013] obtaining a target encoding budget of a next data block based on the current encoding budget and the current number, taking the next data block as a current data block, and continuing to perform the step of determining an initial encoding budget consumed by each encoding mode of a current data block to be compressed until the data to be compressed is encoded.

[0014] In one of the embodiments, the obtaining of the initial encoding budget of the first data block group and the target encoding budget of the first data block of each data block row based on the total encoding budget comprises:

[0015] identifying frame-level information from the data to be compressed, and performing frame-level rate control based on the frame-level information and the total encoding budget to obtain a basic encoding budget of each data block row;

[0016] identifying row information of a data block row from the data to be compressed, and performing data block row-level rate control based on the row information of the data block row, a first number of data blocks in each data block group, and the basic encoding budget of each data block row to obtain the initial encoding budget of the first data block group and the target encoding budget of the first data block of each data block row.

[0017] In one of the embodiments, the performing of the frame-level rate control based on the frame-level information and the total encoding budget to obtain the basic encoding budget of each data block row comprises:

[0018] determining a total data block encoding budget based on the total encoding budget and a size of the frame-level information;

[0019] obtaining the basic encoding budget of each data block row based on the total data block encoding budget and a second number of data blocks in each data block row.

[0020] In one of the embodiments, the performing of 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 encoding budget of each data block row to obtain the initial encoding budget of the first data block group and the target encoding budget of the first data block of each data block row comprises:

[0021] obtaining a basic encoding budget of each data block and a remaining encoding budget of the data block row based on the basic encoding budget of each data block row, the size of the row information and the second number;

[0022] obtaining a basic encoding budget of each data block group based on the basic encoding budget of each data block and the first number;

[0023] obtaining an initial encoding budget of a first data block group of the data block row based on the basic encoding budget of each data block, the remaining encoding budget of the data block row and a remaining encoding budget of a previous data block row;

[0024] obtaining a target encoding budget of a first data block based on the basic encoding budget of each data block group, the remaining encoding budget of the data block row and the remaining encoding budget of the previous data block row.

[0025] In one embodiment, the updating the current encoding budget based on the target encoding size comprises:

[0026] in a case that the current data block to be compressed is a last data block of the current data block group, obtaining the updated current encoding budget based on the target encoding size, the basic encoding budget of each data block group and the current encoding budget before updating.

[0027] in a case that the current data block to be compressed is a last data block of the current data block group, obtaining the updated current encoding budget based on the target encoding size, the basic encoding budget of each data block group and the current encoding budget before updating.

[0028] In one embodiment, the obtaining a target encoding budget of a next data block based on the current encoding budget and the current number comprises:

[0029] obtaining an average encoding budget of remaining data blocks to be compressed based on the current encoding budget and the current number;

[0030] obtaining a remainder encoding budget based on the current encoding budget, the current number and the average encoding budget;

[0031] obtaining a target encoding budget of a next data block based on the average encoding budget and the remainder encoding budget.

[0032] In one embodiment, the method further comprises:

[0033] obtaining a target compression rate based on an available capacity of an on-chip memory.

[0034] In a second aspect, the present application provides a rate control device, which comprises:

[0035] a total encoding budget determination module, configured to obtain to-be-compressed data and a set target compression rate, and obtain a total encoding budget after compression based on the to-be-compressed data and the target compression rate;

[0036] a grouping module, configured to group the to-be-compressed data to obtain a plurality of data blocks, and group each row of data blocks to obtain a data block group;

[0037] a row-level encoding budget determination module, configured to obtain an initial encoding budget of a first data block group of each row of data blocks and a target encoding budget of a first data block based on the total encoding budget;

[0038] a data block encoding budget determination module, configured to obtain a current encoding budget of a current data block group and a target encoding budget of a current to-be-compressed data block; the first current data block group is the first data block group of the first row of data blocks;

[0039] a target encoding size determination module, configured to determine initial encoding budgets consumed by each encoding mode of the current to-be-compressed data block, and determine a target encoding size of the current to-be-compressed data block based on the initial encoding budgets and the target encoding budget;

[0040] an updating module, configured to update the current encoding budget based on the target encoding size, and obtain a current number of to-be-compressed data blocks remaining in the current data block group;

[0041] a loop module, configured to obtain a target encoding budget of a next data block based on the current encoding budget and the current number, take the next data block as a current data block, and continue to perform the step of determining initial encoding budgets consumed by each encoding mode of the current to-be-compressed data block until the to-be-compressed data is encoded.

[0042] In a third aspect, the present application 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 provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps of the above method when executed by a processor.

[0044] In a fifth aspect, the present application provides a computer program product, comprising a computer program, and the computer program implements the steps of the above method when executed by a processor.

[0045] The above-mentioned rate control method, apparatus, computer device, 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 a 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 to obtain a data block group; obtaining a current coding budget for the current data block group and a target coding budget for the current data block to be compressed; wherein the initial coding budget for each data block row and the target coding budget for 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, the target coding size of the current data block to be compressed is determined; based on the target coding size, the current coding budget is updated, and the current number of data blocks to be compressed remaining 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 each initial coding budget consumed by each coding mode of the current data block to be compressed are continued until the coding of the data to be compressed is completed. In this way, no matter what target compression ratio is set, the coding code 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. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. 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 any creative work.

[0047] Figure 1 1 is a flow chart of a rate control method according to an embodiment;

[0048] Figure 2 is a schematic diagram of a compression process in one embodiment;

[0049] Figure 3 A schematic diagram of blocks in one embodiment;

[0050] Figure 4 A schematic diagram of data block group-level encoding in one embodiment;

[0051] Figure 5 1 is a flow chart of a rate control method according to another embodiment;

[0052] Figure 6 is a schematic diagram of frame-level rate control in one embodiment;

[0053] Figure 7 a schematic diagram of row-level rate control in one embodiment;

[0054] Figure 8 a block diagram of a rate control device in one embodiment;

[0055] Figure 9 an internal block diagram of a computer device in one embodiment. DETAILED DESCRIPTION

[0056] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.

[0057] In one embodiment, as shown in Figure 1 a rate control method is provided, and the present embodiment takes the method applied to a terminal as an example. It should 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 can be realized through the interaction of the terminal and the server. In the present embodiment, the method includes the following steps:

[0058] S102: obtaining to-be-compressed data and a set target compression ratio, and obtaining a total encoding budget after compression based on the to-be-compressed data and the target compression ratio.

[0059] The to-be-compressed data can be any data, and in the present embodiment, the to-be-compressed data is compensation value data of a screen. For example, a panel with a size of 2560x1600 is taken as an example, and compensation values of 3 gray scales are required to be stored, and each compensation value is 6 bits. Therefore, the to-be-compressed data is 221.184 Mb.

[0060] The set target compression ratio is any value within a compression ratio range. For example, the compression ratio range can 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 compression ratio within the range of [N, M] can be adjusted arbitrarily in the present embodiment. Since there are many compression modes used by a compression system, in order to ensure that the target code rate is reached after compression, a mode is set, and no matter which data block in the compensation value, the mode can always achieve M times compression.

[0061] In this embodiment, only one example of the mode that can achieve any compression ratio in the above compression ratio range is given, and it should be noted that this mode that can always achieve M times compression is not fixed. Assuming that M is 6, that is, the maximum compression ratio of the compensation value compression system is 6 times, and thus a mode needs to be determined that can always achieve 6 times compression regardless of the data characteristics of the data block. Here, a simple spatial downsampling and bit truncation method is given to achieve a 6 times 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, and in addition, only the high 4 bits of each 6-bit compensation value in the 4x2 data block are retained. At this time, the data amount of the compressed 8x4 original block is 32 bits, the original amount is 192 bits, and the compression ratio reaches 6 times. For details, see Figure 2 .

[0063] In one of the optional embodiments, 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 the storage requirement.

[0064] S104: The data to be compressed is blocked to obtain a plurality of data blocks, and each row of data blocks is grouped to obtain a data block group.

[0065] As shown in Figure 3 , the input compensation value of the OLED screen to be compressed is blocked, that is, the data to be compressed is blocked. Assuming that the width of the OLED screen is W and the height of the OLED screen is H, the data amount is WxH. First, the input two-dimensional compensation value data is blocked, the data block size is wxh, the compression system compresses each data block in the raster scan order, and the code rate control is used for each data block to achieve the target code rate.

[0066] S106: Based on the total encoding budget, the initial encoding budget of the first data block group of each data block row and the target encoding budget of the first data block are obtained.

[0067] In this embodiment, in order to implement code rate control, code rate control is performed in each level, and in this step, data block row level code rate control is performed, and the purpose is to obtain the initial encoding budget of the first data block group of each data block row and the target encoding budget of the first data block.

[0068] S108: Obtain a current encoding budget of a current data block group and a target encoding budget of a current to-be-compressed data block; 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 encoding budget of the current data block group is the encoding budget of the first data block group of the first data block row; the target encoding budget of the current to-be-compressed data block is the target encoding budget of the first data block of the first data block group of the first data block row, and the current encoding budget of the subsequent current data block group is obtained based on the residual encoding budget of the previous data block group and the basic encoding budget of the data block group; if the current data block group is the first data block group of each row, the current encoding budget is obtained based on the initial encoding budget of the first data block group of each row calculated based on the total encoding budget and the residual encoding budget of the previous data block row; if the current to-be-compressed data block is not the first data block of the data block group, the target encoding budget of the current to-be-compressed data block is obtained based on the residual encoding budget of the previous data block and the basic encoding budget of the data block; if the current to-be-compressed data block is the first data block of the data block group, the target encoding budget is obtained based on the residual encoding budget of the previous data block group and the basic encoding budget of the data block.

[0070] S110: Determine the initial encoding budget consumed by each encoding mode of the current to-be-compressed data block, and determine the target encoding size of the current to-be-compressed data block based on the encoding budget consumed by each encoding mode and the target encoding budget.

[0071] The consumed bit number corresponding to each encoding mode is different, so the target encoding size of the current to-be-compressed data block is determined based on the encoding budget consumed by each encoding mode and the target encoding budget, for example, assuming that the target encoding budget is A, the encoding budget consumed by each encoding mode is B1, B2 and B3 respectively, and A is greater than B1 and less than B2 and B3, therefore, only the encoding mode corresponding to B1 can determine the target encoding size of the current to-be-compressed data block as B1.

[0072] S112: Update the current encoding budget based on the target encoding size, and obtain the current number of to-be-compressed data blocks remaining in the current data block group.

[0073] S114: Obtain the target encoding budget of the next data block based on the current encoding budget and the current number, take the next data block as the current data block, and continue to perform the step of determining the initial encoding budget consumed by each encoding mode of the current to-be-compressed data block until the to-be-compressed data encoding is completed.

[0074] The current encoding budget is updated based on the target encoding size, i.e., the current encoding budget is equal to the current encoding budget minus the target encoding size, so that the remaining encoding budget of the current data block group is obtained, which is used for the encoding 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 encoding budget of the next data block is obtained based on the current number of the remaining data blocks and the current encoding budget, for example, a quotient and a remainder are obtained by dividing the current encoding budget by the current number, and the target encoding budget of the next data block is equal to the quotient plus the remainder.

[0076] If there are no remaining data blocks in the data block group, the remaining encoding budget of the current data block group is added to the encoding 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 data blocks in the data block group are encoded, the remaining encoding budget of the current data block group is added to the first data block group of the next data block row.

[0077] In the embodiment, since the compression quality of the Deura value affects the subjective viewing effect of the OLED panel, in the block-based compression framework, in order to prevent the last few data blocks of a row of data blocks from having poor compression effect due to insufficient encoding bit budget, the application proposes data block level rate control based on data block groups, i.e., when performing data block level rate control, the data blocks are grouped, i.e., when performing rate control on the current data block, the subsequent data blocks in the group that have not been encoded are considered, assuming that the number of data blocks in each group is N, where the size of N is not limited, and N 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 each group of data blocks is encoded, if the group of data blocks has excess encoding bit budget, the excess encoding bit budget is given to the next group of data blocks for use, as shown in FIG. 4. Figure 4

[0078] ​The code rate control method can set the compression ratio arbitrarily, and thus can realize code rate control based on the target compression ratio. The specific code rate control includes obtaining a total encoding 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 to obtain a data block group; obtaining a current encoding budget of the current data block group and a target encoding budget of the current data block to be compressed; wherein the initial encoding budget of each row of data blocks and the target encoding budget of the first data block are obtained based on the total encoding budget; determining the initial encoding budget consumed by each encoding mode of the current data block to be compressed, and determining the target encoding size of the current data block to be compressed based on the initial encoding budget and the target encoding budget; updating the current encoding budget based on the target encoding size, and obtaining the current number of data blocks to be compressed remaining in the current data block group; obtaining the target encoding budget of the next data block based on the current encoding budget and the current number, taking the next data block as the current data block, and continuing to perform the step of determining the initial encoding budget consumed by each encoding mode of the current data block to be compressed until the encoding of the data to be compressed is completed. In this way, no matter what target compression ratio is set, the code rate control of encoding can be realized based on the target compression ratio, and thus the storage of compensation values with different qualities can be realized based on different storage spaces.

[0079] In one optional embodiment, obtaining the initial encoding budget of the first data block group and the target encoding budget of the first data block of each row of data blocks based on the total encoding budget includes: identifying the data to be compressed to obtain frame-level information, and performing frame-level code rate control based on the frame-level information and the total encoding budget to obtain a basic encoding budget of each row of data blocks; identifying the data to be compressed to obtain row information of the data block row, and performing 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 encoding budget of each row of data blocks to obtain the initial encoding budget of the first data block group and the target encoding budget of the first data block of each row of data blocks.

[0080] To realize accurate control of the code rate, the application realizes three-level code rate control, the first level being frame level, the second being data block row level, and the third being data block level.

[0081] Specifically, in combination with Figure 5As shown, first, the total encoding budget is obtained based on the data to be compressed and the target compression ratio set, and then the frame-level information is obtained to perform frame-level rate control. In one optional embodiment, the frame-level rate control is performed based on the frame-level information and the total encoding budget to obtain the basic encoding budget of each data block row, including determining the total data block encoding budget based on the size of the total encoding budget and the frame-level information, and obtaining the basic encoding budget of each data block row based on the total data block encoding budget and the second number of data blocks in each data block row.

[0082] Specifically, the frame-level rate control occurs at the beginning of data block encoding, and the frame-level information has been encoded and the size of the frame-level information is counted, for example, the number of encoding bits consumed by the frame-level information encoding. Assuming that the number of encoding bits consumed by the frame-level encoding is HdrCons_Frm, the process of the frame-level rate control is shown in the following formula:

[0083] (1)

[0084] Where S is the data to be compressed, i.e., the size of the Demura compensation value without compression in binary bit units, R is the target compression ratio set, and LineBit_Avr is the result after the frame-level rate control, which is the total encoding bit budget of all data blocks in each data block row.

[0085] In one optional embodiment, after the frame-level rate control is completed, data block row-level rate control is performed. The steps of the row-level rate control can include obtaining the data block row information, such as the data block row header information, in sequence, and then 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 encoding budget of each data block row to obtain the initial encoding budget of the first data block group of each data block row and the target encoding budget of the first data block, including: obtaining the basic encoding budget of each data block and the remaining encoding budget of the data block row based on the basic encoding budget of each data block row, the size of the row information, and the second number; obtaining the basic encoding budget of each data block group based on the basic encoding budget of each data block and the first number; obtaining the initial encoding budget of the first data block group of the data block row based on the basic encoding budget of each data block, the remaining encoding budget of the data block row, and the remaining encoding budget of the previous data block row; and obtaining the target encoding budget of the first data block based on the basic encoding budget of each data block group, the remaining encoding budget of the data block row, and the remaining encoding budget of the previous data block row.

[0086] The goal of the data block row level rate control is to assign an initial encoding bit number budget to each data block group in the current data block row. The input of the row level rate control of each data block row is the remaining encoding bit budget of the last data block group of the last data block row, the encoding bit number consumed by the current data block row header information encoding and the output LineBit_Avr of the frame level rate control.

[0087] When the data block row header information encoding is completed, the data block row level rate control is started. Assuming that the encoding bit number 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] wherein is the basic encoding bit budget of each data block group, LineBlkNum is the total number of data blocks of the current data block row, is the remaining encoding bit budget of the last data block group of the last data block row, i.e. the remaining encoding budget of the last data block row in the current data block row; is the total encoding bit budget of the next data block group, i.e. the current encoding budget in the present application, is the encoding bit budget of the next data block to be encoded, i.e. the target encoding budget in the present application, which will dynamically change after the start of the data block level rate control,

[0090] After the data block row level rate control is completed, the data block level rate control is also needed. In one of the optional embodiments, the current encoding budget is updated based on the target encoding size, including: in the case that 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 encoding budget is obtained based on the target encoding size and the current encoding budget before the update; in the case that the current data block to be compressed is the last data block of the current data block group, the updated current encoding budget is obtained based on the target encoding size, the basic encoding budget of each data block group and the current encoding budget before the update.

[0091] In one of the optional embodiments, the target encoding budget of the next data block is obtained based on the current encoding budget and the current number, including: the average encoding budget of the remaining data blocks to be compressed is obtained according to the current encoding budget and the current number; the remainder compression budget is obtained based on the current encoding budget, the current number and the average compression budget; the target encoding budget of the next data block is obtained 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 code rate control process is as follows:

[0094] (3)

[0095] If the current data block is the last data block of the data block group, the data block level code rate control process is as follows:

[0096] (4)

[0097] where GrpRemBlkNum is the total number of data blocks in the current data block group that have not yet been encoded.

[0098] To facilitate understanding, a specific embodiment is given, assuming that the number of data blocks in each data block group in the code 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 gray scales to be compressed is 3, the channels to be compressed are R, G, and B three channels, and the original bit width of each compensation value is 6 bits. Therefore, the storage space required by the compensation value before compression is:

[0099]

[0100] Assuming that the compensation value needs to be compressed by 6 times, the total encoding bit budget is:

[0101]

[0102] After the original compensation value enters the compression system, the compensation value is first analyzed globally 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, as shown in the schematic diagram of frame level encoding. Figure 6

[0103] After the frame level information encoding is completed, the remaining encoding bit budget is 15,550,000 bits. Since the compensation value to be compressed corresponds to the screen height of the OLED, which is 2400, and the data block height is 4, the number of data block rows is 600, and the encoding bit budget allocated to each row of data blocks is:

[0104]

[0105] Since the integer division is used to calculate line_avr_bgt, after the average encoding bit budget of each data block row is calculated, there is still a remaining encoding bit budget, 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 coding bit budget is 300 bits, as shown in the following example: 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 data block width 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 divisible, 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 coded 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 for this data block group is:

[0114]

[0115] The coding bit budget for the first data block of the current data block group is:

[0116]

[0117] After completing the row-level code rate control for the data block, we start encoding the data block. Assume that the available compression modes for the current data block and the number of bits consumed by its encoding are as follows:

[0118]

[0119] As can be seen from the table above, there are 36 mode combinations for the R, G, and B channels. However, not all combinations meet the coding bit budget requirements of the current data block group. The following table shows some mode combinations and the number of coding bits consumed:

[0120]

[0121] The Ffit mode combination shown in the table above consumes a total of 866 coding bits, which is less than the coding bit budget of 970 bits for 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] Rate control selects the final coding mode for the current data block from all mode combinations that meet the coding bit budget, taking into account the coding quality of each mode combination. Assuming that the best mode combination selected after the decision 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, data block-level rate control is performed to calculate the coding bit budget for 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. The coding bit budget for 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 coding 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 in the current block group is:

[0132]

[0133] Assuming that the optimal mode combination selected for the third data block consumes 700 bits of coding bits, after the coding of data block 3 is completed, the remaining coding bit budget for the current data block group is:

[0134]

[0135] The encoding bit budget of the data block 4 of the current data block group is:

[0136]

[0137] Supposing that the encoding bit number consumed by the optimal mode combination selected by the data block 4 of the current data block group is 900 bits, after the data block 4 is encoded, the encoding bit budget of the next data block group is:

[0138]

[0139] The encoding bit budget of 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, until the encoding of all data blocks in the current data block row is completed, and then the encoding and code rate control of the next data block row is started, until the encoding of all data block rows is completed.

[0142] Compared with the fixed compression ratio compression of the Demura compensation value in the prior art, the main advantage of the present application is that the compression ratio in a certain range can be adjusted.

[0143] It should be understood that, although each step in the flowchart involved in each of the above embodiments is shown in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each of the above embodiments can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.

[0144] Based on the same inventive concept, the present application also provides a code rate control device for implementing the above-mentioned code rate control method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, and therefore the specific limitations in one or more code rate control device embodiments provided below can refer to the limitations of the code rate control method in the above text, which will not be repeated here.

[0145] In one exemplary embodiment, as shown in Figure 8 a code rate control device is provided, comprising:

[0146] The total encoding budget determination module 801 is configured to obtain the to-be-compressed data and a set target compression ratio, and obtain a total encoding budget after compression based on the to-be-compressed data and the target compression ratio.

[0147] The grouping module 802 is configured to divide the to-be-compressed data into a plurality of data blocks, and group each row of data blocks into a data block group.

[0148] The row-level encoding budget determination module 803 is configured to obtain an initial encoding budget of a first data block group of each row of data blocks and a target encoding budget of a first data block based on the total encoding budget.

[0149] The data block encoding budget determination module 804 is configured to obtain a current encoding budget of a current data block group and a target encoding budget of a current to-be-compressed data block. The first current data block group is the first data block group of the first row of data blocks.

[0150] The target encoding size determination module 805 is configured to determine initial encoding budgets consumed by each encoding mode of the current to-be-compressed data block, and determine a target encoding size of the current to-be-compressed data block based on the initial encoding budgets and the target encoding budget.

[0151] The updating module 806 is configured to update the current encoding budget based on the target encoding size, and obtain a current number of to-be-compressed data blocks remaining in the current data block group.

[0152] The loop module 807 is configured to obtain a target encoding budget of a next data block based on the current encoding budget and the current number, take the next data block as the current to-be-compressed data block, and continue to perform the step of determining the initial encoding budgets consumed by each encoding mode of the current to-be-compressed data block until the to-be-compressed data is encoded.

[0153] In one of the optional embodiments, the apparatus further includes:

[0154] The frame-level rate control module is configured to identify the to-be-compressed data to obtain frame-level information, and perform frame-level rate control based on the frame-level information and the total encoding budget to obtain a basic encoding budget of each row of data blocks.

[0155] The row-level encoding budget determination module 803 is further configured to identify the to-be-compressed data to obtain row information of the row of data blocks, and perform row-level rate control based on the row information of the row of data blocks, a first number of data blocks in each data block group, and the basic encoding budget of each row of data blocks to obtain the initial encoding budget of the first data block group of each row of data blocks and the target encoding budget of the first data block.

[0156] In one of the optional embodiments, the frame-level code rate control module is specifically configured to determine a total data block encoding budget based on the total encoding budget and the size of the frame-level information; and obtain a basic encoding budget of each data block row based on the total data block encoding budget and the second quantity of data blocks in each data block row.

[0157] In one of the optional embodiments, the row-level encoding budget determination module 803 is specifically configured to obtain a basic encoding budget of each data block and a remaining encoding budget of the data block row based on the basic encoding budget of each data block row, the size of the row information, and the second quantity; obtain a basic encoding budget of each data block group based on the basic encoding budget of each data block and the first quantity; obtain an initial encoding budget of a first data block group of the data block row based on the basic encoding budget of each data block, the remaining encoding budget of the data block row, and the remaining encoding budget of the previous data block row; and obtain a target encoding budget of the first data block based on the basic encoding budget of each data block group, the remaining encoding budget of the data block row, and the remaining encoding budget of the previous data block row.

[0158] In one of the optional embodiments, the updating module 805 is specifically configured to obtain an updated current encoding budget based on the target encoding size and the current encoding budget before the updating, in a case that 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 obtain the updated current encoding budget based on the target encoding size, the basic encoding budget of each data block group, and the current encoding budget before the updating, in a case that 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 loop module 806 is specifically configured to obtain an average encoding budget of the remaining data blocks to be compressed based on the current encoding budget and the current quantity; obtain a remainder compression budget based on the current encoding budget, the current quantity, and the average compression budget; and obtain a target encoding budget of the next data block based on the average compression budget and the remainder compression budget.

[0160] In one of the optional embodiments, the device further includes a target compression ratio determination module configured to obtain an available capacity of the on-chip memory and obtain the target compression ratio based on the available capacity.

[0161] The modules in the code rate control device can be implemented by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in a hardware form, or stored in a memory in a computer device in a software form, so as to be called and executed by a processor to perform operations corresponding to the modules.

[0162] In an exemplary embodiment, a computer device, which can be a terminal, is provided, and an internal structure diagram of the computer device can be as shown in FIG. 1. Figure 9 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 configured 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 running the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to perform wired or wireless communication with external terminals. The wireless communication can be achieved through WIFI, mobile cellular network, NFC (Near Field Communication) or other technologies. The computer program is executed by the processor to implement a rate control method. The display unit of the computer device is configured 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. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, a trackball or a touchpad arranged on the shell of the computer device, or an external keyboard, a touchpad or a mouse, etc.

[0163] Those skilled in the art can understand that Figure 9 The structure shown in the above embodiment is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the diagram, or combine certain components, or have a different arrangement of components.

[0164] In an embodiment, a computer device is also provided, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0165] In an embodiment, a computer readable storage medium is provided, which stores a computer program. The computer program is executed by a processor to implement the steps in the above method embodiments.

[0166] In an embodiment, a computer readable storage medium is provided, which stores a computer program. The computer program is executed by a processor to implement the steps in the above method embodiments.

[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. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present 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 storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric 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 but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0168] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.

[0169] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A rate control method, characterized in that: The method comprises: Obtaining data to be compressed and a set target compression ratio, and obtaining a 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; Obtaining an initial coding budget for a first data block group and a target coding budget for a first data block of each data block row based on the total coding budget; 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 current data block group is a first data block group of a first data block row; Determining each coding budget consumed by each coding mode of the current data block to be compressed, and determining 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 a 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 various 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: Identifying the data to be compressed to obtain frame-level information, and performing 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 rows, and data block row-level rate control is performed based on the row information of the data block rows, 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 and a target coding budget for the first data block of each of the data block rows.

3. The method according to claim 2, characterized in that The frame-level rate control is performed based on the frame-level information and the total coding budget to obtain the 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 performing data block row-level rate control based on the row information of the data block rows, 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 and a target coding budget for the first data block of each of the data block rows includes: Obtaining a basic coding budget for each data block and a remaining coding budget for the data block row based on the basic coding budget for each data block row, the size of the row information, and the second quantity; Obtaining a basic coding budget for each data block group based on the basic coding budget for each data block and the first quantity; 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; 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 of 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 the update 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, based on the current coding budget and the current quantity, a target coding budget for the next data block 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 coding budget based on the current coding budget, the current number, and the average coding budget; A target coding budget for a next data block is obtained based on the average coding budget and the remainder coding 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 rate control device, characterized in that: The device comprises: a total coding budget determination module, configured 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, configured to divide the data to be compressed into a plurality of data blocks, and group 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 and a target coding budget for a first data block of each data block row based on the total coding budget; A data block coding budget determination module is configured 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 current data block group is a first data block group of a first data block row; a target coding size determining module, configured to 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 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 a current number of remaining data blocks to be compressed in the current data block group; A loop module is configured 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 perform 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