Video encoding method, video encoder, electronic equipment and storage medium

By performing edge detection and unsharp filtering on image blocks before video encoding, and setting different weighting coefficients according to texture characteristics for filtering processing, the problem of not considering subjective image quality in the existing technology is solved, and the video viewing effect is significantly improved.

CN118612426APending Publication Date: 2024-09-06MOORE THREADS TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410684273.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing video encoders do not consider the subjective image quality of the original video when optimizing the encoding quality. As a result, although the objective quality of the encoded video is high, the viewing effect is not good for the human eye.

Method used

Before video encoding, edge detection and unsharp filtering techniques are used to preprocess the image blocks to be encoded, and different unsharp weighting coefficients are set according to edge pixels and non-edge pixels, and N×N low-pass filtering and bilateral filtering are performed to enhance image details. , improve subjective image quality.

Benefits of technology

It effectively improves the subjective quality of video encoding and improves the user's video viewing effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118612426A
    Figure CN118612426A
Patent Text Reader

Abstract

The invention relates to a video coding method, a video coder, electronic equipment and a storage medium. The method comprises the following steps: performing edge detection on a to-be-coded image block to determine an edge detection result; unsharp filtering is carried out on the to-be-coded image block based on the unsharp weighting coefficient to obtain a preprocessed image block, and the unsharp weighting coefficient corresponding to a pixel point is determined to be a first unsharp weighting coefficient when the pixel point is determined to be an edge pixel point based on an edge detection result; when the pixel point is determined to be a non-edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a second unsharp weighting coefficient, and the second unsharp weighting coefficient is smaller than the first unsharp weighting coefficient; and encoding the preprocessed image block to obtain an encoding result corresponding to the to-be-encoded image block. The embodiment of the invention can effectively improve the subjective quality of the coding result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a video encoding method and a video encoder, an electronic device and a storage medium. Background Art

[0002] In recent years, mobile smart terminals have been widely popularized. With the rapid update of network speed, vivid and intuitive video services are favored by more and more people. At the same time, people's visual perception is constantly improving, which is reflected in the increasing requirements for video quality such as video clarity and video smoothness. Therefore, mainstream video coding standards such as HEVC, AVC, and AV1 are more widely used. In current video encoders, the main focus is on improving coding quality. For example, the coding bit rate is minimized while ensuring a certain video quality, or the coding distortion is minimized under the condition of mobile coding bit rate constraints to achieve the best coding performance. However, the current video encoder does not consider optimizing the subjective image quality of the original video, which may result in the objective image quality of the encoded video being high, but the viewing effect of the human eye is not good. Summary of the invention

[0003] The present disclosure proposes a video encoding method and a technical solution of a video encoder, an electronic device and a storage medium.

[0004] According to one aspect of the present disclosure, a video encoding method is provided, comprising: for an image block to be encoded in a video frame to be encoded, performing edge detection on the image block to be encoded to determine an edge detection result; based on an unsharp weighting coefficient, performing unsharp filtering on the image block to be encoded to obtain a preprocessed image block, wherein, for any pixel point in the image block to be encoded, when the pixel point is determined to be an edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a first unsharp weighting coefficient; when the pixel point is determined to be a non-edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a second unsharp weighting coefficient, and the second unsharp weighting coefficient is less than the first unsharp weighting coefficient; encoding the preprocessed image block to obtain an encoding result corresponding to the image block to be encoded.

[0005] In a possible implementation, the unsharp filtering is performed on the image block to be encoded based on the unsharp weighting coefficient to obtain the preprocessed image block, including: for any pixel point in the image block to be encoded, determining N×N neighborhood information centered on the pixel point, where N is a positive integer greater than or equal to 3; based on the N×N neighborhood information corresponding to each pixel point in the image block to be encoded, performing N×N low-pass filtering on the image block to be encoded to obtain a low-pass filtered image block; taking the difference between the image block to be encoded and the low-pass filtered image block to obtain a difference image block; and based on the unsharp weighting coefficient, performing unsharp weighted processing on the image block to be encoded and the difference image block to obtain the preprocessed image block.

[0006] In a possible implementation, performing N×N low-pass filtering on the image block to be encoded based on N×N neighborhood information corresponding to each pixel in the image block to be encoded to obtain the image block after low-pass filtering includes: performing N×N low-pass filtering on the image block to be encoded based on a preset N×N low-pass filter kernel and the N×N neighborhood information corresponding to each pixel in the image block to be encoded to obtain the image block after low-pass filtering, wherein the sum of N×N low-pass filter coefficients included in the N×N low-pass filter kernel is 256.

[0007] In a possible implementation, the performing unsharp weighted processing on the image block to be encoded and the difference image block based on the unsharp weighted coefficient to obtain the preprocessed image block includes: performing N×N bilateral filtering on the image block to be encoded based on N×N neighborhood information corresponding to each pixel in the image block to be encoded to obtain a bilaterally filtered image block; performing range stretching on the bilaterally filtered image block to obtain a range stretched image block; and performing unsharp weighted processing on the difference image block and the range stretched image block based on the unsharp weighted coefficient to obtain the preprocessed image block.

[0008] In a possible implementation, the performing N×N bilateral filtering on the image block to be encoded based on the N×N neighborhood information corresponding to each pixel in the image block to be encoded to obtain the image block after bilateral filtering includes: determining, for any pixel in the image block to be encoded, a similarity weighted coefficient of a target neighborhood pixel corresponding to the pixel, wherein the target neighborhood pixel corresponding to the pixel is a pixel whose pixel difference with the pixel in the N×N neighborhood information corresponding to the pixel is less than a threshold; determining, based on an N×N mean filter kernel, a distance weighted coefficient of the target neighborhood pixel corresponding to the pixel; determining, based on the similarity weighted coefficient and the distance weighted coefficient of the target neighborhood pixel corresponding to the pixel, an N×N bilateral filter kernel corresponding to the pixel; performing N×N bilateral filtering on the image block to be encoded based on the N×N neighborhood information and the N×N bilateral filter kernel corresponding to each pixel in the image block to be encoded to obtain the image block after bilateral filtering.

[0009] In a possible implementation, performing range stretching on the bilateral filtered image block to obtain the range stretched image block includes: determining a range stretching value corresponding to each pixel in the bilateral filtered image block based on a preset range stretching table, wherein the preset range stretching table is determined based on preset range stretching conditions, and the preset range stretching table includes range stretching values ​​corresponding to different pixel values; performing range stretching on the bilateral filtered image block based on the range stretching value corresponding to each pixel in the bilateral filtered image block to obtain the range stretched image block.

