Video encoding quantization method, device, equipment and computer readable storage medium

By acquiring video frame attribute information and flexibly selecting quantization methods, the problem of poor flexibility in the quantization process in existing technologies is solved, thereby improving coding efficiency and performance while reducing storage space and transmission rate.

CN115883827BActive Publication Date: 2026-07-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2021-09-28
Publication Date
2026-07-21

Smart Images

  • Figure CN115883827B_ABST
    Figure CN115883827B_ABST
Patent Text Reader

Abstract

The application provides a video coding quantization method, device, equipment and computer readable storage medium. The method comprises the following steps: obtaining a to-be-coded video frame, performing block processing and transformation processing on the to-be-coded video frame to obtain transformed video frame data; obtaining frame attribute information of the to-be-coded video frame; determining a quantization mode of the to-be-coded video frame based on the frame attribute information of the to-be-coded video frame, wherein the quantization mode is one of dependent quantization and independent quantization, wherein the dependent quantization needs to depend on the quantization result before the current to-be-quantized coefficient, and the independent quantization does not need to depend on the quantization result before the current to-be-quantized coefficient; and performing quantization processing on the transformed video frame data based on the quantization mode of the to-be-coded video frame to obtain a quantization result. Through the application, the quantization mode can be determined based on the frame attribute information of the video frame, and the quantization flexibility is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to video coding technology, and more particularly to a video coding quantization method, apparatus, device, and computer-readable storage medium. Background Technology

[0002] With the continuous development of smart terminals, the pixel values ​​of images and videos captured by cameras on existing smart terminals are becoming increasingly higher. Consequently, the space occupied by images and videos captured by smart terminals is also increasing, placing higher demands on the terminal's own storage space and significantly impacting the transmission speed. Therefore, to reduce the storage requirements of images and videos and improve transmission speed, it is necessary to compress and encode the captured images and videos. Video encoding refers to the process of converting a file in one video format into another using compression technology. In the video encoding process, quantization is the core process of image and video compression standards and production, and it is also one of the main sources of compression quality loss. Current quantization processes lack flexibility, thus affecting encoding performance. Summary of the Invention

[0003] This application provides a video coding quantization method, apparatus, and computer-readable storage medium, which can improve quantization flexibility and coding efficiency.

[0004] The technical solution of this application embodiment is implemented as follows: This application provides a video coding quantization method, including: The video frame to be encoded is acquired, and the video frame to be encoded is divided into blocks and transformed to obtain the transformed video frame data. Obtain the frame attribute information of the video frame to be encoded; The quantization method of the video frame to be encoded is determined based on the frame attribute information of the video frame to be encoded. The quantization method is one of dependent quantization and independent quantization. Dependent quantization depends on the quantization results before the current quantization coefficient, while independent quantization does not depend on the quantization results before the current quantization coefficient. The transformed video frame data is quantized based on the quantization method of the video frame to be encoded to obtain the quantization result.

[0005] This application provides a video encoding quantization device, including:

[0006] The block transformation module is used to acquire the video frame to be encoded, and to perform block transformation on the video frame to be encoded to obtain the transformed video frame data. The first acquisition module is used to acquire the frame attribute information of the video frame to be encoded; The first determining module is used to determine the quantization method of the video frame to be encoded based on the frame attribute information of the video frame to be encoded. The quantization method is one of dependent quantization and independent quantization. Dependent quantization depends on the quantization results before the current quantization coefficient, while independent quantization does not depend on the quantization results before the current quantization coefficient. The quantization module is used to quantize the transformed video frame data based on the quantization method of the video frame to be encoded, and obtain the quantization result.

[0007] In some embodiments, the first determining module is further configured to: Based on the frame attribute information of each video frame to be encoded, the frame type of the video frame to be encoded is obtained; Based on the frame type, determine the quantization parameters of the video to be encoded; Based on the quantization parameters, the quantization method of the video to be encoded is determined.

[0008] In some embodiments, the first determining module is further configured to: When the quantization parameter is greater than the first parameter threshold, the quantization method of the video to be encoded is determined to be dependent quantization; When the quantization parameter is less than or equal to the first parameter threshold, the quantization method of the video to be encoded is determined to be independent quantization.

[0009] In some embodiments, the first determining module is further configured to: Based on the frame attribute information of each video frame to be encoded, the resolution of the video frame to be encoded is obtained; When the resolution is greater than the resolution threshold, the quantization method of the video to be encoded is determined to be dependent quantization; When the resolution is less than or equal to the resolution threshold, the quantization method of the video to be encoded is determined to be independent quantization.

[0010] In some embodiments, the transformed video frame data includes multiple chroma block data and multiple luma block data, and the quantization module is further configured to: When the quantization method is dependent quantization, the chromaticity quantization threshold of each chromaticity block is determined, and the initial quantization position of each chromaticity block is determined based on the chromaticity quantization threshold of each chromaticity block. Determine the brightness quantization threshold of each brightness block, and determine the initial quantization position of each brightness block based on the brightness quantization threshold of each brightness block; The chroma blocks are quantized from their initial quantization positions according to the aforementioned dependency quantization method to obtain the chroma quantization results. The brightness blocks are quantized from their initial quantization positions according to the aforementioned dependency quantization method to obtain the brightness quantization result.

[0011] In some embodiments, the quantization module is further configured to: Determine the size information of each chromaticity block; When the size information of the chroma block is greater than the size threshold, the first chroma threshold is determined as the chroma quantization threshold of the chroma block; When the size information of the chroma block is less than or equal to the size threshold, the second chroma threshold is determined as the chroma quantization threshold of the chroma block, wherein the first chroma threshold is greater than the second chroma threshold.

[0012] In some embodiments, the quantization module is further configured to: Scan each chromaticity coefficient in the chromaticity block from the first vertex along the opposite diagonal direction; When a first target position in the chroma block with a chroma coefficient greater than the second parameter threshold is detected, the first target position is determined as the initial quantization position of the chroma block.

[0013] In some embodiments, the quantization module is further configured to: Determine the size information of each brightness block; When the size information of the luminance block is greater than the size threshold, the first luminance threshold is determined as the chromaticity threshold of the luminance block; When the size information of the luminance block is less than or equal to the size threshold, the second luminance threshold is determined as the chromaticity quantification threshold of the luminance block, wherein the first luminance threshold is greater than the second luminance threshold.

[0014] In some embodiments, the quantization module is further configured to: Scan each brightness coefficient in the brightness block from the first vertex along the opposite diagonal direction; When a second target position in the brightness block with a brightness coefficient greater than the second parameter threshold is detected, the second target position is determined as the initial quantization position of the brightness block.

[0015] In some embodiments, the device further includes: The encoding module is used to encode the quantization results of multiple frames in the video to be encoded, so as to obtain the encoded video data. The post-processing module is used to store or output the encoded video data.

[0016] This application provides a computer device, including: Memory, used to store executable instructions; The processor, when executing executable instructions stored in the memory, implements the video coding quantization method provided in the embodiments of this application.

[0017] This application provides a computer-readable storage medium storing executable instructions for inducing a processor to execute and implement the video encoding quantization method provided in this application.

[0018] This application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement the video coding quantization method provided in this application.

