Video encoding method, device, electronic device and storage medium
By determining the target threshold and quantization position according to the attribute information of the transform block, the video encoding process is optimized, the problem of inaccurate quantization position in the existing technology is solved, and the quantization processing efficiency and video encoding performance are improved.
Patent Information
- Application Number
- CN202310042005.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-12
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2043-01-12
AI Technical Summary
In the prior art, the initial quantization position of the transform block in the video encoding process is not accurately determined, resulting in low quantization processing efficiency and poor video encoding performance.
According to the attribute information of the transform block, including type, size and texture complexity, the target threshold and quantization position are determined, the target quantization position of the transform block is determined by coefficient scanning, and the quantization process is optimized.
The accuracy of quantization processing is improved, the encoding complexity is reduced, and the video encoding performance is improved.
Smart Images

Figure CN116074512B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of video coding technology, and in particular to a video coding method, device, electronic device, and storage medium. Background Art
[0002] During the video encoding process, the image blocks of the video frame are usually preprocessed to obtain multiple transform blocks, each of which includes multiple transform coefficients. After the transform blocks are quantized, the quantized transform blocks are further compressed to obtain the corresponding video encoding data.
[0003] In related technologies, before quantizing a transform block, an initial quantization position of the transform block is often determined based on a preset threshold and multiple transform coefficients in the transform block, and the transform block is quantized starting from the initial quantization position.
[0004] However, the accuracy of the initial quantization position determined by the above method is often not high, which leads to low quantization processing efficiency and poor video encoding performance. Summary of the Invention
[0005] The present disclosure provides a video encoding method, apparatus, electronic device, and storage medium that can effectively improve quantization processing efficiency and video encoding performance. The technical solutions of the present disclosure are as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a video encoding method is provided, the method comprising:
[0007] determining, based on attribute information of a transform block of a video frame to be encoded, a target threshold value of transform coefficients participating in quantization processing in the transform block, the transform block including a plurality of transform coefficients, the attribute information indicating at least one of a type, a size, and a texture complexity of the transform block;
[0008] determining a target quantization position of the transform block based on the target threshold and the plurality of transform coefficients, the target quantization position indicating a starting position for quantizing the transform block;
[0009] Based on the target quantization position, the transform block is quantized, and based on the transform block after the quantization process, video coding data of the transform block is obtained.
[0010] Through the above method, for any transform block in a video frame to be encoded, a target threshold for the transform block is determined based on the attribute information of the transform block. After the target quantization position of the transform block is determined based on the target threshold, the transform block is quantized starting from the target quantization position, thereby obtaining corresponding video encoded data. In this process, because the target threshold for the transform block is specifically determined based on the attribute information of the transform block before quantization, the accuracy of the target quantization position can be improved, thereby reducing encoding complexity and effectively improving quantization processing efficiency and video encoding performance.
[0011] In some embodiments, determining a target threshold of a transform block of a video frame to be encoded based on attribute information of the transform block includes any of the following:
[0012] When the attribute information indicates that the type of the transform block is a luminance transform block, adjusting a first threshold of a transform coefficient participating in a quantization process in the transform block based on the first adjustment coefficient to obtain the target threshold;
[0013] When the attribute information indicates that the type of the transform block is a chroma transform block, the first threshold is adjusted based on a second adjustment coefficient to obtain the target threshold, and the first adjustment coefficient is smaller than the second adjustment coefficient.
[0014] Through the above method, since the luminance transform block is more important than the chrominance transform block in the video encoding process, the first adjustment coefficient is set to be smaller than the second adjustment coefficient, so that the target threshold of the luminance transform block is lower than the target threshold of the chrominance transform block, so that the target quantization position of the luminance transform block is closer to the lower right corner of the transform block than the chrominance transform block, thereby effectively improving the accuracy of the target quantization position.
[0015] In some embodiments, determining a target threshold of a transform block of a video frame to be encoded based on attribute information of the transform block includes:
[0016] Determining a size level of the transform block based on the size of the transform block indicated by the attribute information;
[0017] Based on the adjustment coefficient corresponding to the size level, the second threshold of the transform coefficients participating in the quantization process in the transform block is adjusted to obtain the target threshold.
[0018] In some embodiments, adjusting the second threshold based on the adjustment coefficient corresponding to the size level to obtain the target threshold includes any of the following:
[0019] When the size level is the first size level, adjusting the second threshold based on a third adjustment coefficient to obtain the target threshold;
[0020] When the size level is the second size level, the second threshold is adjusted based on the fourth adjustment coefficient to obtain the target threshold, the first size level is smaller than the second size level, and the third adjustment coefficient is larger than the fourth adjustment coefficient.
[0021] Through the above method, since the larger transform block has more non-zero transform coefficients than the smaller transform block in the video encoding process, the third adjustment coefficient is set to be greater than the fourth adjustment coefficient, so that the target threshold of the larger transform block is lower than the target threshold of the smaller transform block, so that the target quantization position of the larger transform block is closer to the lower right corner of the transform block relative to the larger transform block, thereby effectively improving the accuracy of the target quantization position.
[0022] In some embodiments, determining a target threshold of a transform block of a video frame to be encoded based on attribute information of the transform block includes:
[0023] Determining a texture complexity level of the transform block based on the texture complexity of the transform block indicated by the attribute information;
[0024] Based on the adjustment coefficient corresponding to the texture complexity level, the third threshold of the transform coefficients participating in the quantization process in the transform block is adjusted to obtain the target threshold.
[0025] In some embodiments, the third threshold is adjusted based on the adjustment coefficient corresponding to the texture complexity level to obtain the target threshold, including any of the following:
[0026] When the texture complexity level is the first texture complexity level, adjusting the third threshold based on a fifth adjustment coefficient to obtain the target threshold;
[0027] When the texture complexity level is the second texture complexity level, the third threshold is adjusted based on the sixth adjustment coefficient to obtain the target threshold, the first texture complexity level is less than the second texture complexity level, and the fifth adjustment coefficient is greater than the sixth adjustment coefficient.
[0028] Through the above method, since in the video encoding process, the transform block with higher texture complexity has more texture features than the transform block with lower texture complexity, that is, it is more important, the fifth adjustment coefficient is set to be greater than the sixth adjustment coefficient, so that the target threshold of the transform block with higher texture complexity is lower than the target threshold of the transform block with lower texture complexity, so that the target quantization position of the transform block with higher texture complexity is closer to the lower right corner of the transform block than the transform block with lower texture complexity, thereby effectively improving the accuracy of the target quantization position.
[0029] In some embodiments, determining a target threshold of a transform block of a video frame to be encoded based on attribute information of the transform block includes:
[0030] determining a transform block level of the transform block based on at least two of the type, size, and texture complexity of the transform block indicated by the attribute information;
[0031] The fourth threshold is adjusted based on the adjustment coefficient corresponding to the transform block level to obtain the target threshold.
[0032] Through the above method, since the importance of transform blocks with different characteristics to video coding is often different during the video encoding process, the target threshold is determined by comprehensively considering the various characteristics of the transform block, and a more appropriate target threshold can be determined for the transform block in a targeted manner, thereby improving the accuracy of the target quantization position.
[0033] In some embodiments, determining a target quantization position of the transform block based on the target threshold and the plurality of transform coefficients includes:
[0034] Based on the coefficient scanning order, the multiple transform coefficients are scanned. When the target transform coefficient scanned is greater than the target threshold, the target quantization position of the transform block is determined based on the position of the target transform coefficient in the transform block. The target transform coefficient is any transform coefficient in the transform block.
[0035] Through the above method, since the target threshold of the transform block is determined based on the attribute information of the transform block, the target quantization position determined based on the target threshold has a high degree of adaptability to the transform block, that is, the accuracy of the target quantization position is high. Based on this, when quantization processing is performed with the target quantization position as the starting position, the encoding complexity can be reduced, the computational overhead can be saved, and the video encoding performance can be improved.
[0036] According to a second aspect of the embodiments of the present disclosure, a video encoding apparatus is provided, the apparatus comprising:
[0037] a threshold determination unit configured to determine a target threshold for transform coefficients participating in quantization processing in a transform block of a video frame to be encoded based on attribute information of the transform block, the transform block including a plurality of transform coefficients, the attribute information indicating at least one of a type, a size, and a texture complexity of the transform block;
[0038] a position determining unit configured to determine a target quantization position of the transform block based on the target threshold and the plurality of transform coefficients, the target quantization position indicating a starting position for quantizing the transform block;
[0039] The acquisition unit is configured to perform quantization processing on the transform block based on the target quantization position, and acquire video coding data of the transform block based on the transform block after the quantization processing.
[0040] In some embodiments, the threshold determination unit is configured to perform any of the following:
[0041] When the attribute information indicates that the type of the transform block is a luminance transform block, adjusting a first threshold of a transform coefficient participating in a quantization process in the transform block based on the first adjustment coefficient to obtain the target threshold;
[0042] When the attribute information indicates that the type of the transform block is a chroma transform block, the first threshold is adjusted based on a second adjustment coefficient to obtain the target threshold, and the first adjustment coefficient is smaller than the second adjustment coefficient.
[0043] In some embodiments, the threshold determination unit is configured to perform:
[0044] Determining a size level of the transform block based on the size of the transform block indicated by the attribute information;
[0045] Based on the adjustment coefficient corresponding to the size level, the second threshold of the transform coefficients participating in the quantization process in the transform block is adjusted to obtain the target threshold.
[0046] In some embodiments, the threshold determination unit is configured to perform any of the following:
[0047] When the size level is the first size level, adjusting the second threshold based on a third adjustment coefficient to obtain the target threshold;
[0048] When the size level is the second size level, the second threshold is adjusted based on the fourth adjustment coefficient to obtain the target threshold, the first size level is smaller than the second size level, and the third adjustment coefficient is larger than the fourth adjustment coefficient.
[0049] In some embodiments, the threshold determination unit is configured to perform:
[0050] Determining a texture complexity level of the transform block based on the texture complexity of the transform block indicated by the attribute information;
[0051] Based on the adjustment coefficient corresponding to the texture complexity level, the third threshold of the transform coefficients participating in the quantization process in the transform block is adjusted to obtain the target threshold.
[0052] In some embodiments, the threshold determination unit is configured to perform any of the following:
[0053] When the texture complexity level is the first texture complexity level, adjusting the third threshold based on a fifth adjustment coefficient to obtain the target threshold;
[0054] When the texture complexity level is the second texture complexity level, the third threshold is adjusted based on the sixth adjustment coefficient to obtain the target threshold, the first texture complexity level is less than the second texture complexity level, and the fifth adjustment coefficient is greater than the sixth adjustment coefficient.
[0055] In some embodiments, the threshold determination unit is configured to perform:
[0056] determining a transform block level of the transform block based on at least two of the type, size, and texture complexity of the transform block indicated by the attribute information;
[0057] The fourth threshold is adjusted based on the adjustment coefficient corresponding to the transform block level to obtain the target threshold.
[0058] In some embodiments, the location determination unit is configured to perform:
[0059] Based on the coefficient scanning order, the multiple transform coefficients are scanned. When the target transform coefficient scanned is greater than the target threshold, the target quantization position of the transform block is determined based on the position of the target transform coefficient in the transform block. The target transform coefficient is any transform coefficient in the transform block.
[0060] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, the electronic device including:
[0061] one or more processors;
[0062] a memory for storing program codes executable by the processor;
[0063] The processor is configured to execute the program code to implement the above-mentioned video encoding method.
[0064] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, which includes: when the program code in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device is enabled to execute the above-mentioned video encoding method.
[0065] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program, which implements the above-mentioned video encoding method when executed by a processor.
[0066] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute an improper limitation of the present disclosure.
[0068] Figure 1 This is a schematic diagram of an implementation environment provided by an embodiment of the present disclosure;
[0069] Figure 2 is a flowchart of a video encoding method provided by an embodiment of the present disclosure;
[0070] Figure 3 is a schematic diagram of determining a target quantization position provided by an embodiment of the present disclosure;
[0071] Figure 4 is a block diagram of a video encoding device provided by an embodiment of the present disclosure;
[0072] Figure 5 is a block diagram of a terminal provided by an embodiment of the present disclosure;
[0073] Figure 6 This is a block diagram of a server provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0074] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0075] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure as detailed in the appended claims.
[0076] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, storage, and display, etc.), and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the attribute information of the transform blocks involved in the embodiments of this disclosure is obtained with full authorization.
[0077] Figure 1 This is a schematic diagram of an implementation environment provided by an embodiment of the present disclosure. Figure 1 The implementation environment includes: an encoding device 101 and a decoding device 102. The encoding device 101 and the decoding device 102 can be directly or indirectly connected through wired or wireless communication, which is not limited in the embodiment of the present disclosure.
[0078] The encoding device 101 is used to implement a video encoding function. Schematically, the encoding device 101 samples the video to be encoded to obtain multiple video frames to be encoded of the video, encodes these video frames based on a video coding standard, obtains corresponding video encoding data (also known as a code stream), and transmits the video encoding data to the decoding device 102. Among them, the video coding standard generally adopts a block-based hybrid coding framework, including but not limited to: High Efficiency Video Coding (HEVC), Versatile Video Coding (VVC), and Audio Video Coding Standard 3 (AVS3), etc., which are not limited in the present embodiment.
[0079] The decoding device 102 is used to implement a video decoding function. Schematically, the decoding device 102 receives video encoding data and decodes the video encoding data according to the reverse process of the encoding device 101 to obtain corresponding video frames, that is, decoded video.
[0080] In the embodiment of the present disclosure, the encoding device 101 and the decoding device 102 can be electronic devices in any form. For example, the electronic device is a terminal or a server, etc. Taking the electronic device as a terminal as an example, the terminal is at least one of a smart phone, a smart watch, a desktop computer, a laptop, a virtual reality terminal, an augmented reality terminal, a wireless terminal and a laptop portable computer. The terminal has a communication function and can access a wired network or a wireless network. Taking the electronic device as a server as an example, the server can be an independent physical server, or a server cluster or a distributed file system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Of course, the server can also include other functional servers to provide more comprehensive and diversified services.
[0081] In some embodiments, the encoding device 101 and the decoding device 102 are deployed on the same electronic device, and the video decoding function and the video encoding function are respectively implemented through different functional modules of the electronic device. For example, taking the electronic device as a terminal as an example, the terminal runs video compression software (with a built-in video encoder, i.e., the encoding device 101) and video playback software (with a built-in video decoder, i.e., the decoding device 102). The video encoding function is implemented by the video compression software, and the video decoding function is implemented by the video playback software. This is not limited in the embodiments of the present disclosure.
[0082] Some key terms involved in the embodiments of the present disclosure are first introduced below.
[0083] Block partitioning, in the video encoding process, refers to dividing the video frame to be encoded (or image frame) into several non-overlapping image blocks (or coding units). The image blocks here are also the basic units of video encoding. Illustratively, during the video encoding process, the video frame to be encoded is divided into several non-overlapping coding tree units (CTUs). The CTU adopts a quadtree-based cyclic hierarchical structure or other structure. Further, each CTU is divided into several coding units (CUs), and each CU is encoded to obtain video encoding data. The embodiments of this disclosure do not limit the specific implementation of block partitioning.
[0084] Transform processing is a linear operation that converts an image described in pixel form in the spatial domain into a transform coefficient matrix in the transform domain, thereby removing spatial redundancy. Illustratively, during video encoding, a prediction mode is used to predict any image block in a video frame, generating a corresponding residual block. Prediction modes include, but are not limited to, intra-frame prediction mode, inter-frame prediction mode, or block copy intra-frame prediction mode. Furthermore, the residual block is subjected to a transform process such as a discrete Fourier transform (DFT) or discrete cosine transform (DCT) to generate a two-dimensional transform block consisting of multiple transform coefficients. A transform block may also be referred to as a transform coefficient block, transform unit (TU), or transform coefficient matrix. Typically, the transform coefficient in the upper left corner of the transform block represents the low-frequency information of the image, while the remaining transform coefficients represent the high-frequency information. Low-frequency information represents the overall appearance of an image, and low-frequency transform coefficients typically have larger values. High-frequency information mainly represents areas with drastic changes, such as the edges of the contours of people or objects in the image. The number of high-frequency transform coefficients is large, and the coefficient values of the high-frequency transform coefficients are usually small.
[0085] Quantization refers to the process of mapping multiple transform coefficients in the aforementioned transform block into multiple discrete values. This process is equivalent to representing several numerical values with a single numerical value. It should be understood that in the transform block obtained after the transform process, the transform coefficients often have a large dynamic range. By quantizing the transform block, the amount of data of the transform coefficients in the quantized transform block is greatly reduced, thereby effectively compressing the data volume. Illustratively, quantization methods include: normal quantization, rate-distortion optimized quantization, and dependent scalar quantization (DQ), etc., which are not limited in the embodiments of the present disclosure. Generally, since the transform coefficients in the transform block are mostly concentrated in the upper left corner of the transform block, there are many transform coefficients with coefficient values of 0 in the lower right corner of the transform block. If these transform coefficients with coefficient values of 0 are quantized, computing resources will be wasted and video coding performance will be reduced. Therefore, before quantizing the transform block, the target quantization position of the transform block, also known as the initial quantization position, is often determined, and the transform block is quantized using this target quantization position as the starting position.
[0086] Entropy coding is a compression method that uses the principle of entropy to avoid losing any information during the encoding process. In the video encoding process, the image blocks of a video frame are transformed and quantized, and then entropy coding is performed on the quantized transformed blocks to generate the corresponding video coded data.
[0087] Based on the above introduction, a video encoding method provided by an embodiment of the present disclosure is introduced below.
[0088] Figure 2 This is a flow chart of a video encoding method provided by an embodiment of the present disclosure. Figure 2 As shown, the method is applied to a coding device, and is described by taking the coding device as an electronic device of any form as an example. The method includes the following steps 201 to 203.
[0089] In step 201, the electronic device determines a target threshold value of a transform coefficient participating in a quantization process in a transform block of a video frame to be encoded based on attribute information of the transform block, where the transform block includes multiple transform coefficients, and the attribute information indicates at least one of the type, size, and texture complexity of the transform block.
[0090] In the embodiments of the present disclosure, the video frame to be encoded refers to any video frame in the video to be encoded, and the transform block refers to any transform block of the video frame to be encoded. The video to be encoded can be a video stored locally in the electronic device, or a video transmitted to the electronic device based on streaming technology, which is not limited in the present disclosure. Schematically, the electronic device samples the video to be encoded in response to a video encoding request for the video to be encoded, obtaining multiple video frames to be encoded. For any video frame to be encoded, the video frame to be encoded is divided into blocks to obtain multiple image blocks. For any image block, the image block is transformed to obtain a corresponding transform block. Based on the attribute information of the transform block, the target threshold value of the transform coefficient participating in the quantization process in the transform block is determined. It should be noted that the specific process of the transform process is described above and will not be repeated here. The specific process of the electronic device determining the target threshold value based on the attribute information will be described in subsequent embodiments and will not be repeated here.
[0091] The following describes the attribute information of any transform block in a video frame to be encoded in detail, taking the transform block as an example. It should be understood that the attribute information indicating at least one of the type, size, and texture complexity of the transform block refers to any one or more of the aforementioned attributes, and this disclosure is not limited to this.
[0092] Among them, the types of transform blocks include luminance transform blocks and chrominance transform blocks. The size of the transform block refers to the width and height of the transform block. For example, if the width and height of the transform block are both 128 pixels, the size of the transform block is 128×128; of course, the size of the transform block can also be reflected by the area of the transform block, which is not limited. The texture complexity of the transform block refers to the gradient of the transform block. Here, texture is a visual feature that reflects the homogeneous phenomenon in the image. It reflects the surface structure organization and arrangement properties of the object surface with slow or periodic changes. Generally, the higher the texture complexity of the transform block, the more texture features of the image in the transform block and the richer the image details. In some embodiments, the texture complexity of the transform block can also be reflected by the second-order moment (variance) of the grayscale histogram of the transform block, or by other means, which is not limited in this disclosure.
[0093] After the above step 201, for any transform block of the video frame to be encoded, the electronic device can determine the target threshold of the transform block in a targeted manner based on the attribute information of the transform block (or based on the characteristics of the transform block itself), providing a basis for subsequently determining the target quantization position of the transform block.
[0094] In step 202, the electronic device determines a target quantization position of the transform block based on the target threshold and the plurality of transform coefficients, where the target quantization position indicates a starting position for performing quantization processing on the transform block.
[0095] In an embodiment of the present disclosure, the electronic device scans the multiple transform coefficients based on a coefficient scanning order, and when the target transform coefficient is greater than the target threshold, the target quantization position (also called the initial quantization position) of the transform block is determined based on the position of the target transform coefficient in the transform block, and the target transform coefficient is any transform coefficient in the transform block. The coefficient scanning order indicates the starting position and scanning direction of the electronic device for scanning the multiple transform coefficients. For example, the coefficient scanning order is a diagonal scan, that is, the electronic device starts with the position of the transform coefficient in the lower right corner of the transform block and scans toward the upper left corner of the transform block. In some embodiments, the electronic device sets the transform coefficient before the target quantization position to 0 based on the target quantization position, providing technical support for the subsequent quantization processing process for the transform block.
[0096] Schematically, refer to Figure 3 , Figure 3 FIG. 1 is a schematic diagram of determining a target quantization position provided by an embodiment of the present disclosure. Figure 3 As shown, the coefficient scanning order is diagonal scanning. The electronic device starts at the position of the transform coefficient in the lower right corner of the transform block and scans multiple transform coefficients one by one. When the scanned transform coefficient A is greater than the target threshold, the position of transform coefficient A in the transform block is used as the target quantization position of the transform block, and the transform coefficients before the scanned transform coefficient A are set to 0. It should be understood that the closer the target quantization position is to the upper left corner, the lower the coding complexity and the higher the quantization efficiency when quantizing the transform block.
[0097] It should be noted that the above Figure 3 The coefficient scanning order shown is merely an example provided in the embodiments of the present disclosure. The electronic device can also scan multiple transform coefficients one by one according to other schemes based on the starting position and scanning order indicated by the coefficient scanning order. For example, the electronic device may start at the position of the transform coefficient in the lower right corner of the transform block, first scan one transform coefficient to the left, then scan one transform coefficient to the upper right, and so on, until the transform coefficient in the upper left corner is scanned. In other words, the embodiments of the present disclosure do not limit the specific process of the electronic device performing coefficient scanning based on the coefficient scanning order.
[0098] After the above step 202, since the target threshold of the transform block is determined based on the attribute information of the transform block, the target quantization position determined based on the target threshold has a high degree of adaptability to the transform block, that is, the accuracy of the target quantization position is high. Based on this, when quantization processing is performed with the target quantization position as the starting position, the encoding complexity can be reduced, the computational overhead can be saved, and the video encoding performance can be improved.
[0099] In step 203, the electronic device performs quantization processing on the transform block based on the target quantization position, and obtains video coding data of the transform block based on the quantized transform block.
[0100] In an embodiment of the present disclosure, the electronic device performs quantization processing on the transform block with the target quantization position as the starting position to obtain the quantized transform block, and further performs entropy coding on the quantized transform block to obtain video coding data of the transform block.
[0101] Steps 201 to 203 are described above using any transform block in a video frame to be encoded as an example. During the encoding process of the video to be encoded, the electronic device performs the above processing on any transform block in each video frame to ultimately obtain encoded video data, or a bitstream. During this process, the target threshold for the transform block is specifically determined based on the transform block's attribute information before quantization. This improves the accuracy of the target quantization position, thereby reducing encoding complexity and effectively enhancing quantization efficiency and video encoding performance.
[0102] The following continues to take any transform block of the video frame to be encoded as an example to introduce the specific implementation method of the electronic device determining the target threshold of the transform block in the above step 201. Schematically, the following methods are included:
[0103] Method 1: Determine the target threshold of the transform block based on the type of the transform block.
[0104] The types of transform blocks include luma transform blocks and chroma transform blocks. The electronic device determines a target threshold value for the transform block, including: when the attribute information indicates that the transform block is a luma transform block, adjusting a first threshold value based on a first adjustment coefficient to obtain a target threshold value; and when the attribute information indicates that the transform block is a chroma transform block, adjusting a first threshold value of transform coefficients involved in quantization processing in the transform block based on a second adjustment coefficient to obtain a target threshold value.
[0105] The first adjustment coefficient is less than the second adjustment coefficient. Adjusting the threshold based on the adjustment coefficient means multiplying the adjustment coefficient by the threshold to obtain the corresponding target threshold. In addition, the first adjustment coefficient, the second adjustment coefficient, and the first threshold can all be set as needed. For example, the first threshold can be set to 1, the first adjustment coefficient can be set to 1.1, and the second adjustment coefficient can be set to 1.2, without limitation.
[0106] Through the above-mentioned method 1, since the luminance transform block is more important than the chrominance transform block in the video encoding process, the first adjustment coefficient is set to be smaller than the second adjustment coefficient, so that the target threshold of the luminance transform block is lower than the target threshold of the chrominance transform block, so that the target quantization position of the luminance transform block is closer to the lower right corner of the transform block than the chrominance transform block, thereby effectively improving the accuracy of the target quantization position.
[0107] Method 2: Determine the target threshold of the transform block based on the size of the transform block.
[0108] The size of the transform block refers to the width and height of the transform block. The process of determining the target threshold of the transform block by the electronic device includes the following steps A1 and A2:
[0109] Step A1: Determine the size level of the transform block based on the size of the transform block indicated by the attribute information.
[0110] Among them, the larger the size of the transform block, the larger the size level of the transform block. It should be noted that the size level can be divided according to needs. Schematically, the size level is divided into size level A and size level B, wherein size level A indicates that the size of the transform block is small, and size level B indicates that the size of the transform block is large. In this case, a size threshold can be set to distinguish the size levels. For example, the size threshold is 64 pixels. If the height or width of the transform block is less than 64 pixels, the size level of the transform block is A. Correspondingly, if the height or width of the transform block is greater than or equal to 64 pixels, the size level of the transform block is B.
[0111] It should be noted that the embodiments of the present disclosure do not limit the number of size levels. That is, the size levels can be divided into two, three, or even more levels. By refining the size levels, the adaptability between the transform block and the target threshold of the transform block can be improved, thereby improving the accuracy of the target quantization position.
[0112] Step A2: Based on the adjustment coefficient corresponding to the size level, the second threshold of the transform coefficient participating in the quantization process in the transform block is adjusted to obtain a target threshold.
[0113] Different size levels correspond to different adjustment coefficients. The larger the size level, the smaller the adjustment coefficient. Illustratively, this step includes: when the size level is the first size level, adjusting the second threshold based on the third adjustment coefficient to obtain the target threshold; when the size level is the second size level, adjusting the second threshold based on the fourth adjustment coefficient to obtain the target threshold.
[0114] The first size level is smaller than the second size level, and the third adjustment coefficient is greater than the fourth adjustment coefficient. Adjusting the threshold based on the adjustment coefficient is similar to the above-described method and will not be described in detail. Furthermore, the second threshold can be the same as the first threshold, and this disclosure does not limit this.
[0115] Through the above-mentioned method 2, since the larger transform block has more non-zero transform coefficients than the smaller transform block in the video encoding process, the third adjustment coefficient is set to be greater than the fourth adjustment coefficient, so that the target threshold of the larger transform block is lower than the target threshold of the smaller transform block, so that the target quantization position of the larger transform block is closer to the lower right corner of the transform block relative to the larger transform block, thereby effectively improving the accuracy of the target quantization position.
[0116] Method three: determining the target threshold of the transform block based on the texture complexity of the transform block.
[0117] The texture complexity of the transform block refers to the gradient of the transform block. The process of the electronic device determining the target threshold of the transform block includes the following steps B1 and B2:
[0118] Step B1: Determine the texture complexity level of the transform block based on the texture complexity of the transform block indicated by the attribute information.
[0119] Among them, the higher the texture complexity of the transform block, the greater the texture complexity level of the transform block. It should be noted that the texture complexity level can be divided according to needs. Schematically, the texture complexity level is divided into texture complexity level C and texture complexity level D, wherein texture complexity level C indicates that the texture complexity of the transform block is high and the image details are richer, and texture complexity level D indicates that the texture complexity of the transform block is low and the image details are less. In this case, a texture complexity threshold can be set to distinguish the texture complexity levels. For example, the texture complexity threshold is 50. If the texture complexity of the transform block is less than 50, the texture complexity level of the transform block is C. Correspondingly, if the texture complexity of the transform block is greater than or equal to 50, the texture complexity level of the transform block is D.
[0120] It should be noted that the embodiments of the present disclosure do not limit the number of texture complexity levels. That is, the texture complexity levels can be divided into two, three, or even more levels. By refining the texture complexity levels, the adaptability between the transform block and the target threshold of the transform block can be improved, thereby improving the accuracy of the target quantization position.
[0121] Step B2: Based on the adjustment coefficient corresponding to the texture complexity level, adjust the third threshold of the transform coefficients participating in the quantization process in the transform block to obtain the target threshold.
[0122] Different texture complexity levels correspond to different adjustment coefficients. The larger the texture complexity level, the smaller the adjustment coefficient. In an illustrative embodiment, this step includes: when the texture complexity level is a first texture complexity level, adjusting the third threshold based on a fifth adjustment coefficient to obtain the target threshold; and when the texture complexity level is a second texture complexity level, adjusting the third threshold based on a sixth adjustment coefficient to obtain the target threshold.
[0123] The first texture complexity level is less than the second texture complexity level, and the fifth adjustment coefficient is greater than the sixth adjustment coefficient. Adjusting the threshold based on the adjustment coefficient is similar to the above-described method and will not be further described. Furthermore, the third threshold can be the same as both the first and second thresholds, and this disclosure does not limit this.
[0124] Through the above-mentioned method three, since in the video encoding process, the transform block with higher texture complexity has more texture features than the transform block with lower texture complexity, that is, it is more important, the fifth adjustment coefficient is set to be greater than the sixth adjustment coefficient, so that the target threshold of the transform block with higher texture complexity is lower than the target threshold of the transform block with lower texture complexity, so that the target quantization position of the transform block with higher texture complexity is closer to the lower right corner of the transform block than the transform block with lower texture complexity, thereby effectively improving the accuracy of the target quantization position.
[0125] Method 4: determining a target threshold of a transform block based on at least two of the type, size, and texture complexity of the transform block.
[0126] The process of the electronic device determining the target threshold value of the transformation block includes the following steps C1 and C2:
[0127] Step C1: Determine a transform block level of the transform block based on at least two of the type, size, and texture complexity of the transform block indicated by the attribute information.
[0128] Among them, the electronic device can determine the transform block level of the transform block in combination with the type and size of the transform block, or in combination with the type and texture complexity, or in combination with the size and texture complexity, or in combination with the type, size and texture complexity. It should be noted that the transform block level can be divided according to needs. For example, taking the example of the electronic device determining the transform block level in combination with the type and size of the transform block, the transform block levels are divided into 1 to 5. The electronic device determines the corresponding level based on the type and size of the transform block. For example, if a transform block is a luminance transform block and the size level is the first size level, the transform block level of the transform block is determined to be 1. If a transform block is a luminance transform block and the size level is the second size level, the transform block level of the transform block is determined to be 2, and so on. The present disclosure does not limit this. For another example, taking the example of an electronic device determining a transform block level based on the type, size, and texture complexity of the transform block, the transform block levels are divided into 1 to 10. The electronic device determines the corresponding level based on the type, size, and texture complexity of the transform block. For example, if a transform block is a luminance transform block, the size level is the first size level, and the texture complexity level is the first texture complexity level, then the transform block level of the transform block is determined to be 1, and so on, which will not be repeated here.
[0129] In some embodiments, an electronic device determines transform reference information for a transform block based on the transform block's type, size, and texture complexity. The transform reference information indicates attribute information used to determine the transform block level, and thus determines the transform block level of the transform block based on the attribute information indicated by the transform reference information. In other words, the electronic device can select attributes from the transform block's attribute information for determining the transform block level based on the transform reference information, thereby improving the accuracy of the transform block level and, in turn, the accuracy of the target threshold. Illustratively, the electronic device determines the transform reference information for the transform block based on the transform block's type, size, texture complexity, and target weight. The target weight indicates the importance of different attribute information to video coding. The target weight is a preset weight that can be set as needed. For example, the target weights are 0.6, 0.8, and 0.9, respectively indicating the importance of the transform block type, size, and texture complexity to video coding. The transform reference information is numerical information, and the electronic device can select attribute information from the transform block's attribute information for determining the transform block level based on the numerical range of the transform reference information. For example, if a transform block is a luminance transform block (represented by a value of 10), has a size of 64 pixels, and a texture complexity of 50, then the transform reference information of the transform block is 0.6*1+0.8*64+0.9*50=102.2, which is greater than 100. In this case, the electronic device determines the transform block level based on the type, size, and texture complexity of the transform block. It should be noted that the specific implementation of the transform reference information here is only exemplary. In some embodiments, the electronic device can also select attribute information for determining the transform block level from the attribute information of the transform block based on other methods, and the embodiments of the present disclosure are not limited to this.
[0130] Step C2: Adjust the fourth threshold based on the adjustment coefficient corresponding to the transform block level to obtain the target threshold.
[0131] Different transform block levels correspond to different adjustment coefficients, which can be set as needed. For example, transform block levels range from 1 to 5, with corresponding adjustment coefficients of 1.1, 1.2, 1.3, 1.4, and 1.5, respectively. Adjusting the threshold based on the adjustment coefficient is similar to the above-mentioned method and will not be further described. Furthermore, the fourth threshold can be the same as the first, second, and third thresholds, and this disclosure does not limit this.
[0132] Through the above-mentioned method 4, since the importance of transform blocks with different characteristics to video encoding is often different during the video encoding process, the target threshold is determined by comprehensively considering the various characteristics of the transform block, and a more appropriate target threshold can be determined for the transform block in a targeted manner, thereby improving the accuracy of the target quantization position.
[0133] It should be noted that in the above-mentioned methods 1 to 4, the electronic device is introduced by adjusting a certain threshold based on the adjustment coefficient to obtain the target threshold. In some embodiments, the electronic device can also determine the target threshold directly based on the attribute information of the transform block. Schematically, the electronic device stores a target file, which indicates the mapping relationship between the attribute information of the transform block and the target threshold. For example, taking the above-mentioned method 1 as an example, the luminance transform block and the chrominance transform block correspond to the target threshold a and the target threshold b respectively; taking the above-mentioned method 2 as an example, the size level A and the size level B correspond to the target threshold c and the target threshold d respectively; the rest are similar, so they are not repeated here. By pre-setting the target thresholds corresponding to different attribute information, the efficiency of determining the target threshold can be improved during the video encoding process, thereby improving the video encoding performance.
[0134] Figure 4 is a block diagram of a video encoding device provided by an embodiment of the present disclosure. Figure 4 The device includes a threshold determination unit 401, a position determination unit 402 and an acquisition unit 403.
[0135] a threshold determination unit 401 configured to determine a target threshold for transform coefficients participating in quantization processing in a transform block of a video frame to be encoded based on attribute information of the transform block, the transform block including a plurality of transform coefficients, the attribute information indicating at least one of a type, a size, and a texture complexity of the transform block;
[0136] a position determining unit 402 configured to determine a target quantization position of the transform block based on the target threshold and the plurality of transform coefficients, the target quantization position indicating a starting position for quantizing the transform block;
[0137] The acquiring unit 403 is configured to perform quantization processing on the transform block based on the target quantization position, and acquire video coding data of the transform block based on the quantized transform block.
[0138] In some embodiments, the threshold determination unit 401 is configured to perform any of the following:
[0139] When the attribute information indicates that the type of the transform block is a luminance transform block, adjusting a first threshold of a transform coefficient participating in a quantization process in the transform block based on the first adjustment coefficient to obtain the target threshold;
[0140] When the attribute information indicates that the type of the transform block is a chroma transform block, the first threshold is adjusted based on a second adjustment coefficient to obtain the target threshold, and the first adjustment coefficient is smaller than the second adjustment coefficient.
[0141] In some embodiments, the threshold determination unit 401 is configured to perform:
[0142] Determining a size level of the transform block based on the size of the transform block indicated by the attribute information;
[0143] Based on the adjustment coefficient corresponding to the size level, the second threshold of the transform coefficients participating in the quantization process in the transform block is adjusted to obtain the target threshold.
[0144] In some embodiments, the threshold determination unit 401 is configured to perform any of the following:
[0145] When the size level is the first size level, adjusting the second threshold based on a third adjustment coefficient to obtain the target threshold;
[0146] When the size level is the second size level, the second threshold is adjusted based on the fourth adjustment coefficient to obtain the target threshold, the first size level is smaller than the second size level, and the third adjustment coefficient is larger than the fourth adjustment coefficient.
[0147] In some embodiments, the threshold determination unit 401 is configured to perform:
[0148] Determining a texture complexity level of the transform block based on the texture complexity of the transform block indicated by the attribute information;
[0149] Based on the adjustment coefficient corresponding to the texture complexity level, the third threshold of the transform coefficients participating in the quantization process in the transform block is adjusted to obtain the target threshold.
[0150] In some embodiments, the threshold determination unit 401 is configured to perform any of the following:
[0151] When the texture complexity level is the first texture complexity level, adjusting the third threshold based on a fifth adjustment coefficient to obtain the target threshold;
[0152] When the texture complexity level is the second texture complexity level, the third threshold is adjusted based on the sixth adjustment coefficient to obtain the target threshold, the first texture complexity level is less than the second texture complexity level, and the fifth adjustment coefficient is greater than the sixth adjustment coefficient.
[0153] In some embodiments, the threshold determination unit 401 is configured to perform:
[0154] determining a transform block level of the transform block based on at least two of the type, size, and texture complexity of the transform block indicated by the attribute information;
[0155] The fourth threshold is adjusted based on the adjustment coefficient corresponding to the transform block level to obtain the target threshold.
[0156] In some embodiments, the location determination unit 401 is configured to perform:
[0157] Based on the coefficient scanning order, the multiple transform coefficients are scanned. When the target transform coefficient scanned is greater than the target threshold, the target quantization position of the transform block is determined based on the position of the target transform coefficient in the transform block. The target transform coefficient is any transform coefficient in the transform block.
[0158] The video encoding device described above determines a target threshold for any transform block in a video frame to be encoded based on the transform block's attribute information. After determining a target quantization position for the transform block based on the target threshold, the transform block is quantized starting at the target quantization position, thereby obtaining corresponding video encoded data. In this process, because the target threshold for the transform block is specifically determined based on the transform block's attribute information before quantization, the accuracy of the target quantization position can be improved, thereby reducing encoding complexity and effectively enhancing quantization processing efficiency and video encoding performance.
[0159] It should be noted that the video encoding device provided in the above embodiment is merely an example of the division of the functional modules described above during video encoding. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the video encoding device provided in the above embodiment and the video encoding method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0160] In an exemplary embodiment, an electronic device is further provided. The electronic device includes a processor and a memory, wherein the memory is used to store at least one computer program. The at least one computer program is loaded and executed by the processor to implement the video encoding method in the embodiment of the present disclosure.
[0161] Taking electronic devices as terminals as an example, Figure 5This is a block diagram of a terminal provided by an embodiment of the present disclosure. Terminal 500 may be a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. Terminal 500 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other similar names.
[0162] Typically, the terminal 500 includes a processor 501 and a memory 502 .
[0163] The processor 501 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 501 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 501 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 501 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 501 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0164] The memory 502 may include one or more computer-readable storage media, which may be non-transitory. The memory 502 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 502 is used to store at least one program code, which is executed by the processor 501 to implement the above-mentioned video encoding method.
[0165] In some embodiments, terminal 500 may optionally include a peripheral device interface 503 and at least one peripheral device. Processor 501, memory 502, and peripheral device interface 503 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 503 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 504, a display screen 505, a camera assembly 506, an audio circuit 507, a positioning assembly 508, and a power supply 509.
[0166] The peripheral device interface 503 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 501 and the memory 502. In some embodiments, the processor 501, the memory 502, and the peripheral device interface 503 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 501, the memory 502, and the peripheral device interface 503 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0167] The radio frequency circuit 504 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 504 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 504 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 504 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The radio frequency circuit 504 can communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 504 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0168] Display screen 505 is used to display a user interface (UI). This UI may include graphics, text, icons, videos, or any combination thereof. When display screen 505 is a touchscreen display, it is also capable of collecting touch signals on or above the surface of display screen 505. These touch signals can be input as control signals to processor 501 for processing. Display screen 505 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there can be a single display screen 505, located on the front panel of terminal 500. In other embodiments, there can be at least two display screens 505, located on different surfaces of terminal 500 or in a foldable design. In still other embodiments, display screen 505 can be a flexible display screen, located on a curved or foldable surface of terminal 500. Furthermore, display screen 505 can be configured as a non-rectangular, irregular shape, also known as a special-shaped screen. Display screen 505 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0169] The camera assembly 506 is used to capture images or videos. Optionally, the camera assembly 506 includes a front camera and a rear camera. Typically, the front camera is set on the front panel of the terminal, and the rear camera is set on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 506 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0170] The audio circuit 507 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals that are input into the processor 501 for processing, or input into the radio frequency circuit 504 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there may be multiple microphones, each disposed at different locations on the terminal 500. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert electrical signals from the processor 501 or the radio frequency circuit 504 into sound waves. The speaker may be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for purposes such as distance measurement. In some embodiments, the audio circuit 507 may also include a headphone jack.
[0171] The positioning component 508 is used to locate the current geographical location of the terminal 500 to implement navigation or LBS (Location Based Service).
[0172] Power supply 509 is used to power various components in terminal 500. Power supply 509 can be AC power, DC power, disposable batteries, or rechargeable batteries. When power supply 509 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0173] In some embodiments, the terminal 500 further includes one or more sensors 510 , including but not limited to: an acceleration sensor 511 , a gyroscope sensor 512 , a pressure sensor 513 , a fingerprint sensor 514 , an optical sensor 515 , and a proximity sensor 516 .
[0174] The accelerometer 511 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by the terminal 500. For example, the accelerometer 511 can be used to detect the components of gravity acceleration along the three coordinate axes. The processor 501 can control the display screen 505 to display the user interface in a landscape or portrait view based on the gravity acceleration signal collected by the accelerometer 511. The accelerometer 511 can also be used to collect game or user motion data.
[0175] The gyroscope sensor 512 can detect the orientation and rotation angle of the terminal 500. The gyroscope sensor 512 can work with the acceleration sensor 511 to collect the user's 3D movements on the terminal 500. Based on the data collected by the gyroscope sensor 512, the processor 501 can implement the following functions: motion sensing (for example, changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0176] The pressure sensor 513 can be set on the side frame of the terminal 500 and / or the lower layer of the display screen 505. When the pressure sensor 513 is set on the side frame of the terminal 500, it can detect the user's grip signal of the terminal 500, and the processor 501 performs left and right hand recognition or shortcut operations based on the grip signal collected by the pressure sensor 513. When the pressure sensor 513 is set on the lower layer of the display screen 505, the processor 501 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 505. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0177] The fingerprint sensor 514 is used to collect the user's fingerprint. The processor 501 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 514, or the fingerprint sensor 514 identifies the user's identity based on the collected fingerprint. When the user's identity is recognized as a trusted identity, the processor 501 authorizes the user to perform relevant sensitive operations, such as unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings. The fingerprint sensor 514 can be set on the front, back, or side of the terminal 500. When a physical button or manufacturer logo is provided on the terminal 500, the fingerprint sensor 514 can be integrated with the physical button or manufacturer logo.
[0178] The optical sensor 515 is used to detect ambient light intensity. In one embodiment, the processor 501 can control the display brightness of the display screen 505 based on the ambient light intensity detected by the optical sensor 515. Specifically, when the ambient light intensity is high, the display brightness of the display screen 505 is increased; when the ambient light intensity is low, the display brightness of the display screen 505 is decreased. In another embodiment, the processor 501 can also dynamically adjust the shooting parameters of the camera assembly 506 based on the ambient light intensity detected by the optical sensor 515.
[0179] Proximity sensor 516, also known as a distance sensor, is typically located on the front panel of terminal 500. Proximity sensor 516 is used to detect the distance between the user and the front of terminal 500. In one embodiment, when proximity sensor 516 detects that the distance between the user and the front of terminal 500 is gradually decreasing, processor 501 controls display screen 505 to switch from the screen-on state to the screen-off state. When proximity sensor 516 detects that the distance between the user and the front of terminal 500 is gradually increasing, processor 501 controls display screen 505 to switch from the screen-off state to the screen-on state.
[0180] Those skilled in the art will understand that Figure 5The structure shown in the figure does not constitute a limitation on the terminal 500, and the terminal 500 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0181] Take the electronic device as an example, Figure 6 6 is a block diagram of a server provided by an embodiment of the present disclosure. Schematically, the server 600 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 601 and one or more memories 602, wherein the one or more memories 602 store at least one program code, and the at least one program code is loaded and executed by the one or more processors 601 to implement the video encoding method provided by the above-mentioned various method embodiments. Of course, the server 600 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 600 may also include other components for implementing device functions, which will not be described in detail here.
[0182] In an exemplary embodiment, a computer-readable storage medium including program code is further provided, for example, a memory 602 including the program code. The program code can be executed by a processor 601 of a server 600 to implement the above-described video encoding method. Alternatively, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, or the like.
[0183] In an exemplary embodiment, a computer program product is further provided, including a computer program, which implements the above-mentioned video encoding method when executed by a processor.
[0184] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.
[0185] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A video encoding method, characterized in that: The method comprises: determining, based on attribute information of a transform block of a video frame to be encoded, a target threshold value of transform coefficients participating in quantization processing in the transform block, the transform block including a plurality of transform coefficients, the attribute information indicating at least one of a type, a size, and a texture complexity of the transform block; determining a target quantization position of the transform block based on the target threshold and the plurality of transform coefficients, the target quantization position indicating a starting position for performing quantization processing on the transform block; The transform block is quantized based on the target quantization position, and video coding data of the transform block is obtained based on the quantized transform block.
2. The video encoding method according to claim 1, wherein: The determining, based on the attribute information of the transform block of the video frame to be encoded, the target threshold of the transform block includes any one of the following: When the attribute information indicates that the type of the transform block is a luminance transform block, adjusting a first threshold of a transform coefficient participating in a quantization process in the transform block based on a first adjustment coefficient to obtain the target threshold; When the attribute information indicates that the type of the transform block is a chroma transform block, the first threshold is adjusted based on a second adjustment coefficient to obtain the target threshold, and the first adjustment coefficient is smaller than the second adjustment coefficient.
3. The video encoding method according to claim 1, wherein: The determining, based on the attribute information of the transform block of the video frame to be encoded, a target threshold of the transform block includes: determining a size level of the transform block based on the size of the transform block indicated by the attribute information; Based on the adjustment coefficient corresponding to the size level, the second threshold of the transform coefficient participating in the quantization process in the transform block is adjusted to obtain the target threshold.
4. The video encoding method according to claim 3, wherein: The adjusting the second threshold based on the adjustment coefficient corresponding to the size level to obtain the target threshold includes any of the following: When the size level is the first size level, adjusting the second threshold based on a third adjustment coefficient to obtain the target threshold; When the size level is the second size level, the second threshold is adjusted based on the fourth adjustment coefficient to obtain the target threshold, the first size level is smaller than the second size level, and the third adjustment coefficient is greater than the fourth adjustment coefficient.
5. The video encoding method according to claim 1, wherein: The determining, based on the attribute information of the transform block of the video frame to be encoded, a target threshold of the transform block includes: determining a texture complexity level of the transform block based on the texture complexity of the transform block indicated by the attribute information; Based on the adjustment coefficient corresponding to the texture complexity level, the third threshold of the transform coefficients participating in the quantization process in the transform block is adjusted to obtain the target threshold.
6. The video encoding method according to claim 5, wherein: The adjusting the third threshold based on the adjustment coefficient corresponding to the texture complexity level to obtain the target threshold includes any one of the following: When the texture complexity level is the first texture complexity level, adjusting the third threshold based on a fifth adjustment coefficient to obtain the target threshold; When the texture complexity level is the second texture complexity level, the third threshold is adjusted based on the sixth adjustment coefficient to obtain the target threshold, the first texture complexity level is less than the second texture complexity level, and the fifth adjustment coefficient is greater than the sixth adjustment coefficient.
7. The video encoding method according to claim 1, wherein: The determining, based on the attribute information of the transform block of the video frame to be encoded, a target threshold of the transform block includes: determining a transform block level of the transform block based on at least two of the type, size, and texture complexity of the transform block indicated by the attribute information; The fourth threshold is adjusted based on the adjustment coefficient corresponding to the transform block level to obtain the target threshold.
8. The video encoding method according to claim 1, wherein: The determining, based on the target threshold and the plurality of transform coefficients, a target quantization position of the transform block, comprises: The multiple transform coefficients are scanned based on a coefficient scanning order. When a target transform coefficient is found to be greater than the target threshold, a target quantization position of the transform block is determined based on a position of the target transform coefficient in the transform block, where the target transform coefficient is any one of the transform coefficients in the transform block.
9. A video encoding device, characterized in that: The device comprises: a threshold determination unit configured to determine a target threshold for transform coefficients participating in quantization processing in a transform block of a video frame to be encoded based on attribute information of the transform block, the transform block including a plurality of transform coefficients, the attribute information indicating at least one of a type, a size, and a texture complexity of the transform block; a position determining unit configured to determine a target quantization position of the transform block based on the target threshold and the plurality of transform coefficients, wherein the target quantization position indicates a starting position of a quantization process for the transform block; The acquisition unit is configured to perform quantization processing on the transform block based on the target quantization position, and acquire video coding data of the transform block based on the transform block after the quantization processing.
10. An electronic device, characterized in that: The electronic device comprises: one or more processors; a memory for storing program code executable by the processor; The processor is configured to execute the program code to implement the video encoding method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that When the program code in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device is enabled to perform the video encoding method according to any one of claims 1 to 8.