[0010] In a possible implementation, the performing unsharp weighted processing on the difference image block and the domain stretched image block based on the unsharp weighted coefficient to obtain the preprocessed image block includes: performing unsharp weighted processing on the difference image block and the domain stretched image block based on the unsharp weighted coefficient to obtain the unsharp weighted image block; performing pixel value clip on the unsharp weighted image block based on the pixel value offset to obtain the preprocessed image block, wherein, for any pixel point in the unsharp weighted image block, when the pixel point is determined to be an edge pixel point based on the edge detection result, the pixel value offset corresponding to the pixel point is a first pixel value offset; when the pixel point is determined to be a non-edge pixel point based on the edge detection result, the pixel value offset corresponding to the pixel point is a second pixel value offset, and the second pixel value offset is greater than the first pixel value offset.

[0011] In a possible implementation, the performing pixel value clipping on the unsharp weighted image block based on the pixel value offset to obtain the preprocessed image block includes: determining a pixel value upper limit and a pixel value lower limit based on the pixel value offset and the bilateral filtered image block; and performing pixel value clipping on the unsharp weighted image block based on the pixel value upper limit and the pixel value lower limit to obtain the preprocessed image block.

[0012] According to one aspect of the present disclosure, a video encoder is provided, comprising: an edge detection module, for performing edge detection on an image block to be encoded in a video frame to be encoded, and determining an edge detection result; an unsharp filtering module, for performing unsharp filtering on the image block to be encoded based on an unsharp weighting coefficient, and obtaining a preprocessed image block, wherein, for any pixel point in the image block to be encoded, when the pixel point is determined to be an edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a first unsharp weighting coefficient; when the pixel point is determined to be a non-edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a second unsharp weighting coefficient, and the second unsharp weighting coefficient is less than the first unsharp weighting coefficient; and an encoding module, for performing encoding processing on the preprocessed image block, and obtaining an encoding result corresponding to the image block to be encoded.

[0013] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to call the instructions stored in the memory to execute the above method.

[0014] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor.

[0015] In the disclosed embodiment, for the image block to be encoded in the video frame to be encoded, edge detection is performed on the image block to be encoded, and the edge detection result is determined. Based on the edge detection result, edge pixels and non-edge pixels in the image to be encoded can be determined. Since edge pixels are pixels with obvious and sharp changes in brightness in the image, they can reflect the texture characteristics of the image. The texture at the edge is complex and can tolerate greater distortion. Therefore, different unsharp weighting coefficients are set for edge pixels and non-edge pixels. The edge pixels correspond to the first unsharp weighting coefficient, and the non-edge pixels correspond to the second unsharp weighting coefficient, and the second unsharp weighting coefficient is less than the first unsharp weighting coefficient, so that different regions in the image block to be encoded can be subjected to unsharp filtering of different intensities based on the texture characteristics to obtain the preprocessed image block. Since unsharp filtering can enhance image details and improve subjective image quality, after encoding the preprocessed image block after unsharp filtering, the subjective quality of the encoding result can be effectively improved, so that the user's video viewing effect can be improved later.

[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only and do not limit the present disclosure. Other features and aspects of the present disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.

[0018] Figure 1 A flowchart of a video encoding method according to an embodiment of the present disclosure is shown.

[0019] Figure 2 A schematic diagram showing an image block to be processed and its neighborhood information according to an embodiment of the present disclosure.

[0020] Figure 3 A block diagram of a video encoder according to an embodiment of the present disclosure is shown.

[0021] Figure 4 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0022] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0023] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0024] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.

[0025] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0026] Video coding standards such as HEVC, AVC, and AV1 all use a hybrid coding framework, using prediction, transformation, quantization, loop filtering, entropy coding and other modules to process video frames to eliminate redundancy. In order to achieve the best coding performance in video coding, discrete cosine transform and quantization techniques are used to eliminate the frequency domain redundancy of residual pixels, and syntax elements are compressed through arithmetic coding. The main purpose of video coding is to minimize the coding bit rate while ensuring a certain video quality, or to minimize coding distortion under the condition of mobile coding bit rate restrictions, so as to achieve the best coding performance. In current video encoders, there is generally no pre-processing scheme for video encoding for subjective quality. The processing for subjective quality is located in the loop filtering stage, mainly including deblocking filter (DBF) and sample adaptive offset (SAO). DBF is used to reduce the block effect generated during video encoding, and smoothing is performed at the boundary to remove the impact caused by boundary discontinuity as much as possible, effectively reducing the block effect. SAO is used to eliminate the ringing effect in the image. By using different compensation values ​​for different types of pixels, the subjective quality of the reconstructed video frame during video encoding is effectively improved.

[0027] In the existing video encoder implementation scheme, the coding quality is mainly optimized, and in the subsequent filtering process, the distortion such as block effect and ringing effect generated in the video encoding process is mainly optimized. In other words, the current video encoder mainly improves the objective image quality without considering the optimization of the subjective image quality of the original video, which may result in the objective image quality of the encoded video being high, but the viewing effect of the human eye is not good.

[0028] In order to solve the above problems, the embodiment of the present disclosure provides a video encoding method, which can implement image preprocessing before video encoding, thereby effectively improving the subjective quality of the video after encoding, so that the user's video viewing effect can be improved later. The video encoding method provided by the embodiment of the present disclosure is described in detail below.

[0029] Figure 1 A flowchart of a video encoding method according to an embodiment of the present disclosure is shown. The method can be applied to a video encoder, which can be located in an electronic device such as a terminal device or a server. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The method can be implemented by a processor in the video encoder calling computer-readable instructions stored in a memory. Alternatively, the method can be executed by a video encoder in a server. Figure 1 As shown, the method includes:

[0030] In step S11, edge detection is performed on the image block to be encoded in the video frame to be encoded to determine an edge detection result.

[0031] In a video encoding scenario, when encoding a video frame, encoding processing is performed using image blocks in the video frame as units.

[0032] The video frame to be encoded here may be any frame in the video to be encoded, and the present disclosure does not make any specific limitation on this.

[0033] For the current image block to be encoded in the video frame to be encoded, edge detection can be performed on the image block to be encoded to determine an edge detection result. Based on the edge detection result, edge pixels and non-edge pixels in the image to be encoded can be determined.

[0034] How to perform edge detection on the image block to be encoded and determine the edge detection result will be described in detail later in conjunction with possible implementation methods of the present disclosure, and will not be elaborated here.

[0035] In step S12, based on the unsharp weighting coefficient, unsharp filtering is performed on the image block to be encoded to obtain a preprocessed image block, wherein, for any pixel point in the image block to be encoded, when the pixel point is determined to be an edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a first unsharp weighting coefficient; when the pixel point is determined to be a non-edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a second unsharp weighting coefficient, and the second unsharp weighting coefficient is less than the first unsharp weighting coefficient.

[0036] Since edge pixels are pixels with obvious and sharp changes in brightness in the image, they can reflect the texture characteristics of the image. The texture at the edge is complex and can tolerate greater distortion. Therefore, different unsharp weighting coefficients are set for edge pixels and non-edge pixels. The edge pixels correspond to the first unsharp weighting coefficient, and the non-edge pixels correspond to the second unsharp weighting coefficient, and the second unsharp weighting coefficient is smaller than the first unsharp weighting coefficient. This can achieve unsharp filtering of different intensities for the edge area and the non-edge area in the image block to be encoded based on the texture characteristics to obtain the preprocessed image block.