[0019] The embodiments of this application have the following beneficial effects: After acquiring the video frame to be encoded, the video frame is first segmented and transformed to obtain transformed video frame data. Then, the frame attribute information of the video frame to be encoded is acquired. Next, the quantization method of the video frame to be encoded is determined based on the frame attribute information. The quantization method is either dependent quantization or independent quantization. Dependent quantization depends on the quantization results before the current quantized coefficient, while independent quantization does not depend on the quantization results before the current quantized coefficient. The transformed video frame data is then quantized based on the quantization method of the video frame to be encoded to obtain the quantization result. In this way, when quantizing each video frame, the quantization method can be flexibly determined based on the frame attributes, resulting in a higher degree of matching between the quantization method and the video frame. This not only improves the flexibility of the quantization method but also enhances encoding efficiency and performance. Attached Figure Description

[0020] Figure 1A A schematic diagram of the quantization rules for two quantizers, Q0 and Q1, for dependency scalar quantization; Figure 1B This is a schematic diagram of a quantified state transition process; Figure 1C This is a schematic diagram of the state transitions for multiple coefficients in a VVC. Figure 2 This is a schematic diagram of the network architecture of the video encoding system provided in the embodiments of this application; Figure 3 This is a schematic diagram of the terminal structure provided in the embodiments of this application; Figure 4 This is a schematic diagram illustrating an implementation process of the video coding quantization method provided in an embodiment of this application; Figure 5 A schematic diagram illustrating another implementation flow of the video coding quantization method provided in the embodiments of this application; Figure 6This is a schematic diagram illustrating another implementation process of the video coding quantization method provided in the embodiments of this application; Figure 7 This is a schematic diagram illustrating the determination of the initial quantization position as provided in an embodiment of this application. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0023] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0025] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.

[0026] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0027] 1) High Efficiency Video Coding (HEVC) is a video coding standard developed by the Joint Collaborative Team on Video Coding (JCT-VC), established by the International Telecommunication Union (ITU-T, Telecommunication Standardization Sector) and the International Organization for Standardization (ISO). In ITU-T standards, HEVC is also known as the H.265 standard. HEVC aims to achieve half the bitrate of H.264 / AVC while using 2 to 4 times the complexity of H.264 / AVC, while maintaining the same coding quality.

[0028] 2) Versatile Video Coding (VVC), also known as H.266, is an evolution of HEVC and aims to double the coding performance of HEVC / H.265.

[0029] 3) Dependent scalar quantization (DQ) refers to a set of permissible reconstructed values ​​of transform coefficients that depend on the values ​​of transform coefficient levels preceding the current transform coefficient level in the reconstruction order.

[0030] 4) Rate Distortion Optimized Quantization (RDOQ) is a quantization method that optimizes the amount of distortion (video quality loss) based on the amount of data (rate) required for video encoding.

[0031] To better understand the quantization method provided in the embodiments of this application, the quantization methods in related technologies and their shortcomings are explained.

[0032] In existing video decoding technologies, a fixed threshold is used to determine the starting point for quantization in the quantization module, and a fixed quantization tool is used, such as Dependent Quantization (DQ) or Rate Distortion Optimized Quantization (RDOQ). The following sections will explain Dependent Quantization and Rate Distortion Optimized Quantization respectively.

[0033] The implementation process of scalar quantization includes: 1. Defining two scalar quantizers with different reconstruction levels; 2. Defining the conversion method between the two scalar quantizers.

[0034] Figure 1A A schematic diagram of the quantization rules for two quantizers Q0 and Q1 in dependency scalar quantization is shown, as follows: Figure 1A As shown, the letters above the circles or dots indicate the quantization state, and the values ​​below the circles or dots indicate the quantization values. The dots or circles in the first row correspond to quantizer Q0, and the dots or circles in the second row correspond to quantizer Q1. The values ​​in the horizontal axis (e.g., -9, -8, 0, 8, 9, etc.) represent the quantization positions, and "△" represents the quantization step size. The product of any quantization position and the quantization step size represents the reconstructed value corresponding to that quantization position. That is, the product of any quantization position and the quantization step size represents the reconstructed value corresponding to the quantization value at that quantization position. For example, the quantization position of the quantization value "-4" under quantization state A is "-8", then the reconstructed value corresponding to that quantization position is "-8△".

[0035] The transition between the two scalar quantizers Q0 and Q1 is implemented by a state machine with four states. Figure 1B A schematic diagram illustrating a quantization state transition process is shown. Figure 1B The arrows in the diagram indicate the direction of quantization state transition. The starting point of the arrow indicates the first quantization state, and the ending point indicates the second quantization state. This means the quantization state transition is from the first quantization state to the second quantization state. The second quantization state is the next quantization state after the first quantization state, and the first quantization state is the previous quantization state. In other words, the second quantization state appears later than the first quantization state. It should be noted that the first and second quantization states can be the same quantization state, or they can be different quantization states. For example, if the first quantization state is quantization state 0, the second quantization state after the transition is still quantization state 0; or, if the first quantization state is quantization state 0, the second quantization state after the transition is quantization state 2. Figure 1B In the state transition diagram shown, the second quantization state can be determined based on the parity of the quantization value in the first quantization state and the state of parity of the quantization value in the first quantization state. "(k&1)==1" indicates that the quantization value is odd, and "(k&1)==0" indicates that the quantization value is even.

[0036] Figure 1C This is a schematic diagram illustrating the state transitions of multiple coefficients in VVC. Figure 1CThe quantization state transition process shown can be found in Table 1. As shown in Table 1, taking quantization state 0 as the first quantization state, if the quantization value under quantization state 0 is even, that is, "(k&1)==0" is true, then the second quantization state can be determined to still be quantization state 0; if the quantization value under quantization state 0 is odd, that is, "(k&1)==1" is true, then the second quantization state can be determined to be quantization state 2. Figure 1B As shown, quantization states 0 and 1 use the Q0 quantizer, while quantization states 2 and 3 use the Q1 quantizer.

[0037] Figure 1A Quantized states A, B, C, D and Figure 1B The quantization states 0, 1, 2, and 3 in Table 1 have different correspondences. For example, A corresponds to 0, B corresponds to 1, C corresponds to 2, and D corresponds to 3; for example, A corresponds to 0, B corresponds to 1, C corresponds to 3, and D corresponds to 2; for example, A corresponds to 1, B corresponds to 0, C corresponds to 2, and D corresponds to 3; for example, A corresponds to 1, B corresponds to 0, C corresponds to 3, and D corresponds to 2.

[0038] Table 1. State transition table in VVC based on the parity of a previous coefficient k.

[0039] Figure 1C Each column in the table represents the quantization state selection for a coefficient. D0, D1, D2, and D3 correspond to paths 0, 1, 2, and 3 in Table 1, respectively. Each coefficient has four quantization states, and each quantization state has two quantization paths leading to the next coefficient's quantization state. Therefore, there are a total of eight different quantization paths from the current coefficient to the next coefficient, and multiple quantization paths from the first coefficient to the last coefficient.

[0040] Unlike DQ's dependent quantization, RDOQ quantizes each coefficient independently. When a quantization coefficient is not zero, it is fine-tuned, typically by decreasing the current quantization coefficient by 1 (if the current quantization coefficient is 2, then the candidates are 0, 1, and 2). Then, the rate distortion loss of different quantization coefficients is compared, and finally, the quantization coefficient with the smallest rate distortion loss is selected.

