A method and apparatus for video coding

CN122970263APending Publication Date: 2026-10-23T-HEAD (SHANGHAI) SEMICON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610759770.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-28
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

[0003]现有技术中,采用自适应量化(Adaptive Quantization,AQ)进行视频编码,上述AQ的目标是根据视频内容的局部特性动态调整量化步长,从而在码率受限的条件下优化整体率失真性能;对于方差较大的区域,视为纹理复杂区域,相应增大量化参数(Quantization Parameter,QP)以节省码率;对于方差较小的区域,视为纹理平坦区域,相应减小QP以提升质量,但上述单一的判断方式会导致某些对人眼感受影响较大的区域的失真,导致重建视频的质量较差

Benefits of technology

[0022]本发明实施例中,通过获取目标视频,其中,所述目标视频中包括多帧图像,每帧所述图像中包括多个编码块,每个所述编码块为所述图像中的局部区域;获取每个所述编码块的亮度特征和方差特征;根据所述亮度特征生成亮度掩蔽因子;根据所述亮度掩蔽因子和所述方差特征生成融合特征;根据所述融合特征生成所述编码块的量化参数偏移量;根据所述量化参数偏移量对所述编码块进行编码。通过上述方法,可以在保持编码复杂度基本不变的情况下,显著提升了重建视频的质量。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122970263A_ABST
    Figure CN122970263A_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method and device for video coding. In the embodiment of the present application, a target video is acquired, wherein the target video comprises multiple images, each image comprises multiple coding blocks, and each coding block is a local area in the image; the brightness feature and the variance feature of each coding block are acquired; the brightness masking factor is generated according to the brightness feature; the fusion feature is generated according to the brightness masking factor and the variance feature; the quantization parameter offset of the coding block is generated according to the fusion feature; and the coding block is coded according to the quantization parameter offset. Through the above method, the quality of the reconstructed video can be improved while keeping the coding complexity basically unchanged.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of video processing technology, and more specifically, to a method and apparatus for video encoding. Background Technology

[0002] With the widespread adoption of the High Efficiency Video Coding (HEVC) standard, achieving better video quality at a limited bitrate has become a key research focus.

[0003] In existing technologies, adaptive quantization (AQ) is used for video encoding. The goal of AQ is to dynamically adjust the quantization step size based on the local characteristics of the video content, thereby optimizing the overall rate-distortion performance under bitrate constraints. For regions with large variance, they are considered as regions with complex textures, and the quantization parameter (QP) is increased accordingly to save bitrate. For regions with small variance, they are considered as regions with flat textures, and the QP is decreased accordingly to improve quality. However, the above single judgment method can lead to distortion in some regions that have a greater impact on human visual perception, resulting in poor quality of the reconstructed video.

[0004] In conclusion, the current challenge is to improve the quality of reconstructed videos while maintaining a relatively constant level of coding complexity. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a video encoding method and apparatus that can improve the quality of reconstructed video while keeping the encoding complexity essentially unchanged.

[0006] In a first aspect, embodiments of the present invention provide a video encoding method, the method comprising: acquiring a target video, wherein the target video includes multiple frames of images, each frame of the image includes multiple coded blocks, and each coded block is a local region in the image; acquiring luminance features and variance features of each coded block; generating a luminance masking factor based on the luminance features; generating a fusion feature based on the luminance masking factor and the variance features; generating a quantization parameter offset of the coded block based on the fusion feature; and encoding the coded block based on the quantization parameter offset.

[0007] Optionally, the method further includes: reconstructing the video based on the encoded blocks.

[0008] Optionally, generating a brightness masking factor based on the brightness features specifically includes: generating an average brightness value based on the brightness features; and generating the brightness masking factor based on the average brightness value.

[0009] Optionally, obtaining the variance feature of each coding block specifically includes: obtaining the residual of the coding block and the number of pixels in the coding block to calculate the variance feature.

[0010] Optionally, generating the quantization parameter offset of the coding block based on the fusion feature specifically includes: generating a scaled fusion feature based on the fusion feature; generating an average fusion feature based on the scaled fusion feature; generating an adjusted average fusion feature based on the average fusion feature; and generating the quantization parameter offset based on the scaled fusion feature and the adjusted average fusion feature.