[0037] The first unsharp weighting coefficient and the second unsharp weighting coefficient are values ​​between [0, 1], and the first unsharp weighting coefficient is greater than the second unsharp weighting coefficient. The specific values ​​of the first unsharp weighting coefficient and the second unsharp weighting coefficient can be flexibly set according to actual conditions, and the present disclosure does not make specific restrictions on this. For example, the first unsharp weighting coefficient is 0.5, and the second unsharp weighting coefficient is 0.25.

[0038] The specific process of how to perform unsharp filtering on the image block to be encoded based on the unsharp weighting coefficient to obtain the preprocessed image block will be described in detail later in conjunction with possible implementation methods of the present disclosure, which will not be elaborated here.

[0039] In step S13, the preprocessed image block is coded to obtain a coding result corresponding to the image block to be coded.

[0040] Since unsharp filtering can enhance image details and improve subjective image quality, encoding the preprocessed image blocks after unsharp filtering can obtain encoding results with higher subjective image quality, so that the user's video viewing experience can be improved later.

[0041] The specific encoding process of encoding the preprocessed image block may refer to the video encoding process of the related art, and the present disclosure does not make any specific limitation on this.

[0042] In the disclosed embodiment, for the image block to be encoded in the video frame to be encoded, edge detection is performed on the image block to be encoded to determine the edge detection result. Based on the edge detection result, edge pixels and non-edge pixels in the image to be encoded can be determined. Since edge pixels are pixels with obvious and sharp changes in brightness in the image, they can reflect the texture characteristics of the image. Therefore, different unsharp weighting coefficients are set for edge pixels and non-edge pixels. The edge pixels correspond to the first unsharp weighting coefficient, and the non-edge pixels correspond to the second unsharp weighting coefficient, and the second unsharp weighting coefficient is less than the first unsharp weighting coefficient, so that different areas in the image block to be encoded can be subjected to unsharp filtering of different intensities based on the texture characteristics to obtain the preprocessed image block. Since unsharp filtering can enhance image details and improve subjective image quality, after encoding the preprocessed image block after unsharp filtering, the subjective quality of the encoding result can be effectively improved, so that the user's video viewing effect can be improved later.

[0043] In a possible implementation, based on an unsharp weighting coefficient, an unsharp filter is performed on an image block to be encoded to obtain a preprocessed image block, including: for any pixel point in the image block to be encoded, determining N×N neighborhood information centered on the pixel point, where N is a positive integer greater than or equal to 3; based on the N×N neighborhood information corresponding to each pixel point in the image block to be encoded, performing N×N low-pass filtering on the image block to be encoded to obtain a low-pass filtered image block; calculating the difference between the image block to be encoded and the low-pass filtered image block to obtain a difference image block; based on the unsharp weighting coefficient, performing unsharp weighted processing on the image block to be encoded and the difference image block to obtain a preprocessed image block.

[0044] Since the encoding process is performed in image blocks in the video encoding scenario, a filter window of size N×N is used to obtain the N×N neighborhood information of each pixel in the image block to be encoded, and the low-pass filtering of the image block to be encoded is effectively implemented. The image block after low-pass filtering is a blurred image block. The difference between the original image block to be encoded and the blurred low-pass filtered image block is obtained, and then the difference image block is superimposed back to the image block to be encoded based on the unsharp weighting coefficient to obtain the preprocessed image block, wherein the preprocessed image block is an image enhanced image block, which effectively enhances the texture details of the image and improves the subjective image quality.

[0045] Figure 2A schematic diagram showing an image block to be processed and its neighborhood information according to an embodiment of the present disclosure is shown. Figure 2 As shown in the figure, the image block to be encoded is a shaded area of ​​8×8. Assuming that the size of the filter window is N×N=5×5, then Figure 2 The non-shadow area in the middle is the neighborhood information corresponding to the image block to be encoded that needs to be obtained from the video frame to be encoded, so that the 5×5 neighborhood information centered on each pixel in the image block to be encoded can be determined based on the image block to be encoded and its corresponding neighborhood information.

[0046] After determining the N×N neighborhood information centered on each pixel in the image block to be encoded, low-pass filtering can be performed on the image block to be encoded. Low-pass filtering can prepare for subsequent edge detection of the image block to be encoded based on the image block after low-pass filtering.

[0047] When the filter window is N×N, the central pixel is low-pass filtered using the surrounding N×N pixels. Therefore, it is necessary to ensure that the filter window N×N is greater than or equal to 3×3. However, the specific size of the filter window can be flexibly set according to actual conditions, for example, set to 5×5, and the present disclosure does not make specific limitations on this.

[0048] In a possible implementation, based on N×N neighborhood information corresponding to each pixel in the image block to be encoded, N×N low-pass filtering is performed on the image block to be encoded to obtain the image block after low-pass filtering, including: based on a preset N×N low-pass filter kernel and N×N neighborhood information corresponding to each pixel in the image block to be encoded, N×N low-pass filtering is performed on the image block to be encoded to obtain the image block after low-pass filtering, wherein the sum of N×N low-pass filter coefficients included in the N×N low-pass filter kernel is 256.

[0049] For any pixel in the image block to be encoded, the pixel value of each pixel in the N×N neighborhood information corresponding to the pixel is multiplied by the corresponding low-pass filter coefficient in the preset N×N low-pass filter kernel, and then these products are accumulated to obtain a product accumulation value, and the product accumulation value is divided by the sum of the N×N low-pass filter coefficients in the preset N×N low-pass filter kernel to obtain the low-pass filtered pixel value corresponding to the pixel. The low-pass filtered pixel values ​​corresponding to each pixel in the image block to be encoded together constitute the low-pass filtered image block corresponding to the image block to be encoded.

[0050] The sum of the N×N low-pass filter coefficients in the preset low-pass filter kernel is 256, which is 2 to the 8th power. Therefore, the product accumulation value can be divided by 256 by shifting the product accumulation value right by 8 bits, thereby effectively reducing the division operation that is difficult to implement in hardware in the video encoder.

[0051] In one example, the preset low-pass filter kernel may be The low-pass filter coefficient at the center of the low-pass filter core is 36, and the low-pass filter coefficients around it gradually decrease, forming a ripple shape, and the low-pass filter coefficient farthest from the center is 1. This low-pass filter core can use 5×5 neighborhood information to perform low-pass filtering on the central pixel. In addition to the above-mentioned forms, the specific values ​​of each low-pass filter coefficient in the preset low-pass filter core can also be flexibly set to other values ​​according to the actual application scenario, and the present disclosure does not make specific limitations on this.

[0052] In one example, the image block to be encoded may be low-pass filtered based on the following formula (1) to obtain a low-pass filtered image block:

[0053]