[0041] Assume W is the coefficient value before quantization, and k is the coefficient value after quantization (quantized value). To reconstruct the numerical values, the rate distortion loss is calculated as shown in Equation (1-1): Rate Distortion cost = + (1-1); in For the given parameters, Let represent the rate loss required for coding coefficient k, and D represent the distortion loss, which can be calculated using the squared error shown in formula (1-2): (1-2); Both DQ and RDOQ can only be used at a fixed rate in related technologies. However, in different environments, such as different transform blocks, different quantization parameters (QP), and different video resolutions, using the same threshold or the same quantization tool may not achieve optimal results. Therefore, this application provides a quantization method that can set different thresholds for determining the initial quantization position and use different quantization tools according to different environments, thereby improving overall performance and quantization efficiency.

[0042] The following describes exemplary applications of the computer device provided in the embodiments of this application. The computer device provided in the embodiments of this application can be implemented as various types of user terminals such as laptops, tablets, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), smart TVs, and smart vehicle terminals, or it can be implemented as a server. The following will describe exemplary applications when the device is implemented as a terminal.

[0043] See Figure 2 , Figure 2 This is a schematic diagram of the network architecture of the video coding and quantization system 100 provided in the embodiments of this application, as shown below. Figure 2 As shown, the network architecture includes: server 200, network 300 and terminal 400, wherein terminal 400 is connected to server 200 through network 300. Network 300 can be a wide area network or a local area network, or a combination of both.

[0044] The terminal 400 is equipped with an image acquisition device, such as a camera, through which the terminal can acquire images. Various applications (Apps) can be installed on the terminal 400, such as instant messaging Apps, live streaming Apps, shopping Apps, etc. In this embodiment, the example of the terminal 400 using its installed live streaming App for live streaming will be used for illustration.

[0045] When a user starts a live stream via terminal 400, terminal 400 activates an image acquisition device to acquire images. After acquiring the acquired video data, terminal 400 acquires each video frame to be encoded and performs block processing on the video frames to be encoded. After block processing, each block undergoes transformation processing, which may be a discrete cosine transform, to obtain the transformation coefficients of each block. Before quantization, the quantization method is determined based on the frame attribute information of the video frames to be encoded. In this embodiment, the frame attribute information may be the type of video frame or the resolution of the video frame, and the quantization method may be dependent quantization or independent quantization. After determining the quantization method, the transformation coefficients of each block are quantized to obtain the quantization result. Then, encoding processing is performed to obtain the final compressed video encoding result. Finally, terminal 400 sends the video encoding result (i.e., the live stream) to server 200 via network 300. Server 200 can then send the live stream to other terminals watching the live stream. Figure 2 (Not shown) Other terminals watching the live stream can decode the live stream data stream using the decoding method corresponding to the video encoding to obtain the video data to be played and then play it.

[0046] In some embodiments, server 200 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Terminal 400 may be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, etc., but is not limited thereto. Terminals and servers can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.

[0047] See Figure 3 , Figure 3 This is a schematic diagram of the structure of the terminal 400 provided in the embodiment of this application. Figure 3 The terminal 400 shown includes at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in the terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 3 The general labeled all buses as Bus System 440.

[0048] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0049] User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0050] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.

[0051] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.

[0052] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.

[0053] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks; The network communication module 452 is used to reach other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc. Presentation module 453 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 associated with user interface 430 (e.g., a display screen, a speaker, etc.). The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432. In some embodiments, the apparatus provided in this application can be implemented in software. Figure 3 A video encoding and quantization device 455 stored in memory 450 is shown. This device can be software in the form of programs and plug-ins, and includes the following software modules: a block transformation module 4551, a first acquisition module 4552, a first determination module 4553, and a quantization module 4554. These modules are logically connected and can therefore be arbitrarily combined or further divided according to their implemented functions. The functions of each module will be described below.

[0054] In other embodiments, the apparatus provided in this application can be implemented in hardware. As an example, the apparatus provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the video encoding quantization method provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0055] In some embodiments, the terminal or server can implement the video encoding and quantization method provided in this application by running a computer program. For example, the computer program can be a native program or software module in an operating system; it can be a native application (APP), that is, a program that needs to be installed in the operating system to run, such as a live streaming APP or an instant messaging APP; it can also be a mini-program, that is, a program that only needs to be downloaded into a browser environment to run; or it can be a mini-program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module or plugin.

[0056] The video coding quantization method provided in this application will be described in conjunction with exemplary applications and implementations of the terminals provided in the embodiments of this application.

[0057] See Figure 4 , Figure 4This is a flowchart illustrating the video coding quantization method provided in the embodiments of this application, which will be combined with... Figure 4 The steps shown are explained.

[0058] Step S101: Obtain the video frame to be encoded, and perform block segmentation and transformation processing on the video frame to be encoded to obtain the transformed video frame data.

[0059] In implementing this step, the color space corresponding to the video frame to be encoded is first determined. If the video frame to be encoded corresponds to the Red Green Blue (RGB) color space, then the video frame to be encoded is converted to the YUV color space. If the video frame to be encoded corresponds to the YUV color space, then the video frame to be encoded can be directly segmented and transformed. That is to say, in this embodiment of the application, the video frame to be encoded in the YUV color space is segmented and transformed.

[0060] When segmenting a video frame to be encoded, it can be divided into multiple image blocks of the same size or into multiple image blocks of different sizes. Image blocks can be rectangular or square. When transforming each image block, the luminance and chrominance components are transformed separately, for example, through discrete cosine transform, to obtain the transformed video data.

[0061] In this embodiment of the application, the transformed video data includes the chromaticity coefficients and luminance coefficients corresponding to each image block.

[0062] Step S102: Obtain the frame attribute information of the video frame to be encoded.

[0063] In this embodiment, the frame attribute information of a video frame may include resolution, size information, frame type, etc. The frame type here may include keyframes and non-keyframes. Keyframes are also called intra-predicted frames (I-frames), while non-keyframes may be inter-predicted frames (e.g., P-frames and B-frames). A keyframe is an independent frame containing all its own information and does not require reference to other video frames. Non-keyframes are not independent frames and require reference to other video frames. For example, a P-frame requires reference to the preceding video frame, while a B-frame can reference either the preceding or following video frame, or both simultaneously.

[0064] Step S103: Determine the quantization method of the video frame to be encoded based on the frame attribute information of the video frame to be encoded.

[0065] The quantization method is either dependent quantization or independent quantization. Dependent quantization relies on previous quantization results for the current coefficient to be quantized, while independent quantization does not. In other words, dependent quantization means that when quantizing the current chromaticity or luminance coefficient, it depends on the previous quantized chromaticity or luminance coefficient. Independent quantization means that each chromaticity or luminance coefficient is quantized independently, without relying on other chromaticity or luminance coefficients.

[0066] When implementing this step, the quantization method can be determined by the resolution. For example, a dependent quantization method is used for higher resolutions, and an independent quantization method is used for lower resolutions. In some embodiments, the quantization method can also be determined by the frame type. For example, an independent quantization method is used for key frames, and a dependent quantization method is used for non-key frames.

[0067] Step S104: Based on the quantization method of the video frame to be encoded, the transformed video frame data is quantized to obtain the quantization result.