[0011] Optionally, generating the adjusted average fusion feature based on the average fusion feature specifically includes: calculating the average of the squares of the average fusion feature based on the average fusion feature; and calculating the adjusted average fusion feature based on the average fusion feature and the average of the squares of the average fusion feature.

[0012] Optionally, generating the quantization parameter offset based on the scaled fusion feature and the adjusted average fusion feature specifically includes: determining the difference between the scaled fusion feature and the adjusted average fusion feature; and determining the quantization parameter offset by multiplying the difference by the adaptive quantization intensity coefficient.

[0013] Secondly, embodiments of the present invention provide a video encoding apparatus, the apparatus comprising: an acquisition unit, configured to acquire a target video, wherein the target video includes multiple frames of images, each frame of the image includes multiple coded blocks, and each coded block is a local region in the image; the acquisition unit is further configured to acquire luminance features and variance features of each coded block; a generation unit, configured to generate a luminance masking factor based on the luminance features; the generation unit is further configured to generate a fusion feature based on the luminance masking factor and the variance features; the generation unit is further configured to generate a quantization parameter offset of the coded block based on the fusion feature; and an encoding unit, configured to encode the coded block based on the quantization parameter offset.

[0014] Optionally, the apparatus further includes a reconstruction unit for reconstructing the video based on the encoded blocks.

[0015] Optionally, the generation unit is specifically used to: generate an average brightness value based on the brightness features; and generate the brightness masking factor based on the average brightness value.

[0016] Optionally, the acquisition unit is specifically used to: acquire the residual of the coding block and the number of pixels in the coding block to calculate the variance feature.

[0017] Optionally, the generation unit is specifically used to: generate scaled fusion features based on the fusion features; generate average fusion features based on the scaled fusion features; generate adjusted average fusion features based on the average fusion features; and generate the quantization parameter offset based on the scaled fusion features and the adjusted average fusion features.

[0018] Optionally, the generation unit is further configured to: calculate the average of the squares of the average fusion features based on the average fusion features; and calculate the adjusted average fusion features based on the average fusion features and the average of the squares of the average fusion features.

[0019] Optionally, the generation unit is further configured to: determine the difference between the scaled fused feature and the adjusted average fused feature; and determine the product of the difference and the adaptive quantization intensity coefficient as the quantization parameter offset.

[0020] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in the first aspect or any one of the possible methods of the first aspect.

[0021] Fourthly, embodiments of the present invention provide a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the method as described in the first aspect or any one of the possibilities of the first aspect.

[0022] In this embodiment of the invention, a target video is acquired, comprising multiple frames of images, each frame containing multiple coded blocks, each coded block being a local region within the image. The brightness and variance features of each coded block are acquired. A brightness masking factor is generated based on the brightness features. A fusion feature is generated based on the brightness masking factor and the variance feature. A quantization parameter offset for the coded block is generated based on the fusion feature. The coded block is then encoded based on the quantization parameter offset. This method significantly improves the quality of the reconstructed video while maintaining a relatively constant encoding complexity. Attached Figure Description

[0023] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which: Figure 1 This is a flowchart of a video encoding method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a relationship curve in an embodiment of the present invention; Figure 3 This is a flowchart of another video encoding method in an embodiment of the present invention; Figure 4 This is a flowchart of another video encoding method in an embodiment of the present invention; Figure 5 This is a schematic diagram of a video encoding device according to an embodiment of the present invention; Figure 6 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0024] The present application is described below based on embodiments, but it is not limited to these embodiments. In the detailed description of the present application below, certain specific details are described in detail. Those skilled in the art can fully understand the present application without these details. To avoid obscuring the substance of the present application, well-known methods, processes, flows, elements, and circuits are not described in detail.

[0025] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.

[0026] Unless the context explicitly requires it, words such as "including" or "contains" throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, meaning "including but not limited to".

[0027] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.