[0054] Among them, buf lpf (i, j) is the pixel value of the pixel (i, j) in the low-pass filtered image block obtained by performing low-pass filtering on the pixel (i, j) in the image block to be encoded; (k, l) is the neighboring pixel of the pixel (i, j); buf in (k,l) is the pixel value of the neighborhood pixel (k,l); w lpf (i,j,k,l) ​​is the low-pass filter coefficient corresponding to the neighborhood pixel point (k,l) in the low-pass filter kernel.

[0055] In one example, the low-pass filtered image block is stored in a preset storage space in the video encoder so that it can be directly read for subsequent use.

[0056] After obtaining the low-pass filtered image block, the difference between the image block to be encoded and the low-pass filtered image block is calculated to obtain a difference image block; based on the difference image block, edge detection is performed on the image block to be encoded to obtain an edge detection result.

[0057] For example, based on the following formula (2), the difference between the image block to be encoded and the image block after low-pass filtering can be obtained to obtain a difference image block:

[0058] buf edge (i,j)=buf in (i,j)-buf lpf (i,j) (2).

[0059] Among them, buf in (i, j) is the pixel value of the pixel point (i, j) in the image block to be encoded; buf lpf (i, j) is the pixel value of pixel (i, j) in the image block after low-pass filtering; buf edge (i, j) is the pixel value of pixel (i, j) in the difference image block.

[0060] In one example, edge detection may be performed on the image block to be encoded based on the following formula (3) to obtain an edge detection result:

[0061]

[0062] Where E(i,j) is the edge detection result of pixel (i,j), and T1 is the preset threshold. The pixel value buf of pixel (i,j) in the difference image block edge When (i, j) is less than or equal to T1, the pixel point (i, j) is an edge pixel point; the pixel value buf of the pixel point (i, j) in the difference image block is edge When (i, j) is greater than T1, the pixel point (i, j) is a non-edge pixel point. The specific value of T1 can be flexibly set according to the actual situation. For example, for an 8-bit image, T1 = -4; for a 10-bit image, T1 = -16.

[0063] In one example, the difference image block and the edge detection result are stored in a preset storage space in the video encoder so that they can be directly read for subsequent use.

[0064] According to the edge detection result, unsharp weighted processing can be performed on the image block to be encoded and the difference image block to obtain the preprocessed image block.

[0065] In one example, based on the following formula (4), the unsharp weighted processing can be performed on the image block to be encoded and the difference image block to obtain an unsharp weighted image block:

[0066]

[0067] Among them, buf unsharp (i, j) is the pixel value of the pixel point (i, j) in the image block after unsharp weighting; coeff0 is the first unsharp weighting coefficient corresponding to the edge pixel point; coeff1 is the second unsharp weighting coefficient corresponding to the non-edge pixel point.

[0068] The unsharp weighted image block is directly determined as the preprocessed image block. At this time, the preprocessing operation before encoding the image block to be encoded includes: low-pass filtering, edge detection, and unsharp filtering based on texture characteristics.

[0069] In order to further improve the subjective image quality of the preprocessed image block, other image processing may be performed on the image block to be encoded before unsharp filtering, for example, bilateral filtering, range stretching, etc.

[0070] In a possible implementation, based on the unsharp weighting coefficient, unsharp weighted processing is performed on the image block to be coded and the difference image block to obtain the preprocessed image block, including: based on the N×N neighborhood information corresponding to each pixel point in the image block to be coded, N×N bilateral filtering is performed on the image block to be coded to obtain the bilateral filtered image block; range stretching is performed on the bilateral filtered image block to obtain the range stretched image block; based on the unsharp weighting coefficient, unsharp weighted processing is performed on the difference image block and the range stretched image block to obtain the preprocessed image block.

[0071] Since the encoding process is performed in image blocks in video encoding scenarios, it is relatively difficult to obtain the entire frame information and neighborhood information. Therefore, for low-pass filtering and bilateral filtering that require window-level processing, the same image block to be encoded is used as input, and the same size of N×N filtering window is used. In this way, it is only necessary to perform the operation of obtaining the N×N neighborhood information of each pixel in the image block to be encoded once to achieve low-pass filtering and bilateral filtering of the image block to be encoded, which effectively simplifies the operation of obtaining the window neighborhood information during the filtering process.

[0072] By performing bilateral filtering on the image block to be encoded, edge-preserving denoising of the image block to be encoded can be achieved, which can not only effectively remove noise from the image block to be encoded, but also retain edge information in the image block to be encoded.

[0073] In a possible implementation, based on N×N neighborhood information corresponding to each pixel in the image block to be encoded, N×N bilateral filtering is performed on the image block to be encoded to obtain an image block after bilateral filtering, including: for any pixel in the image block to be encoded, determining a similarity weighted coefficient of a target neighborhood pixel corresponding to the pixel, wherein the target neighborhood pixel corresponding to the pixel is a pixel whose pixel difference with the pixel in the N×N neighborhood information corresponding to the pixel is less than a threshold; based on an N×N mean filter kernel, determining a distance weighted coefficient of the target neighborhood pixel corresponding to the pixel; based on the similarity coefficient and the distance weighted coefficient of the target neighborhood pixel corresponding to the pixel, determining an N×N bilateral filter kernel corresponding to the pixel; based on the N×N neighborhood information and the N×N bilateral filter kernel corresponding to each pixel in the image block to be encoded, performing N×N bilateral filtering on the image block to be encoded to obtain an image block after bilateral filtering.

[0074] For any pixel in the image block to be encoded, the pixels in the N×N neighborhood information corresponding to the pixel whose pixel difference with the pixel is greater than or equal to the threshold may have a small spatial proximity and a low pixel value similarity. The neighborhood pixels whose pixel difference is greater than or equal to the threshold do not participate in bilateral filtering and will not have much impact on the bilateral filtering result.

[0075] Therefore, for each pixel in the image block to be encoded, only the neighborhood pixels whose pixel difference with the pixel is less than a threshold in the N×N neighborhood information corresponding to the pixel are determined as target neighborhood pixels, and then the similarity weighted coefficient corresponding to the target neighborhood pixel is determined, while the similarity weighted coefficient of the non-target neighborhood pixel is set to 0, so that only the target neighborhood pixel is subsequently involved in bilateral filtering, thereby reducing the amount of calculation to control the number of hardware registers.

[0076] In one example, for a pixel point (i, j) in the image block to be encoded, the similarity coefficient of each neighboring pixel point in the N×N neighborhood information corresponding to the pixel point (i, j) can be determined based on the following formula (5):

[0077]

[0078] Among them, r(i,j,k,l) ​​is the similarity coefficient of the neighboring pixel point (k,l) in the N×N neighborhood information corresponding to the pixel point (i,j); f(i,j) is the pixel value of the pixel point (i,j); f(k,l) is the pixel value of the neighboring pixel point (k,l); abs is the absolute value function; σ r is the Gaussian factor; T2 is a preset threshold. The specific value of T2 can be flexibly set according to the actual situation. For example, for an 8-bit image, T2=64; for a 10-bit image, T2=256.