[0068] Since the transformed video frame data includes chroma coefficients and luminance coefficients corresponding to multiple image blocks, this step can be implemented by quantizing the chroma coefficients and luminance coefficients of each image block separately based on the quantization method of the video frame to be encoded. The corresponding quantization results include chroma quantization results and luminance quantization results.

[0069] In the embodiments of this application, a quantization method may correspond to one quantization algorithm or multiple quantization algorithms. When a quantization method corresponds to one quantization algorithm, the quantization algorithm can be used directly for quantization. When a quantization method corresponds to at least two quantization algorithms, one can be randomly selected, or it can be determined based on the amount of luminance coefficient or chrominance coefficient data in the transformed video frame data. For example, when the amount of data is large, a quantization algorithm with high computational efficiency but slightly poor quantization effect can be selected, and when the amount of data is small, a quantization algorithm with slightly lower computational efficiency but good quantization effect can be selected.

[0070] When the quantization method is dependent quantization, assuming the quantization algorithm is the DQ algorithm, the quantizer used for chrominance coefficients will be explained as an example. In the DQ algorithm, the quantizer used for the currently quantized chrominance coefficient depends on the quantization result of at least one chrominance coefficient preceding the currently quantized chrominance coefficient. Therefore, the chrominance coefficients must be reconstructed in a predefined order. The selection of the quantizer in this grid-encoded quantization can be achieved through methods such as... Figure 1B The state transition process is specified as shown, such as Figure 1BAs shown, the current state of the chromaticity coefficients uniquely determines the quantizer (Q0, Q1) used; in the reconstruction sequence, the state of the next chromaticity coefficient is determined by the current state and the parity of the current quantization parameter.

[0071] When the quantization method is independent quantization, assuming the quantization algorithm is the RDOQ algorithm, taking the quantization of the luminance coefficient as an example, when the luminance coefficient to be quantized is not 0, firstly, the three optional quantization values ​​corresponding to the luminance coefficient are determined, then the rate distortion loss of different optional quantization values ​​is compared, and finally the quantization value with the smallest rate distortion loss is selected as the quantization result of the luminance coefficient.

[0072] It should be noted that the DQ quantization algorithm used in the dependency quantization method and the RDOQ algorithm used in the independence quantization method are illustrative examples. In practical applications, different dependency quantization algorithms or different independence quantization algorithms may be used, and this application does not limit the specific implementation.

[0073] In the video encoding method provided in this application embodiment, after obtaining the video frame to be encoded, the video frame to be encoded is first divided into blocks and transformed to obtain transformed video frame data; then, the frame attribute information of the video frame to be encoded is obtained; then, the quantization method of the video frame to be encoded is determined based on the frame attribute information of the video frame to be encoded. The quantization method is one of dependent quantization and independent quantization, wherein dependent quantization depends on the quantization results before the current quantization coefficient, and independent quantization does not depend on the quantization results before the current quantization coefficient; and the transformed video frame data is quantized based on the quantization method of the video frame to be encoded to obtain the quantization result. In this way, when quantizing each video frame, the quantization method can be flexibly determined based on the frame attributes, thereby making the matching degree between the quantization method and the video frame higher. This not only improves the flexibility of the quantization method, but also improves the encoding efficiency and performance.

[0074] In some embodiments, after step S104, steps S105 and S106 may also be performed to complete the video encoding process: Step S105: Encode the quantization results of multiple frames to be encoded in the video to be encoded to obtain encoded video data.

[0075] In step S105, the quantization result is encoded, that is, the quantization result is converted into binary to obtain the encoded video data.

[0076] Step S106: Store or output the encoded video data.

[0077] Storing the encoded video data means storing the encoded video data in the terminal's own storage space. Because quantization and encoding are performed before storage, the space occupied is significantly reduced compared to the original video data. Outputting the encoded video data can be done by playing it on the terminal's own display screen, or by sending it to a server for storage, or by having the server send it to other terminals. Similarly, quantization and encoding reduce the size of the video data, thereby improving transmission efficiency.

[0078] In some embodiments, the frame attribute information of the video frame to be encoded can be resolution or frame type. Correspondingly, the above step S103, "determine the quantization method of the video frame to be encoded based on the frame attribute information of the video frame to be encoded," has at least two implementation methods: First, the frame type is determined, which can be achieved through the following steps: Step S1031A: Based on the frame attribute information of each video frame to be encoded, obtain the frame type of the video frame to be encoded.

[0079] The frame types here can include keyframes and non-keyframes. Keyframes are also called intra-predicted frames (I-frames), while non-keyframes can be inter-predicted frames (such as P-frames and B-frames). A keyframe is an independent frame containing all its own information and does not require reference to other video frames. Non-keyframes are not independent frames and require reference to other video frames.

[0080] Step S1032A: Determine the quantization parameters of the video to be encoded based on the frame type.

[0081] In this embodiment, different quantization parameters can be preset for different frame types. The quantization parameter (QP) is the sequence number of the quantization step. For luma encoding, there are 52 quantization step values, and the corresponding QP values ​​range from 0 to 51. For chroma encoding, there are 40 quantization step values, and the QP values ​​range from 0 to 39.

[0082] Quantization parameters reflect the degree of spatial detail compression. Smaller quantization parameters result in finer quantization, higher image quality, and a longer bitstream. Larger quantization parameters result in coarser quantization, leading to the loss of some image details, a lower bitrate, but also increased image distortion and reduced quality.

[0083] Step S1033A: Based on the quantization parameters, determine the quantization method of the video to be encoded.

[0084] In step S1033A, it can be determined whether the quantization parameter is greater than a preset first parameter threshold, which is a positive integer, such as 22, 27, 32, etc. When the quantization parameter is less than or equal to the first parameter threshold, there are many non-zero coefficients in the chroma block data or luma block data. If a dependent quantization method is used, the quantization of each coefficient depends on the information of the previous coefficient. Therefore, when there are many non-zero coefficients, the computational load will increase dramatically. Thus, the quantization method of the video to be encoded is determined to be independent quantization. When the quantization parameter is greater than the first parameter threshold, there are few non-zero coefficients in the chroma block data or luma block data. In this case, the quantization method of the video to be encoded is determined to be dependent quantization, which improves the quantization effect while ensuring that the increase in data volume is not large.

[0085] Second, determine the quantization method based on the resolution, which can be achieved through the following steps: Step S1031B: Based on the frame attribute information of each video frame to be encoded, obtain the resolution of the video frame to be encoded.

[0086] The resolution of a video frame can characterize the amount of information stored in the video frame. It is expressed as the number of pixels per inch of the image. In practical applications, the resolution of an image is generally represented by A*B, where A is the number of horizontal pixels and B is the number of vertical pixels. The higher the resolution, the better the image details can be displayed.

[0087] Step S1032B: Determine whether the resolution of the video frame to be encoded is greater than the resolution threshold.

[0088] Since image resolution is typically represented by A*B, determining whether the resolution of a video frame to be encoded is greater than a resolution threshold can be done by checking whether A*B is greater than the resolution threshold. In some embodiments, there can be two resolution thresholds: a horizontal threshold and a vertical threshold. When determining whether the resolution of the video frame to be encoded is greater than the resolution threshold, it is determined whether the number of horizontal pixels is greater than the horizontal threshold and whether the number of vertical pixels is greater than the vertical threshold. If both the horizontal and vertical pixel counts are greater than the horizontal and vertical thresholds, then the resolution of the video frame to be encoded is determined to be greater than the resolution threshold.