[0028] In existing technologies, adaptive quantization (AQ) is used for video encoding. The goal of AQ is to dynamically adjust the quantization step size based on the local characteristics of the video content, thereby optimizing overall rate-distortion performance under bitrate constraints. Taking the widely used HEVC encoder x265 as an example, its built-in AQ algorithm only uses variance information to adjust the quantization parameter. Specifically, for regions with large variance, they are considered to be regions with complex textures, and the quantization parameter (QP) is increased accordingly to save bitrate; for regions with small variance, they are considered to be regions with flat textures, and the QP is decreased accordingly to improve quality. However, this single judgment method can lead to distortion in some areas that have a significant impact on human visual perception, resulting in poor quality of the reconstructed video. Therefore, how to improve the quality of the reconstructed video while maintaining a relatively constant encoding complexity is a problem that needs to be solved.

[0029] In this embodiment of the invention, to solve the above problems, a video encoding method is proposed, specifically as follows: Figure 1 As shown, the method includes: Step S101: Obtain the target video.

[0030] Specifically, the target video includes multiple frames of images, and each frame of the image includes multiple coded blocks, each of which is a local region in the image.

[0031] Step S102: Obtain the luminance features and variance features of each coded block.

[0032] Specifically, the brightness feature is a quantitative representation of the brightness of a pixel, used to reflect the intensity of light on the screen and the degree of reflection of objects. It is a basic attribute for human eyes to perceive the brightness of a screen. The brightness feature is generated by mixing the three channels of red, green and blue (RGB), and can be represented as Y. Each pixel in the coding block corresponds to a brightness feature, and the brightness feature is a specific value.

[0033] In one possible implementation, obtaining the variance feature of each coding block specifically includes: obtaining the residual of the coding block and the number of pixels in the coding block to calculate the variance feature. The calculation formula is as follows:

[0034] Among them, the The sum of squares of the residuals of the coded block is represented by the following: The sum of squares of the residuals represents the mean of the sum of squares of the residuals. The variance feature represents the number of pixels in the encoded block. It can also be called YUV variance feature, where Y represents luminance feature and UV represents chrominance feature, which is only an example here.

[0035] Step S103: Generate a brightness masking factor based on the brightness features.

[0036] Specifically, an average brightness value is generated based on the brightness characteristics; and a brightness masking factor is generated based on the average brightness value.

[0037] In one possible implementation, assuming the encoded block includes 1000 pixels, each pixel corresponding to a luminance feature value, the average luminance value of the 1000 pixels is determined, and the luminance masking factor is generated based on the average luminance value. The formula is as follows:

[0038] The above formula reflects the brightness masking factor. The relationship curve between the above-mentioned average luminance value B of the above-mentioned coded block and the above-mentioned average luminance value B is as follows: Figure 2 As shown, wherein, Figure 2 The horizontal axis represents background luminance, which is related to the average luminance value. Figure 2 The vertical axis represents the visibility threshold, which is related to the brightness masking factor; this is merely an illustrative example.

[0039] Step S104: Generate fused features based on the brightness masking factor and the variance features.

[0040] Specifically, the fusion features The formula is as follows:

[0041] in, The number of pixels in the coded block is represented by k, which is a constant. In this embodiment of the invention, k can be 4. This is only an example and should be determined according to the actual situation.

[0042] Step S105: Generate the quantization parameter offset of the coding block based on the fusion features.

[0043] Step S106: Encode the coding block according to the quantization parameter offset.

[0044] In this embodiment of the invention, the quantization parameter offset is generated by combining the variance features and brightness masking factor in the image and video according to the above method, which overcomes the problem of insufficient processing of edge and other regions in the traditional AQ method.

[0045] In one possible implementation, after step S106, other steps are included, specifically as follows: Figure 3 As shown, it includes the following: Step S107: Reconstruct the video based on the encoded blocks.

[0046] In this embodiment of the invention, each frame of image is reconstructed based on the encoded block, and then the video is reconstructed based on each reconstructed frame of image.

[0047] In one possible implementation, the step of generating the quantization parameter offset of the coding block based on the fusion features is specifically as follows: Figure 4 As shown, it includes the following: Step S401: Generate scaled fusion features based on the fusion features.

