Processor, chip, device and code rate estimation method
By independently calculating the bitrate of each residual block, the problem of bitrate estimation delay in video coding is solved, improving efficiency and saving storage resources.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-15
- Publication Date
- 2026-03-24
AI Technical Summary
In existing technologies, the calculation of bitrate estimation results for coding units during video coding has a large delay, requiring waiting for all residual blocks to be acquired before calculation can be performed, resulting in low computational efficiency.
After obtaining the current residual block, its corresponding bitrate is calculated independently without considering its dependency on other residual blocks. The first bitrate and the second bitrate of each residual block are calculated by the bitrate calculation unit and the accumulation unit respectively, and then accumulated to obtain the final bitrate estimation result.
This improves the computation efficiency of code rate estimation results of the coding unit, reduces memory storage requirements, and avoids the latency and inefficiency problems caused by serial computation.
Smart Images

Figure CN120956905B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of chip technology, and in particular to a processor, chip, device, and bit rate estimation method. Background Technology
[0002] In the video encoding process, bitrate estimation is used to optimize the video encoding method.
[0003] In related technologies, bitrate estimation of a coding unit may include the following steps: performing bitrate estimation calculations on each residual block in the coding unit to obtain a bitrate estimation result for each residual block; and then obtaining a bitrate estimation result for the coding unit based on the bitrate estimation results of each residual block. Wherein, at least one residual block in the coding unit has a computational dependency relationship. For example, this dependency relationship could be: a residual block located in the upper left part of the coding unit depends on a residual block located in the lower right part of the coding unit. In other words, when performing bitrate estimation calculations on the residual block located in the upper left part, it is necessary to wait for the bitrate estimation result of the residual block located in the lower right part to be calculated before starting to calculate its own bitrate estimation result.
[0004] In the above method, the calculation delay of the code rate estimation result of the coding unit is relatively large. It is necessary to obtain all the residual blocks of the coding unit before the calculation of the code rate estimation result of each residual block can begin, which will cause the problem of low calculation efficiency of the code rate estimation result of the coding unit. Summary of the Invention
[0005] This application provides a processor, chip, device, and bitrate estimation method. The technical solution provided by this application is as follows.
[0006] According to one aspect of the embodiments of this application, a processor is provided, the processor comprising: a bit rate calculation unit and an accumulation unit;
[0007] The bitrate calculation unit is used to calculate the first bitrate corresponding to the i-th residual block based on the i-th residual block itself after obtaining the i-th residual block among the N residual blocks; wherein, the N residual blocks are determined based on the prediction residual of the image frame to be encoded, N is an integer greater than 1, and i takes the value from 1 to N;
[0008] The bitrate calculation unit is further configured to calculate the second bitrate corresponding to the N residual blocks based on the N residual blocks after obtaining the N residual blocks;
[0009] The accumulation unit is used to calculate the second code rate and the sum of the first code rates corresponding to the N residual blocks respectively, to obtain a code rate estimation result. The code rate estimation result is used to indicate the code rate of the N residual blocks after transmission encoding.
[0010] According to one aspect of the embodiments of this application, a code rate estimation method applied to a processor is provided, the processor comprising: a code rate calculation unit and an accumulation unit; the method comprising:
[0011] After obtaining the i-th residual block among N residual blocks, the rate calculation unit calculates the first rate corresponding to the i-th residual block based on the i-th residual block itself; wherein, the N residual blocks are determined based on the prediction residual of the image frame to be encoded, N is an integer greater than 1, and i takes the value from 1 to N;
[0012] After acquiring the N residual blocks, the rate calculation unit calculates the second rate corresponding to the N residual blocks based on the N residual blocks;
[0013] The accumulation unit calculates the second code rate and the sum of the first code rates corresponding to the N residual blocks respectively, to obtain a code rate estimation result. The code rate estimation result is used to indicate the code rate of the N residual blocks after transmission encoding.
[0014] According to one aspect of the embodiments of this application, a chip product is provided, the chip product including the processor described above.
[0015] According to one aspect of the embodiments of this application, a computer device is provided, the computer device including the processor described above.
[0016] The technical solution provided in this application can bring the following beneficial effects:
[0017] When calculating the first bitrate for each of the N residual blocks, the dependencies between the N residual blocks are not considered. After obtaining the current i-th residual block, the corresponding first bitrate is calculated based solely on the i-th residual block itself. This approach avoids the computational latency and inefficiency issues caused by waiting for all dependent residual blocks to be obtained before calculating the bitrate of the current residual block in related technologies, thus improving the computational efficiency of the bitrate estimation results of the coding unit. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the calculation process of the bit rate estimation result in a related technology of one possible implementation of this application;
[0019] Figure 2 This is a schematic diagram of a processor in one possible implementation of this application;
[0020] Figure 3 This is a schematic diagram of a processor in another possible implementation of this application;
[0021] Figure 4This is a schematic diagram of a processor in another possible implementation of this application;
[0022] Figure 5 This is a flowchart of a rate estimation method applied to a processor in one possible implementation of this application. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0024] Before introducing and explaining the technical solution of this application, some concepts involved in this application will be defined and explained.
[0025] 1. CABAC (Context-based Adaptive Binary Arithmetic Coding)
[0026] In existing video codec chips, to improve encoder encoding quality and obtain more accurate bitrate estimation results during rate-distortion optimization, the CABAC bitrate estimation method is adopted. CABAC is a context-based adaptive binary context coding method. Using CABAC for bitrate encoding in the entropy coding scheme of HEVC (High Efficiency Video Coding) encoders can achieve higher compression efficiency.
[0027] CABAC requires a computational process involving binarization, context modeling, and binary arithmetic encoding. Binarization converts non-binary syntax elements into binary strings. After binarization, each bin (binary bit) selects a probability model based on the context of the current data. This model provides a probability estimate of whether the current bin is 0 or 1. Finally, arithmetic encoding is performed on the binary symbols based on the probabilities provided in the context model.
[0028] The CABAC rate estimation method has high computational complexity, slow encoding speed, difficult hardware implementation, and higher power consumption. However, it provides relatively accurate rate estimation, which can improve the accuracy of mode decision-making in rate-distortion optimization, thereby improving the encoding quality of the encoder.
[0029] 2. Bitrate estimation
[0030] In existing schemes, bitrate estimation is performed on each residual block in a coding unit in a reverse scanning (e.g., reverse zigzag scanning) order to obtain the bitrate estimation result for each residual block; then, based on the bitrate estimation results of each residual block, the bitrate estimation result of the coding unit is obtained. During the bitrate estimation calculation process, at least one residual block in a coding unit has a computational dependency. For example, this dependency could be that the residual block located in the upper left part of the coding unit depends on the residual block located in the lower right part. In other words, when performing bitrate estimation calculation on the residual block located in the upper left part, it is necessary to wait for the bitrate estimation result of the residual block located in the lower right part to be completed before starting to calculate its own bitrate estimation result.
[0031] like Figure 1 As shown, this illustrates the calculation process for rate estimation in related technologies. The following explanation uses a 32×32 coding unit, comprising 4×4 residual blocks, as an example to illustrate the rate estimation calculation process. Here, a 32×32 coding unit refers to a coding unit with a size of 32×32 pixels, and a 4×4 residual block refers to a residual block with a size of 4×4 pixels.
[0032] In some embodiments, for any 4×4 residual block in the coding unit, the 4×4 residual block includes 16 coefficients, which can also be called residual coefficients or quantized coefficients. These coefficients are obtained after performing a transform quantization operation on the prediction residual during the video coding process. For this 4×4 residual block, the corresponding bitrate estimation result is determined based on the following 7 sub-bitrates.
[0033] Sub-rate A: The rate at the last non-zero coefficient position in the residual block;
[0034] Sub-rate B: The rate of the code that contains non-zero coefficients among the 16 coefficients;
[0035] Sub-rate C: The rate at which each of the 16 coefficients is zero;
[0036] Sub-rate D: The rate of the first 8 non-zero coefficients out of the 16 coefficients;
[0037] Sub-rate E: The rate of the first of the 16 coefficients that is greater than 1;
[0038] Sub-code rate F: The code rate of the sign bit of the non-zero coefficients among the 16 coefficients;
[0039] Sub-rate G: The rate of the residual value of the 16 coefficients.
[0040] In some embodiments, the code rate estimation result of the 4×4 residual block is the sum of the sub-code rates A to G. The code rate estimation result of the 32×32 coding unit is the sum of the code rate estimation results corresponding to the 64 residual blocks respectively.
[0041] As shown below, the calculation process for bitrate estimation may include the following steps S1~S3:
[0042] Step S1, residual block storage procedure.
[0043] like Figure 1 As shown, the input order of the data is not equal to the scan-dependent computation order of the bitrate estimation. For bitrate estimation computation, all residual blocks need to be stored in the GPU (Graphics Processing Unit) memory first. The input order of the data refers to the order in which the residual blocks are output after the transform quantization process before bitrate estimation. The scan-dependent computation order of bitrate estimation refers to the computation order determined based on the dependencies between the residual blocks during bitrate estimation. During the storage of residual blocks, each 4×4 residual block (i.e., one residual block is output from the transform quantization process) is first stored in memory until all residual blocks of the coding unit are acquired and stored. In some embodiments, taking a residual block bit width of 16 as an example, that is, each pixel requires 16 bits to represent. If the coding unit size is 32×32, 32×32×16 bits of residual block information needs to be stored in memory. If the coding unit size is 16×16, 16×16×16 bits of residual block information needs to be stored in memory. If the coding unit size is 8×8, memory is needed to store 8×8×16 bits of residual block information.
[0044] Step S2, the preparation process for bit rate estimation calculation.
[0045] like Figure 1As shown, for any residual block of the coding unit, the calculation of the sub-code rates B, C, D, and E of the current 4×4 residual block depends on the calculation of the previous 4×4 residual blocks. Therefore, the calculation of sub-code rates B, C, D, and E requires a preparation process for code rate estimation. For example, the calculation of the sub-code rate B of the current residual block first requires calculating the corresponding intermediate value by combining other residual blocks that have a dependency relationship with the current residual block; then, based on the current residual block and the intermediate value, the sub-code rate B of the residual block is calculated. The calculation of sub-code rates C, D, and E is similar. Here, the residual blocks before the current residual block refer to all residual blocks located before the current residual block in the above scanning dependency order. For sub-code rate A, calculation can only begin after all 4×4 residual blocks have been input. The calculation of sub-code rates F and G is only related to the current 4×4 residual block.
[0046] Step S3: The calculation process for bit rate estimation.
[0047] like Figure 1 As shown, after all residual blocks of the coding unit are stored in memory, the GPU's read / write controller reads a 4×4 residual block from memory and calculates the sub-code rates A~G of the residual block. Then, it uses an accumulator to accumulate the sub-code rates A~G to obtain the code rate estimate result for the residual block. This calculation process is performed on all residual blocks of the coding unit to obtain the code rate estimate result for each residual block. Finally, the code rate estimates of 64 residual blocks are accumulated to obtain the code rate estimate result for the coding unit.
[0048] In the above method, the calculation delay of the code rate estimation result of the coding unit is relatively large. It is necessary to acquire and store all residual blocks before the calculation process of sub-code rates A, B, C, D, and E can begin. This results in low computational efficiency of code rate estimation.
[0049] Based on this, this application proposes a fast hardware implementation method for rate estimation suitable for HEVC. When calculating the first rate corresponding to each of the N residual blocks, the dependencies between the N residual blocks are not considered. After obtaining the current i-th residual block, the corresponding first rate is calculated only based on the i-th residual block itself. This approach avoids the computational latency and inefficiency problems caused by waiting for all dependent residual blocks to be obtained before calculating the rate of the current residual block in related technologies, thus improving the computational efficiency of the rate estimation result of the coding unit.
[0050] Furthermore, by removing the dependencies between N residual blocks, there is no need to store N residual blocks in memory, thus saving storage resources for the GPU processor.
[0051] Please refer to Figure 2 The diagram illustrates a processor in one possible implementation of this application. The processor 20 includes a bit rate calculation unit 21 and an accumulation unit 22.
[0052] The bitrate calculation unit 21 is used to calculate the first bitrate corresponding to the i-th residual block based on the i-th residual block itself after obtaining the i-th residual block among the N residual blocks; wherein, the N residual blocks are determined based on the prediction residual of the image frame to be encoded, N is an integer greater than 1, and i takes the value from 1 to N.
[0053] The rate calculation unit 21 is also used to calculate the second rate corresponding to the N residual blocks based on the N residual blocks after obtaining the N residual blocks.
[0054] Accumulation unit 22 is used to calculate the second code rate and the sum of the first code rates corresponding to the N residual blocks respectively, to obtain the code rate estimation result. The code rate estimation result is used to indicate the code rate of the N residual blocks after transmission coding.
[0055] In some embodiments, during video encoding, the image frame to be encoded can be divided into multiple encoding units. For any encoding unit, the prediction residual refers to the difference between the original pixel value and the predicted pixel value within that encoding unit. The prediction residual of the encoding unit can be divided into N data blocks, and transformation and quantization operations are performed on each of these N data blocks to obtain transformed and quantized data blocks, referred to as residual blocks. For example, a 32×32 encoding unit can be divided into 64 data blocks, with each data block being 4×4 in size. After performing transformation and quantization operations on each 4×4 data block, a 4×4 residual block can be obtained. This division method is merely exemplary, and the number of N can be determined based on requirements; this application does not limit this. In some embodiments, one transformed and quantized data block corresponds to one residual block, and different transformed and quantized data blocks correspond to different residual blocks. These N residual blocks can be used for subsequent entropy coding to obtain encoded residual blocks.
[0056] The aforementioned transformation operation refers to the process of converting the prediction residual data in the spatial domain to another domain (usually the frequency domain). This redistributes the energy of the residual data, concentrating most of the energy on a few coefficients, thus facilitating subsequent quantization and encoding operations. Optionally, the transformation operation includes, but is not limited to, discrete cosine transform, integer approximation transform, etc., which this application does not limit. The aforementioned quantization operation refers to the process of mapping the continuous transform coefficients obtained from the transformation operation to a finite number of discrete values. Quantization reduces the number of bits required to represent the transform coefficients, thereby reducing the code rate. The quantization process is usually implemented using a quantization step size. For the transformed coefficients, they are divided by the quantization step size and rounded to obtain the quantized coefficients. Therefore, at least one coefficient included in the residual block can also be referred to as a quantized coefficient, which this application does not limit.
[0057] Unlike the concept of bitrate in data transmission, in this embodiment, bitrate refers to the amount of data predicted to be required in the future bitstream after encoding a data unit (such as a residual block). This data amount can be indicated by bits, bytes, kilobytes, etc., and this application does not limit this. When the data amount is indicated by bits, the unit of bitrate is bits; when the data amount is indicated by bytes, the unit of bitrate is bytes; when the data amount is indicated by kilobytes, the unit of bitrate is kilobytes, and this application does not limit this. One byte can include 8 bits, and one kilobyte can include 1024 bytes. For example, in video encoding, assuming that encoding a residual block requires 100 bits of data, then "100" is the bitrate for encoding that residual block, and its unit is bits.
[0058] A bitrate calculation unit refers to a unit in a processor that calculates the bitrate based on residual blocks using a corresponding bitrate calculation algorithm. In this application, the bitrate calculation unit can be a hardware unit or a software unit, and this application does not limit this. Furthermore, for other units involved in this application (including accumulators, etc.), this document only explains and describes them from a hardware perspective. It should be noted that these other units can also be software units, and this application does not limit this.
[0059] In some embodiments, the accuracy of the bitrate estimation result is given the highest priority in related technologies. To achieve the most accurate calculation, the dependencies between the N residual blocks must be strictly followed, meaning the bitrate estimation calculation process must be executed serially. This design philosophy is feasible in scenarios with sufficient hardware computing power and low real-time requirements.
[0060] However, this application fully considers that in many modern application scenarios (such as real-time video communication and high-resolution video coding), the latency and inefficiency caused by such serial computation have become a critical bottleneck that cannot be ignored. Therefore, the core technical problem solved by this application shifts from how to calculate the bitrate estimation result more accurately to how to calculate the bitrate estimation result faster and more efficiently while ensuring acceptable accuracy. Specifically, when calculating the first bitrate corresponding to each of the N residual blocks, the dependencies between the N residual blocks are not considered. This independent calculation method allows the bitrate calculation unit to calculate the bitrate estimation result of the N residual blocks more efficiently. In this case, the calculation of the first bitrate of the i-th residual block only needs to be based on the current i-th residual block. In other words, the bitrate calculation unit does not need to wait for other residual blocks, but after obtaining the current i-th residual block, it calculates the corresponding first bitrate based only on the i-th residual block itself. The other residual blocks can refer to residual blocks that have a dependency relationship with the i-th residual block. This approach avoids the computational delay and inefficiency issues caused by waiting for all dependent residual blocks to be acquired before calculating the bitrate of the current residual block, thus improving the computational efficiency of the bitrate estimation results of the coding unit.
[0061] In some embodiments, the N residual blocks are acquired sequentially. In other words, during the quantization stage described above, the quantization stage outputs one residual block, and the rate calculation unit 21 receives one residual block as input. The rate calculation unit 21 is used to calculate the first rate corresponding to each of the N residual blocks, wherein the first rate corresponding to each of the N residual blocks can be calculated serially. The specific process is as follows: The rate calculation unit 21 first initializes an index value i to 1, representing that the rate calculation starts from the first residual block. After acquiring the first residual block, the first rate corresponding to the first residual block is calculated based on the first residual block; then, the index value i is incremented by 1, becoming 2, and the unit waits to acquire the second residual block. After obtaining the second residual block, the first code rate corresponding to the second residual block is calculated based on the second residual block; and so on, the code rate calculation unit 21 obtains N residual blocks one by one in the order of increasing index value i, performs independent code rate calculation on each residual block, until the first code rate calculation of the Nth residual block is completed, thereby calculating the first code rate corresponding to each of the N residual blocks.
[0062] In some embodiments, this application also supports parallel computing. For example, if some or all of the N residual blocks are acquired simultaneously, the rate calculation unit 21 is used to calculate the first rate corresponding to each of the N residual blocks. The first rate corresponding to at least one of the N residual blocks can be calculated in parallel. In this case, the rate calculation unit includes at least one rate sub-calculation unit. This at least one rate sub-calculation unit is used to calculate the first rate corresponding to the at least one residual block in parallel. One rate sub-calculation unit is used to calculate the first rate corresponding to one residual block, and different rate sub-calculation units are used to calculate the first rate corresponding to different residual blocks; this application does not limit this. In some embodiments, for any one of the N residual blocks, the residual block includes at least one coefficient. For each residual block, the first code rate includes at least one of the following: the code rate of whether at least one coefficient contains a non-zero coefficient, the code rate of whether each coefficient in at least one coefficient is 0, the code rate of the residual value of at least one coefficient, the code rate of the first k non-zero coefficients in at least one coefficient, the code rate of the first coefficient greater than 1 in at least one coefficient, and the code rate of the sign bit of the non-zero coefficient in at least one coefficient, where k is a positive integer.
[0063] The aforementioned at least one coefficient is also the quantized coefficient described above. In some embodiments, the number of at least one coefficient is determined based on the size of the residual block. For example, a 4×4 residual block includes 16 coefficients. An 8×8 residual block includes 64 coefficients.
[0064] The following uses bits as the unit of code rate to illustrate various specific code rates. In some embodiments, the code rate for determining whether at least one coefficient contains a non-zero coefficient (corresponding to the sub-code rate B mentioned above) refers to the number of bits required to encode the information that at least one coefficient contains a non-zero coefficient. Determining whether a set of coefficients contains zero coefficients is crucial information during the encoding process. If there are non-zero coefficients, further detailed encoding of these non-zero coefficients may be required; if there are no non-zero coefficients, a simpler encoding method can be used. For example, one bit can be used to represent "having a non-zero coefficient" (e.g., using bit 1 to represent the presence of a non-zero coefficient) or "not having a non-zero coefficient" (using bit 0 to represent the absence of a non-zero coefficient). If this one bit is used to encode the information that at least one coefficient contains a non-zero coefficient, then the sub-code rate B is determined to be one bit.
[0065] The code rate for determining whether each coefficient in at least one set of coefficients is 0 (corresponding to the sub-code rate C mentioned above) refers to the number of bits required to encode whether each coefficient in the at least one set of coefficients is 0. In a set of coefficients, to accurately represent the state of each coefficient, it is necessary to encode whether each coefficient is 0 individually. For example, for a residual block containing 16 coefficients, 16 bits can be used to represent whether each coefficient is 0 (e.g., bit 0 can represent a coefficient being 0, and bit 1 can represent a non-zero coefficient), in which case the sub-code rate C can be determined to be 16 bits.
[0066] The code rate (corresponding to the sub-code rate D) of at least one set of coefficients for the first k non-zero coefficients refers to the number of bits required to encode the first k non-zero coefficients arranged in order from a set of coefficients. In actual encoding, non-zero coefficients often carry more important information, but encoding all of them may consume a lot of resources. Therefore, only the first k non-zero coefficients can be selected for encoding, and the sub-code rate D can be calculated based on the number of bits required to encode the first k non-zero coefficients. For example, when the residual block includes 16 coefficients, k can be 8, and this application does not limit this.
[0067] The first code rate greater than 1 in at least one coefficient (corresponding to the sub-code rate E mentioned above) refers to the number of bits required to encode the relevant information (such as the position and value of the coefficient) of the first coefficient greater than 1 in a set of coefficients, in order to calculate the sub-code rate E.
[0068] The code rate (corresponding to the sub-code rate F) for the sign bit of at least one non-zero coefficient refers to the number of bits required to represent the sign (positive or negative) of a non-zero coefficient when encoding a set of non-zero coefficients. The sign bit of a non-zero coefficient can occupy only 1 bit. When there are multiple non-zero coefficients, the total number of bits required to encode these sign bits represents the sub-code rate F.
[0069] The code rate of the residual values of at least one coefficient (corresponding to the sub-code rate G mentioned above) refers to the number of bits required to encode the residual values obtained after predicting or encoding a set of coefficients. During encoding, to reduce the amount of data, coefficients are usually predicted; the difference between the predicted and actual values is the residual. The residual values may be the portion remaining to be encoded after further processing of the residuals (such as quantization). The encoding of these residual values directly affects the overall encoding efficiency, and the code rate reflects the bandwidth occupied by encoding this remaining information.
[0070] In some embodiments, the code rate calculation unit 21 is further configured to calculate a second code rate corresponding to the N residual blocks after acquiring the N residual blocks. In some embodiments, the second code rate includes the code rate at the last non-zero coefficient position in the N residual blocks. The code rate at the last non-zero coefficient position in the N residual blocks refers to the number of bits required to represent the information at the position of the last non-zero coefficient among all coefficients in the N residual blocks when encoding them.
[0071] The above method can accurately determine the code rate estimation result of the coding unit based on the first code rate and the second code rate.
[0072] An accumulation unit is a hardware unit in a processor used to perform addition operations on multiple bit rates. The accumulation unit accumulates the second bit rate with the first bit rate corresponding to each of the N residual blocks. Specifically, it performs an accumulation operation on the N first bit rates (the first bit rate of the 1st residual block, the first bit rate of the 2nd residual block, ..., the first bit rate of the Nth residual block) and the second bit rate to obtain the bit rate estimation result of the coding unit. This bit rate estimation result includes the total bit rate consumption when transmitting the encoded N residual blocks, which is the sum of the bit rate of the encoded information of each residual block itself and the bit rate of specific key information related to the overall set of N residual blocks. For example, suppose there are 3 (i.e., N = 3) residual blocks, the first bit rate of the first residual block is 200 bits, the first bit rate of the second residual block is 300 bits, the first bit rate of the third residual block is 250 bits, and the second bit rate is 100 bits. The accumulator unit adds up these bit rates: 200 + 300 + 250 + 100 = 850 bits. The resulting 850 bits is the bit rate estimate of the coding unit, which indicates that transmitting these three encoded residual blocks requires a bit rate of 850 bits.
[0073] In summary, the technical solution provided in this application does not consider the dependencies between the N residual blocks when calculating the first bitrate corresponding to each of the N residual blocks. After obtaining the current i-th residual block, the corresponding first bitrate is calculated only based on the i-th residual block itself. This approach avoids the computational delay and inefficiency caused by waiting for all dependent residual blocks to be obtained before calculating the bitrate of the current residual block in related technologies, thus improving the computational efficiency of the bitrate estimation result of the coding unit.
[0074] Furthermore, by removing the dependencies between the N residual blocks, there is no need to store the N residual blocks in memory, thus saving processor storage resources.
[0075] The following describes the specific calculation method for the bitrate estimation result.
[0076] In some embodiments, such as Figure 3 As shown, the processor 20 includes a bit rate calculation unit 21 and an accumulation unit 22. The accumulation unit 22 includes a first accumulator 221 and a second accumulator 222.
[0077] The first accumulator 221 is used to calculate the sum of the first code rates corresponding to the N residual blocks respectively, and obtain the first calculation result.
[0078] The second accumulator 222 is used to calculate the sum of the second bit rate and the first calculation result to obtain the bit rate estimation result.
[0079] The first accumulator 221 is used to accumulate the first bitrates corresponding to the N residual blocks. It can be imagined as an adder that sequentially adds the first bitrates of the N residual blocks. For example, assuming there are three residual blocks with first bitrates of 10 bits, 20 bits, and 30 bits respectively, the first accumulator 221 will add these three values, i.e., 10 + 20 + 30 = 60 bits. The resulting 60 bits is the first calculation result.
[0080] The second accumulator 222 adds the second bitrate to the first calculation result obtained by the first accumulator 221. Assuming the second bitrate is 15 bits, combined with the first calculation result of 60 bits, the second accumulator 222 will calculate 60 + 15 = 75 bits, which is the final bitrate estimate.
[0081] In some embodiments, the first accumulator, used to calculate the sum of the first bitrates corresponding to the N residual blocks respectively, to obtain a first calculation result, may include the following steps: (1) a bitrate calculation unit, used to calculate the first bitrate corresponding to the first residual block based on the first residual block; the first accumulator is used to obtain the first bitrate corresponding to the first residual block. (2) a bitrate calculation unit, used to calculate the first bitrate corresponding to the second residual block based on the second residual block; the first accumulator is used to obtain the first bitrate corresponding to the second residual block, and calculate the sum of the first bitrate corresponding to the first residual block and the first bitrate corresponding to the second residual block to obtain intermediate result 1. (3) a bitrate calculation unit, used to calculate the first bitrate corresponding to the third residual block based on the third residual block; the first accumulator is used to obtain the first bitrate corresponding to the third residual block, and calculate the sum of intermediate result 1 and the first bitrate corresponding to the third residual block to obtain intermediate result 2. (4) And so on, the rate calculation unit continues to calculate the corresponding first rate based on the 4th, 5th... up to the Nth residual block. Each time the first rate corresponding to a new residual block is calculated, the first accumulator obtains the first rate corresponding to that residual block and adds it to the intermediate result obtained in the previous round to obtain a new intermediate result. When the Nth residual block is processed, the first accumulator adds the first rate corresponding to the Nth residual block to the previous intermediate result to obtain the first calculation result, which is the sum of the first rates corresponding to the N residual blocks.
[0082] The above method, by dividing the accumulation unit 22 into two parts, the first accumulator 221 and the second accumulator 222, uses a modular design approach to help decompose complex accumulation tasks into relatively simple steps, reduce the design complexity of each accumulator, and improve the maintainability and scalability of the system.
[0083] In some embodiments, the first code rate includes M sub-code rates, and the first accumulator includes M sub-accumulators, where M is an integer greater than 1.
[0084] The rate calculation unit is used to calculate the M sub-rates corresponding to the i-th residual block based on the i-th residual block itself.
[0085] The j-th sub-accumulator among the M sub-accumulators is used to calculate the sum of the j-th sub-code rates corresponding to the N residual blocks, and to obtain the calculation result corresponding to the j-th sub-code rate, where j is a positive integer less than or equal to M.
[0086] The second accumulator is used to calculate the second bitrate and the sum of the calculation results corresponding to the M sub-bitrates to obtain the bitrate estimation result.
[0087] Each sub-accumulator refers to a hardware unit within the first accumulator used to perform accumulation operations on a specific type of sub-coderate. Since the first coderate is subdivided into M sub-coderates, each sub-coderate corresponds to a sub-coderate type. To perform accumulation calculations on each of the M types of sub-coderates, M sub-accumulators are needed. Each sub-accumulator is responsible for performing accumulation operations on the same type of sub-coderates across N residual blocks. For example, for sub-coderate B among the M sub-coderates, the first sub-accumulator is used to accumulate the sub-coderate B corresponding to each of the N residual blocks to obtain the calculation result corresponding to sub-coderate B. Assuming that the sub-coderate B corresponding to the N residual blocks is 120 bits, 130 bits, 110 bits, and 140 bits respectively, then the first sub-accumulator is used to calculate 120 + 130 + 110 + 140 = 500 bits. This 500 bits is the calculation result corresponding to sub-coderate B.
[0088] In some embodiments, the j-th sub-accumulator, used to calculate the sum of the j-th sub-code rates corresponding to the N residual blocks, may include the following steps: (1) a code rate calculation unit, used to calculate the M sub-code rates corresponding to the first residual block based on the first residual block; the j-th sub-accumulator is used to obtain the j-th sub-code rate corresponding to the first residual block. (2) a code rate calculation unit, used to calculate the M sub-code rates corresponding to the second residual block based on the second residual block; the j-th sub-accumulator is used to obtain the j-th sub-code rate corresponding to the second residual block, and calculate the sum of the j-th sub-code rate corresponding to the first residual block and the j-th sub-code rate corresponding to the second residual block to obtain intermediate result 1. (3) The rate calculation unit calculates the M sub-rates corresponding to the 3rd residual block based on the 3rd residual block; the j-th sub-accumulator is used to obtain the j-th sub-rate corresponding to the 3rd residual block and calculate the sum of intermediate result 1 and the j-th sub-rate corresponding to the 3rd residual block to obtain intermediate result 2. (4) In this way, the rate calculation unit continues to calculate the corresponding M sub-rates based on the 4th, 5th... up to the Nth residual block. Each time the M sub-rates corresponding to a new residual block are calculated, the j-th sub-accumulator obtains the j-th sub-rate corresponding to the residual block and adds it to the intermediate result obtained in the previous round to obtain a new intermediate result. When the Nth residual block is processed, the j-th sub-accumulator adds the j-th sub-rate corresponding to the Nth residual block to the previous intermediate result to obtain the calculation result corresponding to the j-th sub-rate, which is the sum of the j-th sub-rates corresponding to the N residual blocks respectively. The above steps are performed on each of the M sub-accumulators to obtain the calculation results corresponding to the M sub-code rates. It can be understood that the calculation results for the M sub-code rates are computed in parallel. In other words, each of the M sub-accumulators simultaneously calculates its corresponding sub-code rate.
[0089] For example, such as Figure 4 As shown, M=6, meaning the first code rate includes 6 sub-code rates, and the first accumulator 221 includes 6 sub-accumulators. The M sub-code rates can include: the code rate indicating whether at least one coefficient contains a non-zero coefficient (corresponding to sub-code rate B above); the code rate indicating whether each coefficient in at least one coefficient is 0 (corresponding to sub-code rate C above); the code rate indicating the first k non-zero coefficients in at least one coefficient (corresponding to sub-code rate D above); the code rate indicating the first coefficient greater than 1 in at least one coefficient (corresponding to sub-code rate E above); the code rate indicating the sign bit of a non-zero coefficient in at least one coefficient (corresponding to sub-code rate F above); and the code rate indicating the residual value of at least one coefficient (corresponding to sub-code rate G above). The 6 sub-accumulators can include the 1st accumulator, the 2nd sub-accumulator, the 3rd sub-accumulator, the 4th sub-accumulator, the 5th sub-accumulator, and the 6th sub-accumulator. The rate calculation unit 21 is used to calculate the six sub-rates (sub-rates B to G) corresponding to the first to Nth residual blocks, respectively. Figure 4 As shown, the first sub-accumulator is used to calculate the sum of the first sub-coderate (i.e., sub-coderate B) corresponding to each of the N residual blocks, obtaining the calculation result corresponding to the first sub-coderate (i.e., the calculation result corresponding to sub-coderate B). Similarly, the second to sixth sub-accumulators can obtain the calculation results corresponding to the other five sub-coderates (the calculation results corresponding to sub-coderate C, sub-coderate D, sub-coderate E, sub-coderate F, and sub-coderate G), thus obtaining the calculation results corresponding to the six sub-coderates. The second accumulator 222 calculates the second coderate and the sum of the calculation results corresponding to the six sub-coderates to obtain the coderate estimation result.
[0090] The above method allows for parallel computation of the results corresponding to each sub-coderate, as the calculation of each sub-coderate is performed independently using different sub-accumulators. This improves the computational efficiency of the coderate estimation results.
[0091] In some embodiments, the M sub-rates corresponding to the i-th residual block are computed in parallel.
[0092] Parallel computing refers to performing multiple computational tasks simultaneously within the same timeframe or time period, rather than executing them sequentially. In this embodiment, for the i-th residual block, its M sub-bitrates are calculated simultaneously, instead of being calculated serially one by one. For example, the M sub-bitrates may include sub-bitrates B, C, D, E, F, and G. The bitrate calculation unit is then used to calculate sub-bitrates B, C, D, E, F, and G in parallel within the same time unit.
[0093] In some embodiments, the rate calculation unit may include M sub-rate calculation units. One sub-rate calculation unit is used to calculate one sub-rate, and different sub-rate calculation units are used to calculate different sub-rates. For example, for any residual block, the M sub-rates may include sub-rate B, sub-rate C, sub-rate D, sub-rate E, sub-rate F, and sub-rate G. The M sub-rate calculation units may include sub-rate calculation unit 1, sub-rate calculation unit 2, sub-rate calculation unit 3, sub-rate calculation unit 4, sub-rate calculation unit 5, and sub-rate calculation unit 6. Sub-rate calculation unit 1 is used to calculate the sub-rate B corresponding to the residual block based on the residual block; sub-rate calculation unit 2 is used to calculate the sub-rate C corresponding to the residual block based on the residual block; and sub-rate calculation unit 6 is used to calculate the sub-rate G corresponding to the residual block based on the residual block. The calculation processes of the above-mentioned sub-rate calculation units are performed simultaneously, thereby enabling parallel calculation of multiple sub-rates.
[0094] The above method improves the computation efficiency of the first code rate corresponding to any residual block by parallelly calculating its corresponding M sub-code rates, thereby improving the computation efficiency of the code rate estimation result of the coding unit.
[0095] In some embodiments, this application does not consider the dependencies between residual blocks when calculating the first bitrate corresponding to the residual block, thus the obtained first bitrate contains errors. The following describes an optimization method for calculating the first bitrate.
[0096] In some embodiments, the bitrate calculation unit is used to calculate the first bitrate corresponding to the i-th residual block based on the i-th residual block and a preset value.
[0097] In some embodiments, for the calculation of the first bitrate, in addition to considering the dependencies of the N residual blocks, the mutual influence between the N residual blocks can be further introduced to calculate the first bitrate of the current i-th residual block more accurately. In related technologies, this influence is reflected by calculating a complex "intermediate value". In some embodiments, it takes a lot of time to calculate this "intermediate value" in real time based on the dependencies between all residual blocks. Specifically, the intermediate value is used to characterize the spatial correlation between other residual blocks and the current residual block. Wherein, spatial correlation is used to indicate the similarity between spatially adjacent pixels or data blocks in the image. Other residual blocks refer to the residual blocks among the N residual blocks that have a dependency relationship with the current residual block. In some embodiments, the calculation of the intermediate value may include the following steps: (1) Identify context blocks. Determine one or more neighboring blocks that have the strongest correlation with the encoding of the current residual block as context blocks of the current residual block. For example, residual blocks directly above, to the left, to the right, etc. of the current residual block. (2) Extract at least one feature information. Extract at least one feature from the identified context blocks. The at least one feature may include the number of non-zero coefficients after quantization in these context blocks, the prediction mode used, etc., which are not limited in this application. (3) Calculate the intermediate value. Calculate a single comprehensive value by using a preset weighted summation model or other mathematical formula for the extracted at least one feature. This comprehensive value is the "intermediate value". In order to improve the calculation speed, this application proposes not to consider the dependency relationship between the N residual blocks, but to use a "preset value" instead of the "intermediate value". This "preset value" is the average or typical value that best represents the "dependency effect" based on a large amount of sample data. Therefore, it is only necessary to calculate the first bit rate based on the i-th residual block and the preset value. This method considers the dependency relationship between the N residual blocks (through the preset value) and avoids complex real-time calculations, which greatly improves the calculation efficiency. In one example, the preset value can replace the intermediate value in the related technology and perform operations such as weighted summation with the bit rate calculated based on the i-th residual block itself to obtain the first bit rate of the i-th residual block.
[0098] The aforementioned preset value refers to a pre-set value used to correct the first bit rate. The preset value can be set based on the experience of relevant personnel, and this application does not limit it in this regard.
[0099] The method described above, by setting preset values, can correct the first bitrate, ensuring the accuracy of the first bitrate calculation. This, in turn, ensures the accuracy of subsequent bitrate estimation results.
[0100] In some embodiments, the first code rate includes M sub-code rates, where M is an integer greater than 1; the code rate calculation unit is configured to calculate the first sub-code rate corresponding to the i-th residual block based on the i-th residual block and a preset value when the first sub-code rate is related to the dependency relationship between the first sub-code rate and the N residual blocks; or, the code rate calculation unit is configured to calculate the first sub-code rate corresponding to the i-th residual block based solely on the i-th residual block itself when the first sub-code rate is not related to the dependency relationship between the first sub-code rate and the N residual blocks; wherein, the first sub-code rate refers to any sub-code rate among the M sub-code rates.
[0101] In some embodiments, when the first sub-bitrate is related to the dependencies of N residual blocks, it means that to accurately calculate the first sub-bitrate of the current i-th residual block, the accuracy of the bitrate calculation can be improved by considering the mutual influence between the N residual blocks. Therefore, the first sub-bitrate is calculated based on the i-th residual block and a preset value. This approach considers both the dependencies between the N residual blocks (through the preset value) and avoids complex real-time calculations, greatly improving computational efficiency.
[0102] In some embodiments, when the first sub-coderate is independent of the dependencies of the N residual blocks, it means that the calculation of the first sub-coderate is independent, and only its own residual block needs to be considered. Therefore, the first sub-coderate only needs to be calculated based on the i-th residual block.
[0103] The above method can determine whether the first sub-code rate still needs to be calculated based on a preset value by considering the correlation between the first sub-code rate and the dependencies between the N residual blocks, thus ensuring the accuracy of the first sub-code rate calculation.
[0104] Of course, as mentioned above, in some embodiments, when the first sub-code rate is related to the dependency of N residual blocks, the first sub-code rate can also be calculated based only on the i-th residual block as needed, thereby achieving a balance between efficiency and accuracy.
[0105] In some embodiments, the dependencies between X sub-bitrates out of M sub-bitrates are related to the N residual blocks. The preset values include X sub-preset values, where one sub-bitrate corresponds to one sub-preset value, and X is a positive integer less than or equal to M.
[0106] In some embodiments, the rate calculation unit is configured to calculate the first sub-rate corresponding to the i-th residual block based on the i-th residual block and the sub-preset value corresponding to the first sub-rate, when the first sub-rate is related to the dependency relationship between the first sub-rate and N residual blocks.
[0107] In some embodiments, X equals M if all M sub-coderates are related to the dependencies between N residual blocks. Alternatively, X may be less than M if only some of the M sub-coderates are related to the dependencies between N residual blocks.
[0108] For example, the M sub-bitrates may include sub-bitrate B, sub-bitrate C, sub-bitrate D, sub-bitrate E, sub-bitrate F, and sub-bitrate G. The X sub-bitrates may include sub-bitrate B, sub-bitrate C, sub-bitrate D, and sub-bitrate E.
[0109] In some embodiments, one of the X sub-bitrates corresponds to one sub-preset value. The sub-preset values corresponding to different sub-bitrates may be the same or different; this application does not limit this. For example, sub-bitrate B may correspond to sub-preset value 1, sub-bitrate C may correspond to sub-preset value 2, sub-bitrate D may correspond to sub-preset value 3, and sub-bitrate E may correspond to sub-preset value 4. Sub-preset values 1, 2, 3, and 4 may all be the same or different; this application does not limit this.
[0110] For example, the rate calculation unit is used to calculate the sub-rate B corresponding to the i-th residual block based on the i-th residual block and sub-preset value 1; calculate the sub-rate C corresponding to the i-th residual block based on the i-th residual block and sub-preset value 2; calculate the sub-rate D corresponding to the i-th residual block based on the i-th residual block and sub-preset value 3; and calculate the sub-rate E corresponding to the i-th residual block based on the i-th residual block and sub-preset value 4. Similar operations are performed for each residual block to obtain the sub-rate B, sub-rate C, sub-rate D, and sub-rate E corresponding to M residual blocks.
[0111] For example, the rate calculation unit is used to calculate the sub-rate F corresponding to the i-th residual block based on the i-th residual block itself; and to calculate the sub-rate G corresponding to the i-th residual block based on the i-th residual block itself. A similar operation is performed for each residual block to obtain the sub-rate F and sub-rate G corresponding to M residual blocks.
[0112] The above method, for calculating the sub-bitrate related to the dependency relationship between N residual blocks, sets a one-to-one correspondence between the sub-bitrate and the sub-preset value, realizing targeted adjustment of the calculation of different sub-bitrates. This makes the calculation of the first sub-bitrate more accurate, thereby ensuring the accuracy of the bitrate estimation result.
[0113] In some embodiments, the sub-preset value corresponding to the first sub-bitrate is determined based on the statistical characteristics of at least two intermediate values corresponding to the first sub-bitrate; wherein, the statistical characteristics include at least one of the following: mean, median, mode, weighted mean, and the at least two intermediate values are determined based on the dependency relationship between multiple residual blocks during the calculation of the bitrate estimation results corresponding to multiple residual blocks of the sample image frame.
[0114] As discussed above, in related technologies, the calculation of the first sub-code rate (e.g., sub-code rate B) first requires combining other residual blocks that depend on the current residual block to calculate a corresponding intermediate value (this process of calculating the intermediate value can be called the sub-code rate B calculation preparation process). Then, based on this intermediate value and the residual block, the sub-code rate B of the residual block is calculated. In other words, in related technologies, when calculating a sub-code rate (e.g., "sub-code rate B"), a "computation preparation process" needs to be executed first. This process combines the current residual block and other residual blocks that depend on it to jointly calculate a temporary "intermediate value." This intermediate value reflects the mutual influence between blocks.
[0115] Based on this, sample data can be collected, that is, a large number of representative image frames or video frames (i.e., sample image frames) can be selected for encoding analysis. When processing multiple residual blocks in the sample image frames, for the calculation of the "first sub-bitrate (e.g., sub-bitrate B)," each "intermediate value" generated in its "calculation preparation process" is recorded. In this way, at least two intermediate values corresponding to the first sub-bitrate are collected. Then, statistical analysis is performed on these at least two intermediate values to calculate their statistical characteristics, thereby determining the sub-preset value corresponding to the first sub-bitrate. For example, the average, median, mode, weighted average, etc., of these multiple intermediate values can be used as the sub-preset value corresponding to the first sub-bitrate. This application does not limit this. A similar operation can be performed to determine the sub-preset values of other sub-bitrates of X sub-bitrates, thereby obtaining accurate X sub-preset values. The above method of determining the sub-preset values is only exemplary, and the sub-preset value corresponding to each sub-bitrate can be set based on the experience of those skilled in the art, which is not limited in this application.
[0116] The above method, by utilizing the characteristics of statistical intermediate values, can set appropriate sub-preset values for each sub-bitrate, thereby improving the accuracy of the subsequently calculated bitrate estimation results.
[0117] The following is an example of a rate estimation method applied to a processor. For details, please refer to the relevant content on the processor side above. This application will not repeat it here.
[0118] Please refer to Figure 5 The diagram illustrates a flowchart of a rate estimation method applied to a processor in one possible implementation of this application. The processor includes a rate calculation unit and an accumulation unit; the method may include steps 510-530.
[0119] Step 510: After obtaining the i-th residual block among the N residual blocks, the rate calculation unit calculates the first rate corresponding to the i-th residual block based on the i-th residual block itself; wherein, the N residual blocks are determined based on the prediction residual of the image frame to be encoded, N is an integer greater than 1, and i takes the value from 1 to N.
[0120] Step 520: After obtaining N residual blocks, the rate calculation unit calculates the second rate corresponding to the N residual blocks based on the N residual blocks.
[0121] Step 530: The accumulation unit calculates the second code rate and the sum of the first code rates corresponding to the N residual blocks respectively, and obtains the code rate estimation result. The code rate estimation result is used to indicate the code rate of the N residual blocks after transmission coding.
[0122] In some embodiments, the accumulation unit includes a first accumulator and a second accumulator; the first accumulator calculates the sum of the first bitrates corresponding to the N residual blocks respectively to obtain a first calculation result; the second accumulator calculates the sum of the second bitrate and the first calculation result to obtain the bitrate estimation result.
[0123] In some embodiments, the first code rate includes M sub-code rates, and the first accumulator includes M sub-accumulators, where M is an integer greater than 1; the code rate calculation unit calculates the M sub-code rates corresponding to the i-th residual block based on the i-th residual block itself; the j-th sub-accumulator among the M sub-accumulators calculates the sum of the j-th sub-code rates corresponding to the N residual blocks respectively, to obtain the calculation result corresponding to the j-th sub-code rate, where j is a positive integer less than or equal to M; the second accumulator calculates the second code rate and the sum of the calculation results corresponding to the M sub-code rates respectively, to obtain the code rate estimation result.
[0124] In some embodiments, the M sub-code rates corresponding to the i-th residual block are calculated in parallel.
[0125] In some embodiments, the bitrate calculation unit calculates the first bitrate corresponding to the i-th residual block based on the i-th residual block itself and a preset value.
[0126] In some embodiments, the first code rate includes M sub-code rates, where M is an integer greater than 1; the code rate calculation unit is configured to calculate the first sub-code rate corresponding to the i-th residual block based on the i-th residual block itself and the preset value when the first sub-code rate is related to the dependency relationship between the N residual blocks; or, the code rate calculation unit is configured to calculate the first sub-code rate corresponding to the i-th residual block based solely on the i-th residual block itself when the first sub-code rate is not related to the dependency relationship between the N residual blocks; wherein, the first sub-code rate refers to any sub-code rate among the M sub-code rates.
[0127] In some embodiments, X of the M sub-code rates are related to the dependency relationship between the N residual blocks, and the preset value includes X sub-preset values, where one of the X sub-code rates corresponds to one sub-preset value, and X is a positive integer less than or equal to M; the code rate calculation unit is used to calculate the first sub-code rate corresponding to the i-th residual block based on the i-th residual block itself and the sub-preset value corresponding to the first sub-code rate, when the first sub-code rate is related to the dependency relationship between the N residual blocks.
[0128] In some embodiments, the sub-preset value corresponding to the first sub-bitrate is determined based on the statistical characteristics of at least two intermediate values corresponding to the first sub-bitrate; wherein the statistical characteristics include at least one of the following: mean, median, mode, weighted mean, and the at least two intermediate values are determined based on the dependency relationship between the multiple residual blocks during the calculation of the bitrate estimation results corresponding to multiple residual blocks of the sample image frame.
[0129] In some embodiments, for any one of the N residual blocks, the residual block includes at least one coefficient; for each residual block, the first code rate includes at least one of the following: the code rate of whether the at least one coefficient contains a non-zero coefficient, the code rate of whether each of the at least one coefficient is 0, the code rate of the residual value of the at least one coefficient, the code rate of the first k non-zero coefficients of the at least one coefficient, the code rate of the first coefficient greater than 1 of the at least one coefficient, and the code rate of the sign bit of the non-zero coefficient of the at least one coefficient, where k is a positive integer; the second code rate includes the code rate of the last non-zero coefficient position in the N residual blocks.
[0130] An exemplary embodiment of this application also provides a chip product that includes the processor described above. Optionally, the chip product may be a GPU chip product, and the processor may be a GPU. Optionally, the above-described chip product may be implemented as a graphics card, which includes the processor described above.
[0131] An exemplary embodiment of this application also provides a computer device including the processor described above. Optionally, the computer device may be a personal computer, workstation, game console, and some mobile devices (such as tablet computers, smartphones, etc.), or it may be an in-vehicle terminal device, smart home device, smart TV, smart robot, etc., or it may be a server, server cluster, artificial intelligence computing cluster, cloud computing cluster, etc., wherein the artificial intelligence computing cluster may also be simply referred to as an intelligent computing cluster or smart computing cluster, and this application does not limit it in this regard.
[0132] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.
[0133] The above description is merely an exemplary embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A processor, characterized in that, The processor includes: a bit rate calculation unit and an accumulation unit; The bitrate calculation unit is used to calculate the first bitrate corresponding to the i-th residual block based on the i-th residual block itself after obtaining the i-th residual block among N residual blocks; wherein, the N residual blocks are determined based on the prediction residual of the image frame to be encoded, and the first bitrate corresponding to the i-th residual block refers to the bitrate determined independently of other residual blocks, where N is an integer greater than 1, and i takes the value from 1 to N; The bitrate calculation unit is further configured to, after obtaining the N residual blocks, calculate the second bitrate corresponding to the N residual blocks based on the N residual blocks, wherein the second bitrate includes the bitrate of the last non-zero coefficient position in the N residual blocks; The accumulation unit is used to calculate the sum of the second code rate and the first code rate corresponding to the N residual blocks respectively, to obtain a code rate estimation result. The code rate estimation result is used to indicate the code rate of the N residual blocks after transmission encoding.
2. The processor according to claim 1, characterized in that, The accumulation unit includes a first accumulator and a second accumulator; The first accumulator is used to calculate the sum of the first code rates corresponding to the N residual blocks respectively, and obtain the first calculation result; The second accumulator is used to calculate the sum of the second bitrate and the first calculation result to obtain the bitrate estimation result.
3. The processor according to claim 1, characterized in that, The accumulation unit includes a first accumulator and a second accumulator. The first code rate includes M sub-code rates, and the first accumulator includes M sub-accumulators, where M is an integer greater than 1. The code rate calculation unit is used to calculate the M sub-code rates corresponding to the i-th residual block based on the i-th residual block itself; The j-th sub-accumulator among the M sub-accumulators is used to calculate the sum of the j-th sub-code rates corresponding to the N residual blocks respectively, and to obtain the calculation result corresponding to the j-th sub-code rate, where j is a positive integer less than or equal to M; The second accumulator is used to calculate the sum of the calculation results corresponding to the second code rate and the M sub-code rates respectively, so as to obtain the code rate estimation result.
4. The processor according to claim 3, characterized in that, The M sub-code rates corresponding to the i-th residual block are calculated in parallel.
5. The processor according to claim 1, characterized in that, The bitrate calculation unit is used to calculate the first bitrate corresponding to the i-th residual block based on the i-th residual block itself and a preset value.
6. The processor according to claim 5, characterized in that, The first code rate includes M sub-code rates, where M is an integer greater than 1; The bitrate calculation unit is used to calculate the first sub-bitrate corresponding to the i-th residual block based on the i-th residual block itself and the preset value, when the first sub-bitrate is related to the dependency relationship between the N residual blocks; or, The code rate calculation unit is used to calculate the first sub-code rate corresponding to the i-th residual block based solely on the i-th residual block itself, when the dependency relationship between the first sub-code rate and the N residual blocks is unrelated. Wherein, the first sub-code rate refers to any sub-code rate among the M sub-code rates.
7. The processor according to claim 6, characterized in that, The X sub-code rates among the M sub-code rates are related to the dependency relationship between the N residual blocks. The preset value includes X sub-preset values. One sub-code rate among the X sub-code rates corresponds to one sub-preset value. X is a positive integer less than or equal to M. The bitrate calculation unit is used to calculate the first sub-bitrate corresponding to the i-th residual block based on the i-th residual block and the sub-preset value corresponding to the first sub-bitrate, when the first sub-bitrate is related to the dependency relationship between the first sub-bitrate and the N residual blocks.
8. The processor according to claim 7, characterized in that, The sub-preset value corresponding to the first sub-code rate is determined based on the statistical characteristics of at least two intermediate values corresponding to the first sub-code rate; The statistical features include at least one of the following: mean, median, mode, and weighted mean. The at least two intermediate values are determined based on the dependency relationship between the multiple residual blocks during the calculation of the bitrate estimation results corresponding to multiple residual blocks of the sample image frame.
9. The processor according to any one of claims 1 to 8, characterized in that, For any one of the N residual blocks, the residual block includes at least one coefficient; For each residual block, the first code rate includes at least one of the following: the code rate of whether the at least one coefficient contains a non-zero coefficient, the code rate of whether each of the at least one coefficient is 0, the code rate of the residual value of the at least one coefficient, the code rate of the first k non-zero coefficients of the at least one coefficient, the code rate of the first coefficient greater than 1 of the at least one coefficient, and the code rate of the sign bit of the non-zero coefficient of the at least one coefficient, where k is a positive integer.
10. A rate estimation method applied to a processor, characterized in that, The processor includes: a bitrate calculation unit and an accumulation unit; the method includes: After obtaining the i-th residual block among N residual blocks, the rate calculation unit calculates the first rate corresponding to the i-th residual block based on the i-th residual block itself; wherein, the N residual blocks are determined based on the prediction residual of the image frame to be encoded, and the first rate corresponding to the i-th residual block refers to the rate determined independently of other residual blocks, where N is an integer greater than 1, and i takes the value from 1 to N; After acquiring the N residual blocks, the rate calculation unit calculates the second rate corresponding to the N residual blocks based on the N residual blocks. The second rate includes the rate of the last non-zero coefficient position in the N residual blocks. The accumulation unit calculates the sum of the second code rate and the first code rate corresponding to each of the N residual blocks to obtain a code rate estimation result. The code rate estimation result is used to indicate the code rate of the N residual blocks after transmission encoding.
11. A chip product, characterized in that, The chip product includes the processor as described in any one of claims 1 to 9.
12. A computer device, characterized in that, The computer device includes the processor as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Code rate estimation core unit, code rate estimation device and code rate estimation method
CN110191339A
Video encoder
CN112866695A