[0089] When the resolution is greater than the resolution threshold, proceed to step S1033B; when the resolution is less than or equal to the resolution threshold, proceed to step S1034B.

[0090] Step S1033B: The quantization method of the video to be encoded is determined to be dependency quantization.

[0091] In this embodiment of the application, when the resolution is greater than the resolution threshold, it indicates that the resolution of the video frame is high. At this time, by using dependency quantization, high-efficiency quantization can be achieved while ensuring that the image quality is not damaged to a large extent.

[0092] Step S1034B: The quantization method of the video to be encoded is determined to be independent quantization.

[0093] In the embodiments of this application, when the resolution is less than or equal to the resolution threshold, it indicates that the resolution of the video frame is low. At this time, independent quantization can be used to ensure high quantization efficiency.

[0094] In some embodiments, the transformed video frame data includes multiple chroma block data and multiple luma block data. When the quantization method is dependent quantization, the above step S104, "quantizing the transformed video frame data based on the quantization method of the video frame to be encoded to obtain the quantization result," can be implemented through the following steps: Step S1041: Determine the chromaticity quantization threshold of each chromaticity block, and determine the initial quantization position of each chromaticity block based on the chromaticity quantization threshold of each chromaticity block.

[0095] In this embodiment, the chromaticity quantization threshold of each chromaticity block is dynamically determined based on the size of the chromaticity block, and the chromaticity quantization threshold of a larger chromaticity block is greater than that of a smaller chromaticity block. After dynamically determining the chromaticity quantization threshold of the chromaticity block, the initial quantization position can be further determined based on the chromaticity quantization threshold.

[0096] Step S1042: Determine the brightness quantization threshold of each brightness block, and determine the initial quantization position of each brightness block based on the brightness quantization threshold of each brightness block.

[0097] Similar to step S1041, the chromaticity quantization threshold for each luminance block is dynamically determined based on the size of the luminance block, and the chromaticity quantization threshold for a larger luminance block is greater than the luminance quantization threshold for a smaller chromaticity block. After dynamically determining the luminance quantization threshold of a luminance block, the initial quantization position of that luminance block can be further determined based on this luminance quantization threshold.

[0098] Step S1043: Quantize each chroma block from its initial quantization position according to the dependent quantization method to obtain the chroma quantization result.

[0099] Step S1044: Quantize each luminance block from its initial quantization position according to the dependent quantization method to obtain the luminance quantization result.

[0100] In the embodiments of this application, when quantizing the chroma block or the luminance block, it starts from the initial quantization position determined in the corresponding steps above, and the chroma coefficients or luminance coefficients before the initial quantization position are reset to zero.

[0101] In some embodiments, the above step S1041, "determining the chromaticity quantization threshold of each chromaticity block and determining the initial quantization position of each chromaticity block based on the chromaticity quantization threshold of each chromaticity block," can be achieved through... Figure 5 The steps shown are implemented as follows: Figure 5 Each step is explained.

[0102] Step S411: Determine the size information of each chromaticity block.

[0103] In the embodiments of this application, the size information of a chroma block can be represented by the product of the number of pixels contained in the horizontal direction and the number of pixels contained in the vertical direction of the chroma block. For example, it can be 64*64, 128*64, 32*8, etc.

[0104] Step S412: Determine whether the size information of the chroma block is greater than the size threshold.

[0105] The size threshold can be a single value, such as 2048. Determining whether the size information of a chroma block is greater than this size threshold can be done by determining whether the product of the horizontal and vertical pixel counts of the chroma block is greater than the size threshold. In some embodiments, the size threshold can also be two values, namely a horizontal size threshold and a vertical size threshold. This step can be implemented by determining whether the horizontal pixel count of the chroma block is greater than the horizontal size threshold and whether the vertical pixel count is greater than the vertical size threshold. Only when both the horizontal and vertical pixel counts are greater than the horizontal and vertical size thresholds is the size information of the chroma block determined to be greater than the size threshold.

[0106] When the size information of the chroma block is greater than the size threshold, proceed to step S413; when the size information of the chroma block is less than or equal to the size threshold, proceed to step S414.

[0107] Step S413: Determine the first chromaticity threshold as the chromaticity quantization threshold of the chromaticity block.

[0108] In actual implementation, a chromaticity reference threshold and at least two chromaticity weights can be preset. The product of the chromaticity reference threshold and the first chromaticity weight can be determined as the first chromaticity threshold, and the first chromaticity weight can be a real number greater than 1.

[0109] Step S414: Determine the second chromaticity threshold as the chromaticity quantization threshold of the chromaticity block.

[0110] Since larger chroma blocks have more non-zero coefficients than smaller chroma blocks, a larger chroma threshold is used for larger chroma blocks, and a smaller chroma threshold is used for smaller chroma blocks. That is, the first chroma threshold is greater than the second chroma threshold. This can reduce the number of quantization coefficients for larger chroma blocks and improve quantization efficiency.

[0111] Step S415: Scan each chromaticity coefficient in the chromaticity block from the first vertex along the diagonal direction.

[0112] In this embodiment, any vertex of the first vertex chroma block can be, for example, the lower right corner or the upper left corner of the chroma block. The direction of the diagonal can be as follows: Figure 7 direction shown.

[0113] Step S416: When a first target position in the chromaticity block with a chromaticity coefficient greater than the second parameter threshold is detected, the first target position is determined as the initial quantization position of the chromaticity block.

[0114] Here, each chromaticity coefficient in the chromaticity block is scanned sequentially from the first vertex of the chromaticity block along the diagonal direction. In implementation, each chromaticity coefficient in the chromaticity block is compared with the second parameter threshold one by one from the first vertex of the chromaticity block along the diagonal direction. When the first target position where the chromaticity coefficient is greater than the second parameter threshold is determined, the first target position is determined as the initial quantization position of the chromaticity block.

[0115] Through steps S411 to S416 above, the quantization threshold of each chroma block is dynamically determined based on the size of the chroma block. The quantization threshold of the larger chroma block is greater than that of the smaller chroma block. This reduces the number of quantization coefficients of the larger chroma block and improves quantization efficiency. After dynamically determining the quantization threshold of the chroma block, the initial quantization position of different chroma blocks can be further dynamically determined based on the quantization threshold, thereby achieving better quantization performance.

[0116] Similar to step S1041, step S1042, "determining the brightness quantization threshold of each brightness block and determining the initial quantization position of each brightness block based on the brightness quantization threshold of each brightness block," can be achieved through the following steps: Step S421: Determine the size information of each brightness block.

[0117] Step S422: Determine whether the size information of the brightness block is greater than the size threshold.

[0118] When the size information of the luminance block is greater than the size threshold, proceed to step S423; when the size information of the luminance block is less than or equal to the size threshold, proceed to step S424.

[0119] Step S423: The first luminance threshold is determined as the chromaticity threshold of the luminance block.

[0120] Step S424: The second luminance threshold is determined as the chromaticity quantization threshold of the luminance block.

[0121] Wherein, the first brightness threshold is greater than the second brightness threshold.

[0122] Step S425: Scan each brightness coefficient in the brightness block from the first vertex along the opposite diagonal direction.