[0048] Specifically, the fusion features The scaled and adjusted value range is then used to fuse the features. The scaling formula is as follows:

[0049] Step S402: Generate an average fusion feature based on the scaled fusion feature.

[0050] Specifically, the current frame includes multiple coded blocks, and the scaled fused features of each coded block... Based on this, the average fusion feature is determined. The formula is as follows:

[0051] Among them, the This indicates the number of coded blocks in the current frame.

[0052] Step S403: Generate adjusted average fusion features based on the average fusion features.

[0053] In one possible implementation, generating the adjusted average fusion feature based on the average fusion feature specifically includes: calculating the average of the squares of the average fusion feature based on the average fusion feature; and calculating the adjusted average fusion feature based on the average fusion feature and the average of the squares of the average fusion feature.

[0054] Specifically, the average of the squares of the average fusion features The formula is as follows:

[0055] The adjusted average fusion feature The formula is as follows:

[0056] Wherein, C is a constant, and it is assumed to be set to 11 in the default aq-mode 2 mode in the x265 encoder. This is only an example for illustration.

[0057] In one possible implementation, to adapt to the data distribution of the fusion feature σ after incorporating the luminance masking factor, the constant C is adjusted from the x265 encoder's default value of 11 to 9. This is only an example and should be determined according to the actual situation.

[0058] Step S404: Generate the quantization parameter offset based on the scaled fusion feature and the adjusted average fusion feature.

[0059] Specifically, the difference between the scaled fused feature and the adjusted average fused feature is determined; the product of the difference and the adaptive quantization intensity coefficient is determined as the quantization parameter offset. The formula is as follows:

[0060] Among them, the This is the strength coefficient of AQ, for example, a value of 1.0. This is only an example for illustration, and the specific value should be determined according to the actual situation.

[0061] In one possible implementation, the above Figure 1 and Figure 3 The method shown can also be used in conjunction with content-adaptive quantization matrix selection strategies and / or distortion propagation-based CU-tree algorithms, etc. This is only an example and should be determined according to the actual situation.

[0062] Through the above embodiments, a luminance masking factor is used to reflect the sensitivity of the human eye to distortion; the luminance masking factor and variance features are fused to obtain fused features; the quantization parameter offset is determined based on the fused features and applied to the encoding process. This overcomes the problem that traditional adaptive quantization methods rely solely on variance information, which leads to easy distortion in edge regions. While maintaining the basic coding complexity and increasing the time complexity, the quality of the reconstructed video is significantly improved, especially in terms of structural similarity index, where a large BD-Rate gain is achieved. It can also work in conjunction with other optimization algorithms in the encoder and exhibits good versatility, achieving large gains in various encoding modes and effectively improving the subjective quality of the reconstructed video for the human eye.

[0063] In this embodiment of the invention, a video encoding apparatus is provided, such as... Figure 5 As shown, it specifically includes: an acquisition unit 501, a generation unit 502, and an encoding unit 503; The acquisition unit 501 is configured to acquire a target video, wherein the target video includes multiple frames of images, each frame of the image includes multiple coded blocks, and each coded block is a local region in the image; the acquisition unit 501 is further configured to acquire the luminance features and variance features of each coded block; the generation unit 502 is configured to generate a luminance masking factor based on the luminance features; the generation unit 502 is further configured to generate a fusion feature based on the luminance masking factor and the variance features; the generation unit 502 is further configured to generate a quantization parameter offset of the coded block based on the fusion feature; and the encoding unit 503 is configured to encode the coded block based on the quantization parameter offset.

[0064] Furthermore, the apparatus further includes a reconstruction unit for reconstructing the video based on the encoded blocks.

[0065] Furthermore, the generation unit is specifically used to: generate an average brightness value based on the brightness features; and generate the brightness masking factor based on the average brightness value.

[0066] Furthermore, the acquisition unit is specifically used to: acquire the residual of the coding block and the number of pixels in the coding block to calculate the variance feature.