[0079] At the same time, compared with the method of determining the distance weighting coefficient based on the Gaussian filter kernel in the related art, the embodiment of the present disclosure determines the distance weighting coefficient based on the N×N mean filter kernel, thereby reducing the amount of calculation to control the number of hardware registers.

[0080] For any pixel in the image block to be encoded, under the N×N mean filter kernel, the distance weighted coefficient of each neighboring pixel in the N×N neighborhood information corresponding to the pixel is For example, when N×N=5×5, the distance weighting coefficient of each neighborhood pixel is

[0081] For any pixel in the image block to be encoded, the similarity coefficient and distance weight coefficient of each neighboring pixel in the N×N neighborhood information corresponding to the pixel are multiplied to obtain the N×N bilateral filter kernel corresponding to the pixel.

[0082] In one example, for a pixel point (i, j) in an image block to be encoded, the N×N bilateral filter kernel corresponding to the pixel point (i, j) can be determined based on the following formula (6):

[0083]

[0084] Among them, w bila (i,j,k,l) ​​is the bilateral filter coefficient of the neighboring pixel point (k,l) in the N×N bilateral filter kernel corresponding to the pixel point (i,j).

[0085] In one example, since it is difficult to calculate the bilateral filter kernel in a hardware video encoder, the bilateral filter kernel may be determined based on a software layer and then transmitted to the hardware video encoder for subsequent bilateral filtering.

[0086] In one example, bilateral filtering can be performed on the image block to be encoded based on the following formula (7) to obtain a bilaterally filtered image block:

[0087]

[0088] Among them, buf bila (i, j) is the pixel value of the pixel point (i, j) in the bilaterally filtered image block obtained by performing bilateral filtering on the pixel point (i, j) in the image block to be encoded.

[0089] In a possible implementation, a range stretching is performed on a bilaterally filtered image block to obtain a range-stretched image block, including: determining a range stretching value corresponding to each pixel point in the bilaterally filtered image block based on a preset range stretching table, wherein the preset range stretching table is determined based on a preset range stretching condition, and the preset range stretching table includes range stretching values ​​corresponding to different pixel values; based on the range stretching value corresponding to each pixel point in the bilaterally filtered image block, the range stretching is performed on the bilaterally filtered image block to obtain the range-stretched image block.

[0090] Further performing range stretching on the bilaterally filtered image blocks can effectively adjust the image brightness range, thereby improving image contrast and visibility.

[0091] In the related art, range stretching can be performed by the following formula (8):

[0092]

[0093] Among them, buf before (i, j) is the pixel value of the pixel point (i, j) before the range is stretched; buf after (i, j) is the pixel value of the pixel point (i, j) after the range is stretched; p max is the maximum pixel value in the video frame where the pixel point (i, j) is located; p min It is the minimum pixel value in the video frame where the pixel (i, j) is located.

[0094] Since it is necessary to traverse all the pixels in the video frame to determine the maximum pixel value and the minimum pixel value, a large delay will be generated. Therefore, the embodiment of the present disclosure generates a preset range stretching table based on the preset range stretching condition, and then determines the range stretching value by looking up the table, thereby reducing the delay.

[0095] The process of generating a preset value range stretch table based on preset value range stretch conditions needs to consider the following three points.

[0096] First, staged symmetrical pixel stretching. That is, the distance between the pixel value and the center of the pixel value The closer the pixel points are, the smaller the range stretching allowed is, and the farther the pixel value is from the pixel value center, the larger the range stretching allowed is.

[0097] For example, for an 8-bit image, the pixel value center is 128, p min =16, p max =240, and perform offline calculation based on the above formula (8), and at the same time, consider the range of change of the staged symmetrical pixel stretching, and then generate a preset value range stretching table. The range of variation of the staged symmetrical pixel stretching may include: for pixel points whose pixel values ​​are within 32 from the pixel value center 128 (pixel points whose pixel values ​​are located at [96, 160]), the corresponding range stretching value is 0; for pixel points whose pixel values ​​are within 32 from the pixel value center 128 (pixel points whose pixel values ​​are located at [64, 96] and (160, 192]), the corresponding range stretching value is ±1; for pixel points whose pixel values ​​are within 64 from the pixel value center 128 (pixel points whose pixel values ​​are located at [32, 64] and (192, 224]), the corresponding range stretching value is ±2; for pixel points whose pixel values ​​are within 96 from the pixel value center 128 (pixel points whose pixel values ​​are located at [0, 64] and (192, 255]), the corresponding range stretching value is ±3.

[0098] For example, for a 10-bit image, the pixel value center is 512, p min =64, p max=960, and perform offline calculation based on the above formula (8), and at the same time, consider the range of change of the staged symmetrical pixel stretching, and then generate a preset value range stretching table. The range of variation of the staged symmetrical pixel stretching may include: for pixel points whose pixel values ​​are within 64 from the pixel value center 512 (pixel points whose pixel values ​​are located at [448,576]), the corresponding range stretching value is 0; for pixel points whose pixel values ​​are within 64 and within 128 from the pixel value center 512 (pixel points whose pixel values ​​are located at [384,448] and (576,640]), the corresponding range stretching value is ±1; for pixel points whose pixel values ​​are within 128 and within 192 from the pixel value center 512 (pixel points whose pixel values ​​are located at [320,384] and (640,704]), the corresponding range stretching value is ±2; for pixel points whose pixel values ​​are within 192 and within 256 from the pixel value center 512 (pixel points whose pixel values ​​are located at [256,320] and (704,768]), the corresponding range stretching value is ± 3; for pixel points whose pixel values ​​are within 256 and within 320 from the pixel value center 512 (pixel values ​​are located in [192, 256] and (768, 832]), the corresponding range stretching value is ±4; for pixel points whose pixel values ​​are within 320 and within 384 from the pixel value center 512 (pixel values ​​are located in [128, 192] and (832, 896]), the corresponding range stretching value is ±5; for pixel points whose pixel values ​​are within 384 and within 448 from the pixel value center 512 (pixel values ​​are located in [64, 128] and (896, 960]), the corresponding range stretching value is ±6; for pixel points whose pixel values ​​are within 448 and within 512 from the pixel value center 512 (pixel values ​​are located in [0, 64] and (960, 1023]), the corresponding range stretching value is ±7.

[0099] Second, dark-light protection. That is to say, for pixels with too low or too high pixel values, that is, the dark and bright parts of the image, changing their pixel values ​​may cause obvious block effects. Therefore, these pixels are not stretched, that is, the pixel values ​​are not changed.

[0100] For example, for an 8-bit image, the pixel values ​​at [0,8] and [248,255] correspond to a range stretching value of 0; for a 10-bit image, the pixel values ​​at [0,32] and [992,1023] correspond to a range stretching value of 0.