[0123] Step S426: When a second target position in the brightness block with a brightness coefficient greater than the second parameter threshold is detected, the second target position is determined as the initial quantization position of the brightness block.

[0124] It should be noted that the implementation process of steps S421 to S426 is similar to that of steps S411 to S426. In actual implementation, the implementation process of steps S411 to S416 can be referred to.

[0125] Based on the foregoing embodiments, this application further provides a video coding quantization method, applied to... Figure 2 The network architecture shown is Figure 6 This is a schematic diagram illustrating another implementation process of the video coding quantization method provided in the embodiments of this application. The following is in conjunction with... Figure 6 Each step is explained.

[0126] In step S601, in response to the operation command to start the live streaming App, the live streaming window of the live streaming service is presented on the user terminal, and the settings of the broadcaster user for the live streaming service to be initialized are received.

[0127] In this embodiment, the live streaming window before the live streaming service is initialized is used to receive information such as the name and notes of the new live streaming service added by the streamer in the streamer's live streaming room, so that the streamer can find it later.

[0128] In step S602, the user terminal sends live streaming service initialization data to the server.

[0129] Here, the broadcaster terminal submits the identifiers of the live streaming room to be established and the broadcaster user's identifier to the server to initialize the live streaming service.

[0130] In step S603, the user terminal responds to the operation command to start live streaming by activating the image acquisition device and acquiring image data.

[0131] Here, when the user terminal receives the command to start the live broadcast, it can turn on its own image acquisition device. In this step, it can be the front-facing camera of the user terminal, and image data can be acquired through the image acquisition device.

[0132] In step S604, the user terminal determines the acquired image data as video frames to be encoded.

[0133] In step S605, the user terminal performs block segmentation and transformation processing on the video frame to be encoded to obtain the transformed video frame data.

[0134] Step S606: The user terminal obtains the frame type of the video frame to be encoded.

[0135] Here, the frame type of the video frame to be encoded can be a key frame or a non-key frame, or it can be an I-frame, P-frame, or B-frame, etc.

[0136] Step S607: The user terminal determines the quantization parameters of the video to be encoded based on the frame type.

[0137] Different frame types correspond to different quantization parameters. Once the frame type of the video frame to be encoded is determined, the corresponding quantization parameters can be determined based on that frame type. The quantization parameter is positively correlated with the compression ratio; that is, the smaller the quantization parameter, the smaller the corresponding compression ratio, and the larger the quantization parameter, the higher the corresponding compression ratio.

[0138] Step S608: The user terminal determines the quantization method of the video to be encoded based on the quantization parameters.

[0139] Specifically, when the quantization parameter is greater than the first parameter threshold, the quantization method of the video to be encoded is determined to be dependent quantization; when the quantization parameter is less than or equal to the first parameter threshold, the quantization method of the video to be encoded is determined to be independent quantization.

[0140] Step S609: The user terminal performs quantization processing on the transformed video frame data based on the quantization method of the video frame to be encoded, and obtains the quantization result.

[0141] The transformed video frame data includes multiple chroma blocks and multiple luma blocks, where the chroma blocks contain multiple chroma coefficients and the luma blocks contain multiple luma coefficients.

[0142] For dependency quantization, when quantizing a chroma block, it's necessary to determine the chroma quantization threshold based on the block's size information. Then, based on this threshold, the initial quantization position of the chroma block is determined. Finally, the chroma coefficients within the block are quantized from this initial position. During quantization, except for the first chroma coefficient, quantizing other chroma coefficients depends on the quantization results of previous chroma coefficients. Similarly, when quantizing a luminance block, it's also necessary to determine the luminance quantization threshold based on its size information. Then, based on this threshold, the initial quantization position of the luminance block is determined. Finally, the chroma coefficients within the block are quantized from this initial position.

[0143] If it is independent quantization, then each chroma coefficient needs to be quantized independently from the vertex position of the chroma block. The quantization of the luma block is similar, and each luma coefficient is quantized independently from the vertex position.

[0144] In step S610, the user terminal encodes the quantization results of multiple frames to be encoded in the video to be encoded, and obtains the encoded video data.

[0145] This step involves encoding the quantization results, which means converting the quantization results into binary data to obtain the encoded video data.

[0146] In step S611, the user terminal sends the encoded video data to the server.

[0147] In step S612, the server sends the encoded video data to other terminals watching the live stream.

[0148] In the video encoding quantization method provided in this application embodiment, when a user terminal needs to conduct live streaming, it first sets the initialization data for the live streaming service and starts the live stream, turns on the camera to capture images, and determines the captured images as video frames to be encoded. Then, it obtains the frame type of the video frame to be encoded, determines the quantization parameters based on the frame type, and determines the quantization method based on the quantization parameters. When the quantization parameters are greater than a first parameter threshold, dependent quantization is used; when the quantization parameters are less than or equal to the first parameter threshold, independent quantization is used. This allows for flexible determination of the appropriate quantization method for the video frame to be encoded based on frame attributes, which not only ensures the quantization effect but also improves quantization efficiency. Furthermore, in this application embodiment, if dependent quantization is used, the quantization threshold needs to be dynamically determined based on the size of the chroma block and the luma block, and the initial quantization position is then dynamically determined based on the quantization threshold, thereby further improving the overall encoding performance and encoding efficiency. Afterward, the encoded video data is sent to the server, which not only improves data transmission efficiency but also reduces stuttering during the live stream and improves the live stream effect.

[0149] This application provides a video encoding quantization method that can select different quantization tools for different frames and set different initial quantization thresholds for different transform blocks.

[0150] In related technologies, DQ quantization is used in VVC, while RDOQ quantization is used in HEVC. Generally, DQ quantization offers higher performance but also higher complexity than RDOQ quantization. Excessive complexity hinders real-time encoding and increases the overhead of industrial encoding processes. Conversely, insufficient performance leads to poor video quality and a negative user experience. Therefore, choosing different encoding methods for different scenarios helps achieve an optimal balance between video performance and complexity. Selecting different quantization tools for different video frames can accelerate the encoder and improve encoding efficiency while maintaining video performance.

[0151] When the QP is small, there are many non-zero coefficients in the transform blocks (including luma and chroma blocks). If a dependent quantization tool (such as DQ) is used, the quantization of each transform coefficient (chroma or luma coefficient) depends on the quantization information of the previous coefficient. Therefore, when there are many non-zero coefficients in the transform block, the computational load increases dramatically. Based on this, in this embodiment, when the QP of the video frame is less than or equal to qp_threshold (corresponding to the first parameter threshold in other embodiments), an independent quantization tool (such as RDOQ) is used; otherwise, an independent quantization tool is used.

[0152] The complexity of the DQ tool varies depending on the video resolution. Using different quantization tools for different scenarios can improve encoding efficiency. In this embodiment, when the resolution of the video frame is less than or equal to kwidth * kheight (corresponding to the size threshold in other embodiments), an independent quantization tool is used; otherwise, a dependent quantization tool is used. Here, qp_threshold, kwidth, and kheight are all positive integers. For example, qp_threshold can be 22, 27, 32, 37, etc.

[0153] In the embodiments of this application, when it is determined to use a dependent quantization tool based on the above process, different initial quantization thresholds and initial quantization positions can be set according to different transform blocks.