[0067] Further, the generation unit is specifically used to: generate scaled fusion features based on the fusion features; generate average fusion features based on the scaled fusion features; generate adjusted average fusion features based on the average fusion features; and generate the quantization parameter offset based on the scaled fusion features and the adjusted average fusion features.

[0068] Furthermore, the generation unit is specifically used to: calculate the average of the squares of the average fusion features based on the average fusion features; and calculate the adjusted average fusion features based on the average fusion features and the average of the squares of the average fusion features.

[0069] Furthermore, the generation unit is specifically used to: determine the difference between the scaled fused feature and the adjusted average fused feature; and determine the quantization parameter offset by multiplying the difference by the adaptive quantization intensity coefficient.

[0070] Figure 6 This is a schematic diagram of the structure of the electronic device described in an embodiment of the present invention. Figure 6 As shown, it includes a general computer hardware architecture, which includes at least a processor 601 and a memory 602. The processor 601 and the memory 602 are connected via a bus 603. The memory 602 is adapted to store instructions or programs executable by the processor 601. The processor 601 can be a standalone microprocessor or a collection of one or more microprocessors. Thus, the processor 601 executes the instructions stored in the memory 602 to perform the method flow of the embodiments of the present invention as described above, thereby realizing data processing and control of other devices. The bus 603 connects the above-mentioned components together, and also connects the above-mentioned components to a display controller 604, a display device, and an input / output (I / O) device 605. The input / output (I / O) device 605 can be a mouse, keyboard, modem, network interface, touch input device, motion-sensing input device, printer, and other devices known in the art. Typically, the input / output device 605 is connected to the system via an input / output (I / O) controller 606.

[0071] The instructions stored in memory 602 are executed by at least one processor 601 to: acquire a target video; acquire the luminance features and variance features of each coded block; generate a luminance masking factor based on the luminance features; generate a fusion feature based on the luminance masking factor and the variance features; generate a quantization parameter offset for the coded block based on the fusion feature; and encode the coded block based on the quantization parameter offset.

[0072] Specifically, the electronic device includes: one or more processors 601 and a memory 602. Figure 6 Take a processor 601 as an example. The processor 601 and the memory 602 can be connected via a bus or other means. Figure 6 Taking a bus connection as an example, memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Processor 601 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions, and modules stored in memory 602, thereby implementing the aforementioned method for determining video encoding.

[0073] Memory 602 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; the data storage area may store an option list, etc. Furthermore, memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 602 may optionally include memory remotely located relative to processor 601, and these remote memories may be connected to external devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0074] One or more modules are stored in memory 602, and when executed by one or more processors 601, they perform the video encoding method in any of the above method embodiments.

[0075] As those skilled in the art will recognize, various aspects of the embodiments of the present invention can be implemented as a system, method, or computer program product. Therefore, various aspects of the embodiments of the present invention can take the form of a completely hardware implementation, a completely software implementation (including firmware, resident software, microcode, etc.), or an implementation combining software and hardware aspects, which may generally be referred to herein as a "circuit," "module," or "system." Furthermore, various aspects of the embodiments of the present invention can take the form of a computer program product implemented in one or more computer-readable media having computer-readable program code implemented thereon.

[0076] Any combination of one or more computer-readable media can be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, (but not limited to) an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination thereof. More specific examples (not an exhaustive list) of computer-readable storage media will include: an electrical connection having one or more wires, a portable computer floppy disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable optical disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the context of embodiments of the present invention, a computer-readable storage medium can be any tangible medium capable of containing or storing a program used by or in conjunction with an instruction execution system, device, or apparatus.

[0077] Computer-readable signal media may include propagated digital signals having computer-readable program code implemented therein, such as in baseband or as part of a carrier wave. Such propagated signals may take any of a variety of forms, including, but not limited to, electromagnetic, optical, or any suitable combination thereof. A computer-readable signal medium may be any computer-readable medium that is not a computer-readable storage medium and can communicate, propagate, or transmit a program used by or in conjunction with an instruction execution system, device, or apparatus.

[0078] Program code implemented on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, fiber optic cable, RF, or any suitable combination thereof.