[0101] Third, size relationship protection. After the first and second conditions above are met, the size relationship between some pixel values ​​may change. For example: the pixel value of pixel a < the pixel value of pixel b. After looking up the range stretching table to determine the range stretching value and performing the range stretching, the pixel value of pixel a > the pixel value of pixel b. This situation needs to be avoided because the purpose of range stretching is to enhance the image contrast, but the original light and dark relationship needs to be retained. Therefore, after meeting the first and second conditions above, it is also necessary to control the range of pixel value changes.

[0102] For example, for 8-bit images, pixel values ​​need to be clipped to [8,248]; for 10-bit images, pixel values ​​need to be clipped to [32,992].

[0103] Based on the above three preset value range stretching conditions and the above formula (8), a preset value range stretching table can be generated, wherein the preset value range stretching table includes value range stretching values ​​corresponding to different pixel values.

[0104] In addition to the above-mentioned methods, the preset value range stretching conditions and the method of generating the preset value range stretching table may also be selected in other ways according to the actual application scenario, and the present disclosure does not make any specific limitations on this.

[0105] When performing range stretching on the bilateral filtered image block corresponding to the image block to be encoded, since the preset range stretching table includes range stretching values ​​corresponding to different pixel values, the range stretching value corresponding to each pixel point can be queried from the preset range stretching table according to the pixel value of each pixel point in the bilateral filtered image block, and then based on the range stretching value corresponding to each pixel point in the bilateral filtered image block, the bilateral filtered image block is range stretched to obtain the range stretched image block.

[0106] In one example, the range stretching can be performed on the bilaterally filtered image block based on the following formula (9) to obtain the range stretched image block:

[0107] buf stretch (i,j)=LUT(i,j)[buf bila (i,j)] (9).

[0108] Among them, buf stretch (i, j) is the pixel value of the pixel point (i, j) in the image block after bilateral filtering, obtained by performing range stretching on the pixel point (i, j) in the image block after bilateral filtering; LUT (i, j) is the range stretching value corresponding to the pixel point (i, j) in the image block after bilateral filtering obtained by querying the preset range stretching table.

[0109] In a possible implementation, based on an unsharp weighting coefficient, unsharp weighting processing is performed on the difference image block and the range stretched image block to obtain a preprocessed image block, including: based on the unsharp weighting coefficient, unsharp weighting processing is performed on the difference image block and the range stretched image block to obtain an unsharp weighted image block; based on a pixel value offset, pixel value clipping is performed on the unsharp weighted image block to obtain a preprocessed image block, wherein, for any pixel point in the unsharp weighted image block, when the pixel point is determined to be an edge pixel point based on an edge detection result, the pixel value offset corresponding to the pixel point is a first pixel value offset; when the pixel point is determined to be a non-edge pixel point based on an edge detection result, the pixel value offset corresponding to the pixel point is a second pixel value offset, and the second pixel value offset is greater than the first pixel value offset.

[0110] Before unsharp filtering, after bilateral filtering and range stretching are performed on the image block to be encoded, unsharp filtering can be performed based on the image block after range stretching as a reference.

[0111] In one example, unsharp weighting processing can be performed based on the following formula (10) to obtain an unsharp weighted image block:

[0112]

[0113] In order to prevent the pixel value from changing too much and causing the peak signal to noise ratio (PSNR) to drop too much, resulting in image distortion, the unsharp weighted image block is further subjected to pixel value clipping and then output as a preprocessed image block, so as to improve the subjective image quality of the preprocessed image block.

[0114] Since the processing range of edge pixels is larger than that of non-edge pixels during the unsharp filtering, the change range of edge pixels needs to be controlled when clipping pixel values. For non-edge pixels, the pixel value change range is smaller, so the change amount of pixel values ​​of non-edge pixels is not limited.

[0115] Therefore, different pixel value offsets are set for edge pixels and non-edge pixels, the edge pixels correspond to the first pixel value offset, the non-edge pixels correspond to the second pixel value offset, and the first pixel value offset is smaller than the second pixel value offset, so that different pixel value clipping of the edge area and the non-edge area in the unsharp filtered image block can be achieved based on texture characteristics to obtain the preprocessed image block.

[0116] The specific values ​​of the first pixel value offset and the second pixel value offset can be flexibly adjusted according to actual conditions, and the present disclosure does not make specific limitations on this.

[0117] For example, the first pixel value offset is set to 8, and the second pixel value offset is set to p max For 8-bit images, the second pixel value offset is p max =255; for a 10-bit image, the second pixel value offset is p max =1023.

[0118] In a possible implementation, based on the pixel value offset, the pixel value of the unsharp weighted image block is clipped to obtain the preprocessed image block, including: determining the upper limit and the lower limit of the pixel value based on the pixel value offset and the bilateral filtered image block; based on the upper limit and the lower limit of the pixel value, the pixel value of the unsharp weighted image block is clipped to obtain the preprocessed image block.

[0119] In one example, the pixel value of the unsharp weighted image block can be clipped based on the following formula (11) to obtain the preprocessed image block:

[0120] buf out (i,j)=clip(buf unsharp (i,j),max(buf bila (i,j)-offset,0),min(buf bila (i,j)+offset,p max ))(11).

[0121] in, offset0 is the offset of the first pixel value; offset1 is the offset of the second pixel value; buf out (i, j) is the pixel value of pixel (i, j) in the preprocessed image block; max(buf bila (i,j)-offset,0) is the lower limit of the pixel value of the pixel point (i,j), which is used to prevent the lower limit of the pixel value from being less than 0; min(buf bila (i,j)+offset,p max ) is the upper limit of the pixel value of the pixel point (i, j), which is used to prevent the upper limit of the pixel value from being greater than p max .

[0122] At this time, the preprocessing operations before encoding the image block to be encoded include: low-pass filtering, edge detection, bilateral filtering, range stretching, unsharp filtering based on texture characteristics, and pixel value clipping based on texture characteristics.

[0123] In the disclosed embodiments, low-pass filtering and bilateral filtering are window-level processing, and edge detection, range stretching, unsharp filtering based on texture characteristics, and pixel value clipping based on texture characteristics are pixel-level processing. Considering the hardware implementation issues of the video encoder, a distinction is made between window-level processing and pixel-level processing. Window-level processing uses the same image block to be encoded as input, and uses a filtering window of the same size, and stores the filtering results in a preset storage space for subsequent use in pixel-level processing, which is beneficial to the hardware pipeline implementation in the video encoder and improves efficiency.