[0154] Since the luminance block has more non-zero coefficients than the chrominance block, and larger transform blocks have more non-zero coefficients than smaller transform blocks, choosing different thresholds for different transform blocks is beneficial to improving overall performance. In some embodiments, a transform block is defined as having a width and height greater than kxy when it is considered a larger transform block. The threshold for a larger luminance block is adjusted to threshold*thres_scale1, the threshold for a smaller luminance block is adjusted to threshold*thres_scale2, the threshold for a larger chrominance block is adjusted to threshold*thres_scale3, and the threshold for a smaller chrominance block is adjusted to threshold*thres_scale4. By setting different positions for different transform blocks, better performance and acceleration can be achieved. Here, kxy, threshold_scale1, threshold_scale2, threshold_scale3, and threshold_scale4 are positive numbers. For example, kxy can be 4, 6, 8, 16, 32, etc.; threshold_scale1 can be 1.1, 1.2, 1.3, etc.

[0155] Figure 7 This is a schematic diagram illustrating the determination of the initial quantization position provided in an embodiment of this application, as shown below. Figure 7 As shown, after determining the quantization threshold of the transform block, before quantization, the transform block ( Figure 7 A reverse Z-shaped scan is performed from the lower right corner to the upper left corner of the rectangular dashed box shown in Figure 701. When the scan reaches a transformation coefficient that is greater than the default given threshold (corresponding to the second parameter threshold in other embodiments), the scan is terminated, and the position ( Figure 7 The circular dashed line shown in Figure 702 serves as the initial quantization position, from which dependency quantization and subsequent encoding processes begin.

[0156] Experimental verification shows that the video coding quantization method provided in this application embodiment can improve the encoder speed by 6.9%. Therefore, the video coding quantization method provided in this application embodiment does not increase the computational load of the encoding process or modify the decoding end. It reduces the encoding bitrate and complexity while having almost no impact on video quality, thereby saving encoding time and improving the efficiency of practical applications.

[0157] The following description continues to illustrate the exemplary structure of the video encoding and quantization device 455 provided in the embodiments of this application as a software module. In some embodiments, such as Figure 3 As shown, the software module stored in the video encoding and quantization device 455 in the memory 440 may include: Block transformation module 4551 is used to acquire the video frame to be encoded, perform block transformation on the video frame to be encoded, and obtain the transformed video frame data. The first acquisition module 4552 is used to acquire the frame attribute information of the video frame to be encoded; The first determining module 4553 is used to determine the quantization method of the video frame to be encoded based on the frame attribute information of the video frame to be encoded. The quantization method is one of dependent quantization and independent quantization. Dependent quantization depends on the quantization results before the current quantization coefficient, while independent quantization does not depend on the quantization results before the current quantization coefficient. The quantization module 4554 is used to quantize the transformed video frame data based on the quantization method of the video frame to be encoded, and obtain the quantization result.

[0158] In some embodiments, the first determining module 4553 is further configured to: Based on the frame attribute information of each video frame to be encoded, the frame type of the video frame to be encoded is obtained; Based on the frame type, determine the quantization parameters of the video to be encoded; Based on the quantization parameters, the quantization method of the video to be encoded is determined.

[0159] In some embodiments, the first determining module 4553 is further configured to: When the quantization parameter is greater than the first parameter threshold, the quantization method of the video to be encoded is determined to be dependent quantization; When the quantization parameter is less than or equal to the first parameter threshold, the quantization method of the video to be encoded is determined to be independent quantization.

[0160] In some embodiments, the first determining module 4553 is further configured to: Based on the frame attribute information of each video frame to be encoded, the resolution of the video frame to be encoded is obtained; When the resolution is greater than the resolution threshold, the quantization method of the video to be encoded is determined to be dependent quantization; When the resolution is less than or equal to the resolution threshold, the quantization method of the video to be encoded is determined to be independent quantization.

[0161] In some embodiments, the transformed video frame data includes multiple chroma block data and multiple luma block data, and the quantization module 4554 is further configured to: When the quantization method is dependent quantization, the chromaticity quantization threshold of each chromaticity block is determined, and the initial quantization position of each chromaticity block is determined based on the chromaticity quantization threshold of each chromaticity block. Determine the brightness quantization threshold of each brightness block, and determine the initial quantization position of each brightness block based on the brightness quantization threshold of each brightness block; The chroma blocks are quantized from their initial quantization positions according to the aforementioned dependency quantization method to obtain the chroma quantization results. The brightness blocks are quantized from their initial quantization positions according to the aforementioned dependency quantization method to obtain the brightness quantization result.

[0162] In some embodiments, the quantization module 4554 is further configured to: Determine the size information of each chromaticity block; When the size information of the chroma block is greater than the size threshold, the first chroma threshold is determined as the chroma quantization threshold of the chroma block; When the size information of the chroma block is less than or equal to the size threshold, the second chroma threshold is determined as the chroma quantization threshold of the chroma block, wherein the first chroma threshold is greater than the second chroma threshold.

[0163] In some embodiments, the quantization module 4554 is further configured to: Scan each chromaticity coefficient in the chromaticity block from the first vertex along the opposite diagonal direction; When a first target position in the chroma block with a chroma coefficient greater than the chroma quantization threshold is detected, the first target position is determined as the initial quantization position of the chroma block.

[0164] In some embodiments, the quantization module 4554 is further configured to: Determine the size information of each brightness block; When the size information of the luminance block is greater than the size threshold, the first luminance threshold is determined as the chromaticity threshold of the luminance block; When the size information of the luminance block is less than or equal to the size threshold, the second luminance threshold is determined as the chromaticity quantification threshold of the luminance block, wherein the first luminance threshold is greater than the second luminance threshold.

[0165] In some embodiments, the quantization module 4554 is further configured to: Scan each brightness coefficient in the brightness block from the first vertex along the opposite diagonal direction; When a second target position in the brightness block with a brightness coefficient greater than the brightness quantization threshold is detected, the second target position is determined as the initial quantization position of the brightness block.

[0166] In some embodiments, the device further includes: The encoding module is used to encode the quantization results of multiple frames in the video to be encoded, so as to obtain the encoded video data. The post-processing module is used to store or output the encoded video data.

[0167] It should be noted that the descriptions of the above video coding quantization apparatus embodiments are similar to the method descriptions above, and have the same beneficial effects as the method embodiments. For technical details not disclosed in the video coding quantization apparatus embodiments of this application, those skilled in the art should refer to the descriptions of the method embodiments of this application for understanding.

[0168] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the video coding quantization method described in this application.

[0169] This application provides a computer-readable storage medium storing executable instructions. When these executable instructions are executed by a processor, they cause the processor to execute the video coding quantization method provided in this application. For example, ... Figure 4 , Figure 5 and Figure 6 The video encoding quantization method is shown.

[0170] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.

[0171] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0172] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).

[0173] As an example, executable instructions can be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.

[0174] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.

Claims