[0079] Computer program code for performing operations relating to various aspects of embodiments of the present invention can be written in any combination of one or more programming languages, including: object-oriented programming languages ​​such as Java, Smalltalk, C++, etc.; and conventional procedural programming languages ​​such as the "C" programming language or similar programming languages. The program code can be executed as a standalone software package entirely on the user's computer, partially on the user's computer, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet provided by an Internet service provider).

[0080] The flowchart illustrations and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present invention describe various aspects of the embodiments of the present invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus to produce a machine such that the instructions (executed via the processor of the computer or other programmable data processing apparatus) create means for implementing the functions / actions specified in the flowchart and / or block diagram blocks or blocks.

[0081] These computer program instructions may also be stored in a computer-readable medium that can direct a computer, other programmable data processing apparatus or other means to operate in a particular manner, such that the instructions stored in the computer-readable medium produce an article of writing that includes instructions that implement the functions / actions specified in flowchart and / or block diagram blocks or blocks.

[0082] Computer program instructions may also be loaded onto a computer, other programmable data processing apparatus or other device to cause a series of operable steps to be performed on the computer, other programmable apparatus or other device to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide for implementing the functions / actions specified in flowchart and / or block diagram blocks or blocks.

[0083] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

[0084] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, and displayed data) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of such data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding access points are provided for users to choose to authorize or refuse processing. A user's refusal to process personal information beyond what is necessary for basic functions will not affect the user's use of basic functions.

Claims

1. A video encoding method, characterized in that, The method includes: Acquire a target video, wherein the target video includes multiple frames of images, each frame of the image includes multiple coded blocks, and each coded block is a local region in the image; Obtain the luminance and variance features of each coded block; A brightness masking factor is generated based on the brightness characteristics; Generate fused features based on the brightness masking factor and the variance feature; The quantization parameter offset of the coding block is generated based on the fusion features; The coded block is encoded according to the quantization parameter offset.

2. The method according to claim 1, characterized in that, The method further includes: The video is reconstructed based on the encoded blocks.

3. The method according to claim 1, characterized in that, The step of generating a brightness masking factor based on the brightness features specifically includes: An average brightness value is generated based on the brightness characteristics; The brightness masking factor is generated based on the average brightness value.

4. The method according to claim 1, characterized in that, The step of obtaining the variance features of each coded block specifically includes: The variance feature is calculated by obtaining the residual of the encoded block and the number of pixels in the encoded block.

5. The method according to claim 1, characterized in that, The step of generating the quantization parameter offset of the coding block based on the fusion features specifically includes: A scaled fusion feature is generated based on the fusion feature; An average fusion feature is generated based on the scaled fusion feature; An adjusted average fusion feature is generated based on the aforementioned average fusion feature; The quantization parameter offset is generated based on the scaled fusion feature and the adjusted average fusion feature.

6. The method according to claim 5, characterized in that, The step of generating the adjusted average fusion feature based on the average fusion feature specifically includes: The average value of the squares of the average fusion features is calculated based on the average fusion features; The adjusted average fusion feature is calculated based on the average of the average fusion feature and the average of the squares of the average fusion feature.

7. The method according to claim 5, characterized in that, The step of generating the quantization parameter offset based on the scaled fusion feature and the adjusted average fusion feature specifically includes: Determine the difference between the scaled fused feature and the adjusted average fused feature; The product of the difference and the adaptive quantization intensity coefficient is determined as the quantization parameter offset.

8. A video encoding apparatus, characterized in that, The device includes: An acquisition unit is used to acquire a target video, wherein the target video includes multiple frames of images, each frame of the image includes multiple coded blocks, and each coded block is a local region in the image; The acquisition unit is further configured to acquire the luminance features and variance features of each coded block; The generation unit is used to generate a brightness masking factor based on the brightness features; The generation unit is further configured to generate a fusion feature based on the brightness masking factor and the variance feature; The generation unit is further configured to generate the quantization parameter offset of the coding block based on the fusion feature; The encoding unit is used to encode the encoding block according to the quantization parameter offset.

9. An electronic device comprising a memory and a processor, characterized in that, The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1-7.