[0124] In the disclosed embodiment, for the image block to be encoded in the video frame to be encoded, edge detection is performed on the image block to be encoded, and the edge detection result is determined. Based on the edge detection result, edge pixels and non-edge pixels in the image to be encoded can be determined. Since edge pixels are pixels with obvious and sharp changes in brightness in the image, they can reflect the texture characteristics of the image. The texture at the edge is complex and can tolerate greater distortion. Therefore, different unsharp weighting coefficients are set for edge pixels and non-edge pixels. The edge pixels correspond to the first unsharp weighting coefficient, and the non-edge pixels correspond to the second unsharp weighting coefficient, and the second unsharp weighting coefficient is less than the first unsharp weighting coefficient, so that different regions in the image block to be encoded can be subjected to unsharp filtering of different intensities based on the texture characteristics to obtain the preprocessed image block. Since unsharp filtering can enhance image details and improve subjective image quality, after encoding the preprocessed image block after unsharp filtering, the subjective quality of the encoding result can be effectively improved, so that the user's video viewing effect can be improved later.

[0125] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not repeat them. It can be understood by those skilled in the art that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined according to its function and possible internal logic.

[0126] In addition, the present disclosure also provides a video encoder, an electronic device, a computer-readable storage medium, and a program, all of which can be used to implement any video encoding method provided by the present disclosure. The corresponding technical solutions and descriptions are referred to the corresponding records in the method part and will not be repeated here.

[0127] Figure 3 A block diagram of a video encoder according to an embodiment of the present disclosure is shown. Figure 3 As shown, the video encoder 30 includes:

[0128] An edge detection module 31 is used to perform edge detection on the image block to be encoded in the video frame to be encoded, and determine an edge detection result;

[0129] An unsharp filtering module 32 is used to perform unsharp filtering on the image block to be encoded based on the unsharp weighting coefficient to obtain a preprocessed image block, wherein, for any pixel point in the image block to be encoded, when the pixel point is determined to be an edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a first unsharp weighting coefficient; when the pixel point is determined to be a non-edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a second unsharp weighting coefficient, and the second unsharp weighting coefficient is less than the first unsharp weighting coefficient;

[0130] The encoding module 33 is used to perform encoding processing on the pre-processed image block to obtain an encoding result corresponding to the image block to be encoded.

[0131] In a possible implementation, the unsharp filtering module 32 includes:

[0132] A neighborhood information determination submodule, for determining, for any pixel in the image block to be encoded, N×N neighborhood information centered on the pixel, where N is a positive integer greater than or equal to 3;

[0133] A low-pass filtering submodule is used to perform N×N low-pass filtering on the image block to be encoded based on N×N neighborhood information corresponding to each pixel in the image block to be encoded, so as to obtain an image block after low-pass filtering;

[0134] A difference submodule is used to calculate the difference between the image block to be encoded and the image block after low-pass filtering to obtain a difference image block;

[0135] The unsharp filter submodule is used to perform unsharp weighted processing on the image block to be encoded and the difference image block based on the unsharp weighted coefficient to obtain the preprocessed image block.

[0136] In a possible implementation, the low-pass filter submodule is specifically used to:

[0137] Based on a preset N×N low-pass filter kernel and N×N neighborhood information corresponding to each pixel in the image block to be encoded, an N×N low-pass filter is performed on the image block to be encoded to obtain an image block after low-pass filtering, wherein the sum of the N×N low-pass filter coefficients included in the N×N low-pass filter kernel is 256.

[0138] In a possible implementation, the unsharp filter submodule includes:

[0139] A bilateral filtering unit, configured to perform N×N bilateral filtering on the image block to be encoded based on N×N neighborhood information corresponding to each pixel in the image block to be encoded, so as to obtain an image block after bilateral filtering;

[0140] A range stretching unit, used for performing range stretching on the image block after bilateral filtering to obtain a range stretched image block;

[0141] The unsharp filtering unit is used to perform unsharp weighted processing on the difference image block and the image block after range stretching based on the unsharp weighted coefficient to obtain the preprocessed image block.

[0142] In a possible implementation, the bilateral filtering unit is specifically used to:

[0143] For any pixel point in the image block to be encoded, determine the similarity weight coefficient of the target neighborhood pixel point corresponding to the pixel point, wherein the target neighborhood pixel point corresponding to the pixel point is a pixel point whose pixel difference with the pixel point in the N×N neighborhood information corresponding to the pixel point is less than a threshold value;

[0144] Based on the N×N mean filter kernel, determine the distance weighting coefficient of the target neighborhood pixel point corresponding to the pixel point;

[0145] Determine the N×N bilateral filter kernel corresponding to the pixel point based on the similarity weighted coefficient and the distance weighted coefficient of the target neighborhood pixel point corresponding to the pixel point;

[0146] Based on the N×N neighborhood information corresponding to each pixel in the image block to be encoded and the N×N bilateral filter kernel, the image block to be encoded is subjected to N×N bilateral filtering to obtain an image block after bilateral filtering.

[0147] In a possible implementation, the range stretching unit is specifically used to:

[0148] Based on a preset value range stretching table, determining a value range stretching value corresponding to each pixel point in the image block after bilateral filtering, wherein the preset value range stretching table is determined based on a preset value range stretching condition, and the preset value range stretching table includes value range stretching values ​​corresponding to different pixel values;

[0149] Based on the range stretching value corresponding to each pixel point in the bilateral filtered image block, the range stretching is performed on the bilateral filtered image block to obtain the range stretched image block.

[0150] In a possible implementation, the unsharp filter unit includes:

[0151] An unsharp filter subunit, for performing unsharp weighted processing on the difference image block and the image block after range stretching based on an unsharp weighted coefficient to obtain an unsharp weighted image block;

[0152] The pixel value clip subunit is used to clip the pixel values ​​of the unsharp weighted image block based on the pixel value offset to obtain the preprocessed image block, wherein, for any pixel point in the unsharp weighted image block, when the pixel point is determined to be an edge pixel point based on the edge detection result, the pixel value offset corresponding to the pixel point is a first pixel value offset; when the pixel point is determined to be a non-edge pixel point based on the edge detection result, the pixel value offset corresponding to the pixel point is a second pixel value offset, and the second pixel value offset is greater than the first pixel value offset.

[0153] In a possible implementation, the pixel value clip subunit is specifically used to:

[0154] Based on the pixel value offset and the bilaterally filtered image block, an upper pixel value limit and a lower pixel value limit are determined;

[0155] Based on the upper and lower limits of the pixel value, the pixel value of the unsharp weighted image block is clipped to obtain the preprocessed image block.

[0156] This method has a specific technical connection with the internal structure of the computer system, and can solve the technical problem of how to improve the hardware computing efficiency or execution effect (including reducing the amount of data storage, reducing the amount of data transmission, increasing the hardware processing speed, etc.), thereby obtaining the technical effect of improving the internal performance of the computer system in accordance with the laws of nature.

[0157] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0158] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

[0159] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to call the instructions stored in the memory to execute the above method.

[0160] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0161] The electronic device may be provided as a terminal, a server, or a device in other forms.

[0162] Figure 4 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. Figure 4 , the electronic device 1900 can be provided as a server or a terminal device. Figure 4 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