1. A video coding quantization method, characterized in that, The method includes: A video frame to be encoded is acquired, and the video frame to be encoded is divided into blocks and transformed to obtain transformed video frame data, wherein the transformed video frame data includes multiple chroma block data and multiple luma block data. Obtain the frame attribute information of the video frame to be encoded; Based on the frame attribute information of the video frame to be encoded, the resolution of the video frame to be encoded is obtained; The quantization method of the video frame to be encoded is determined. The quantization method is either dependent quantization or independent quantization. Dependent quantization depends on the quantization results before the current quantization coefficient, while independent quantization does not depend on the quantization results before the current quantization coefficient. When the resolution is greater than the resolution threshold, the quantization method of the video frame to be encoded is determined to be dependent quantization, and when the resolution is less than or equal to the resolution threshold, the quantization method of the video frame to be encoded is determined to be independent quantization. Based on the quantization method of the video frame to be encoded, the transformed video frame data is quantized from the initial quantization positions corresponding to the chroma block and the luma block, respectively, to obtain the quantization result; Wherein, when the quantization method is dependent quantization, the initial quantization position of each chroma block is determined based on the chroma quantization threshold of each chroma block, and the initial quantization position of each luminance block is determined based on the luminance quantization threshold of each luminance block. When the size information of the chroma block is greater than the size threshold, the chroma quantization threshold of the chroma block is the first chroma threshold. When the size information of the chroma block is less than or equal to the size threshold, the chroma quantization threshold of the chroma block is the second chroma threshold, and the first chroma threshold is greater than the second chroma threshold.

2. The method according to claim 1, characterized in that, The determination of the quantization method for the video frame to be encoded includes: Based on the frame attribute information of each of the video frames to be encoded, the frame type of the video frame to be encoded is obtained; Based on the frame type, determine the quantization parameters of the video frame to be encoded; Based on the quantization parameters, the quantization method of the video frame to be encoded is determined.

3. The method according to claim 2, characterized in that, Determining the quantization method of the video frame to be encoded based on the quantization parameters includes: When the quantization parameter is greater than the first parameter threshold, the quantization method of the video frame to be encoded is determined to be dependent quantization; When the quantization parameter is less than or equal to the first parameter threshold, the quantization method of the video frame to be encoded is determined to be independent quantization.

4. The method according to claim 1, characterized in that, The quantization method based on the video frame to be encoded involves quantizing the transformed video frame data from the initial quantization positions corresponding to the chroma block and the luma block, respectively, to obtain the quantization result, including: When the quantization method is dependent quantization, the chromaticity quantization threshold of each chromaticity block is determined, and the initial quantization position of each chromaticity block is determined based on the chromaticity quantization threshold of each chromaticity block. Determine the brightness quantization threshold of each brightness block, and determine the initial quantization position of each brightness block based on the brightness quantization threshold of each brightness block; The chroma blocks are quantized from their initial quantization positions according to the aforementioned dependency quantization method to obtain the chroma quantization results. The brightness blocks are quantized from their initial quantization positions according to the aforementioned dependency quantization method to obtain the brightness quantization result.

5. The method according to claim 4, characterized in that, Determining the initial quantization position of each chroma block based on its chroma quantization threshold includes: Scan each chromaticity coefficient in the chromaticity block from the first vertex along the opposite diagonal direction; When a first target position in the chroma block with a chroma coefficient greater than the second parameter threshold is detected, the first target position is determined as the initial quantization position of the chroma block.

6. The method according to claim 4, characterized in that, Determining the brightness quantization threshold for each brightness block includes: Determine the size information of each brightness block; When the size information of the brightness block is greater than the size threshold, the first brightness threshold is determined as the brightness quantization threshold of the brightness block; When the size information of the brightness block is less than or equal to the size threshold, the second brightness threshold is determined as the brightness quantization threshold of the brightness block, wherein the first brightness threshold is greater than the second brightness threshold.

7. The method according to claim 4, characterized in that, Determining the initial quantization position of each brightness block based on the brightness quantization threshold of each brightness block includes: Scan each brightness coefficient in the brightness block from the first vertex along the opposite diagonal direction; When a second target position in the brightness block with a brightness coefficient greater than the second parameter threshold is detected, the second target position is determined as the initial quantization position of the brightness block.

8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: The quantization results of multiple video frames to be encoded are encoded to obtain encoded video data; Store or output the encoded video data.

9. A video encoding quantization device, characterized in that, The device includes: The block transformation module is used to acquire the video frame to be encoded, and to perform block transformation processing on the video frame to be encoded to obtain the transformed video frame data, wherein the transformed video frame data includes multiple chroma block data and multiple luma block data. The first acquisition module is used to acquire the frame attribute information of the video frame to be encoded; The first determining module is used to obtain the resolution of the video frame to be encoded based on the frame attribute information of the video frame to be encoded; and to determine the quantization method of the video frame to be encoded, wherein the quantization method is one of dependent quantization and independent quantization, wherein dependent quantization depends on the quantization results before the current quantization coefficient, and independent quantization does not depend on the quantization results before the current quantization coefficient. The quantization module is used to determine the quantization method of the video frame to be encoded as dependent quantization when the resolution is greater than the resolution threshold, and to determine the quantization method of the video frame to be encoded as independent quantization when the resolution is less than or equal to the resolution threshold. Based on the quantization method of the video frame to be encoded, the transformed video frame data is quantized from the initial quantization positions corresponding to the chroma block and the luma block, respectively, to obtain the quantization result; Wherein, when the quantization method is dependent quantization, the initial quantization position of each chroma block is determined based on the chroma quantization threshold of each chroma block, and the initial quantization position of each luminance block is determined based on the luminance quantization threshold of each luminance block. When the size information of the chroma block is greater than the size threshold, the chroma quantization threshold of the chroma block is the first chroma threshold. When the size information of the chroma block is less than or equal to the size threshold, the chroma quantization threshold of the chroma block is the second chroma threshold, and the first chroma threshold is greater than the second chroma threshold.

10. The apparatus according to claim 9, characterized in that, The device includes: The first determining module is further configured to determine the quantization method of the video frame to be encoded as dependent quantization when the quantization parameter is greater than the first parameter threshold. When the quantization parameter is less than or equal to the first parameter threshold, the quantization method of the video frame to be encoded is determined to be independent quantization.

11. The apparatus according to claim 9, characterized in that, The device includes: The quantization module is further configured to quantize each chroma block from its initial quantization position according to the dependent quantization method, and obtain the chroma quantization result. The brightness blocks are quantized from their initial quantization positions according to the aforementioned dependency quantization method to obtain the brightness quantization result.

12. The apparatus according to claim 11, characterized in that, The device includes: The quantization module is also used to scan each chromaticity coefficient in the chromaticity block from the first vertex of the chromaticity block along the opposite diagonal direction; When a first target position in the chroma block with a chroma coefficient greater than the second parameter threshold is detected, the first target position is determined as the initial quantization position of the chroma block.

13. The apparatus according to claim 11, characterized in that, The device includes: The quantization module is also used to determine the size information of each brightness block; When the size information of the brightness block is greater than the size threshold, the first brightness threshold is determined as the brightness quantization threshold of the brightness block; When the size information of the brightness block is less than or equal to the size threshold, the second brightness threshold is determined as the brightness quantization threshold of the brightness block, wherein the first brightness threshold is greater than the second brightness threshold.

14. A computer device, characterized in that, The computer device includes: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the method according to any one of claims 1 to 8.

15. A computer-readable storage medium storing executable instructions, characterized in that, When the executable instructions are executed by the processor, they implement the method described in any one of claims 1 to 8.

16. A computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the method described in any one of claims 1 to 8.