[0163] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as a Microsoft Server operating system (Windows Server 2003). TM ), a graphical user interface operating system launched by Apple (Mac OS X TM ), a multi-user, multi-process computer operating system (Unix TM ), a free and open source Unix-like operating system (Linux TM ), an open source Unix-like operating system (FreeBSD TM ) or similar.

[0164] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.

[0165] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.

[0166] Computer readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. Computer readable storage medium can be, for example, (but not limited to) an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove on which instructions are stored, and any suitable combination thereof. The computer readable storage medium used here is not interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (for example, a light pulse by an optical fiber cable), or an electrical signal transmitted by a wire.

[0167] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0168] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may 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 may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

[0169] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0170] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0171] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0172] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

[0173] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.

[0174] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0175] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0176] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

[0177] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A video encoding method, characterized in that: include: For an image block to be encoded in a video frame to be encoded, performing edge detection on the image block to be encoded to determine an edge detection result; Based on the unsharp weighting coefficient, unsharp filtering is performed on the image block to be encoded to obtain a preprocessed image block, wherein, for any pixel point in the image block to be encoded, when the pixel point is determined to be an edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a first unsharp weighting coefficient; when the pixel point is determined to be a non-edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a second unsharp weighting coefficient, and the second unsharp weighting coefficient is less than the first unsharp weighting coefficient; The preprocessed image block is encoded to obtain an encoding result corresponding to the image block to be encoded.

2. The method according to claim 1, characterized in that The step of performing unsharp filtering on the image block to be encoded based on the unsharp weighting coefficient to obtain the preprocessed image block comprises: For any pixel point in the image block to be encoded, determine N×N neighborhood information centered on the pixel point, where N is a positive integer greater than or equal to 3; Based on N×N neighborhood information corresponding to each pixel in the image block to be encoded, performing N×N low-pass filtering on the image block to be encoded to obtain an image block after low-pass filtering; Calculating the difference between the image block to be encoded and the image block after low-pass filtering to obtain a difference image block; Based on the unsharp weighting coefficient, unsharp weighting processing is performed on the image block to be encoded and the difference image block to obtain the preprocessed image block.

3. The method according to claim 2, characterized in that The step of performing N×N low-pass filtering on the image block to be encoded based on the N×N neighborhood information corresponding to each pixel in the image block to be encoded to obtain the image block after low-pass filtering includes: Based on a preset N×N low-pass filter kernel and N×N neighborhood information corresponding to each pixel in the image block to be encoded, N×N low-pass filtering is performed on the image block to obtain the low-pass filtered image block, wherein the sum of the N×N low-pass filter coefficients included in the N×N low-pass filter kernel is 256.

4. The method according to claim 2, characterized in that: The step of performing unsharp weighted processing on the image block to be encoded and the difference image block based on the unsharp weighted coefficient to obtain the preprocessed image block comprises: Based on N×N neighborhood information corresponding to each pixel in the image block to be encoded, performing N×N bilateral filtering on the image block to be encoded to obtain a bilaterally filtered image block; Performing range stretching on the bilaterally filtered image block to obtain a range stretched image block; Based on the unsharp weighting coefficient, unsharp weighting processing is performed on the difference image block and the range-stretched image block to obtain the preprocessed image block.

5. The method according to claim 4, characterized in that The step of performing N×N bilateral filtering on the image block to be encoded based on N×N neighborhood information corresponding to each pixel in the image block to be encoded to obtain an image block after bilateral filtering includes: For any pixel point in the image block to be encoded, determine a similarity weight coefficient of a target neighborhood pixel point corresponding to the pixel point, wherein the target neighborhood pixel point corresponding to the pixel point is a pixel point whose pixel difference with the pixel point in the N×N neighborhood information corresponding to the pixel point is less than a threshold value; Based on the N×N mean filter kernel, determine the distance weighting coefficient of the target neighborhood pixel point corresponding to the pixel point; Determine the N×N bilateral filter kernel corresponding to the pixel point based on the similarity weighted coefficient and the distance weighted coefficient of the target neighborhood pixel point corresponding to the pixel point; Based on N×N neighborhood information corresponding to each pixel in the image block to be encoded and an N×N bilateral filter kernel, N×N bilateral filtering is performed on the image block to be encoded to obtain the bilaterally filtered image block.

6. The method according to claim 4, characterized in that The performing range stretching on the bilaterally filtered image block to obtain the range stretched image block includes: Determine a range stretching value corresponding to each pixel point in the bilaterally filtered image block based on a preset range stretching table, wherein the preset range stretching table is determined based on a preset range stretching condition, and the preset range stretching table includes range stretching values ​​corresponding to different pixel values; Based on the range stretching value corresponding to each pixel point in the bilaterally filtered image block, the bilaterally filtered image block is range stretched to obtain the range stretched image block.

7. The method according to claim 4, characterized in that The step of performing unsharp weighted processing on the difference image block and the range stretched image block based on the unsharp weighted coefficient to obtain the preprocessed image block comprises: Based on the unsharp weighting coefficient, performing unsharp weighting processing on the difference image block and the range stretched image block to obtain an unsharp weighted image block; Based on the pixel value offset, the unsharp weighted image block is clipped to obtain the preprocessed image block, wherein, for any pixel point in the unsharp weighted image block, when the pixel point is determined to be an edge pixel point based on the edge detection result, the pixel value offset corresponding to the pixel point is a first pixel value offset; when the pixel point is determined to be a non-edge pixel point based on the edge detection result, the pixel value offset corresponding to the pixel point is a second pixel value offset, and the second pixel value offset is greater than the first pixel value offset.

8. The method according to claim 7, characterized in that The step of clipping the pixel values ​​of the unsharp weighted image block based on the pixel value offset to obtain the preprocessed image block comprises: Determining a pixel value upper limit and a pixel value lower limit based on the pixel value offset and the bilaterally filtered image block; Based on the upper pixel value limit and the lower pixel value limit, the pixel value of the unsharp weighted image block is clipped to obtain the preprocessed image block.

9. A video encoder, characterized in that include: An edge detection module is used to perform edge detection on an image block to be encoded in a video frame to be encoded, and determine an edge detection result; An unsharp filtering module, configured to perform unsharp filtering on the image block to be encoded based on an unsharp weighting coefficient to obtain a preprocessed image block, wherein, for any pixel point in the image block to be encoded, when the pixel point is determined to be an edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a first unsharp weighting coefficient; when the pixel point is determined to be a non-edge pixel point based on the edge detection result, the unsharp weighting coefficient corresponding to the pixel point is a second unsharp weighting coefficient, and the second unsharp weighting coefficient is less than the first unsharp weighting coefficient; The encoding module is used to perform encoding processing on the preprocessed image block to obtain an encoding result corresponding to the image block to be encoded.

10. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method described in any one of claims 1 to 8.

11. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Intra-frame division method and device based on guiding filtering and edge detection and medium

    CN113518220A

  • Image processing method and device, electronic equipment and readable storage medium

    CN114782279A

  • Aircraft electric power inspection system based on binocular vision

    CN115631116A