Real-time transcoding method for enhancing bright structure quantization of low-light live video
By combining video transcoding and enhancement in low-illumination video transcoding, we study the relationship between quantization factors and illumination coefficients on PSNR-LY, and establish a model to optimize the light structure quantization factor, which solves the problem of low-illumination video transcoding quality in the existing technology. and the problem of inaccurate bit rate control, achieving video quality improvement and minimizing the bit rate.
Patent Information
- Application Number
- CN202311856203.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-12-29
AI Technical Summary
The existing technology lacks a special illumination algorithm for low-light videos during the low-light video transcoding process, resulting in the inability to effectively improve the video quality and control the bit rate, and separate video transcoding and enhancement will increase the decoding and encoding process. Resulting in loss of video quality.
Construct a low-light video transcoding framework, combine video transcoding and video enhancement, and establish the PSNR-LY and R-LY models of low-light video transcoding by studying the relationship between quantization factors, video content and illumination coefficients on PSNR-LY. The theoretical formula of brightening for low-light video transcoding is derived, and the selection of brightening factors is optimized to improve video quality and reduce bit rate.
It achieves the improvement of video quality and the minimization of bit rate in low-light video transcoding, avoiding additional decoding and encoding processes, and ensuring the transcoding effect with the highest possible video quality and the lowest bit rate.
Smart Images

Figure CN117979006B
Abstract
Description
Technical Field
[0001] The present application relates to a low-illumination video transcoding brightness quantization method, and in particular to a low-illumination live video real-time transcoding enhanced brightness quantization method, belonging to the technical field of low-illumination video transcoding enhancement. Background Art
[0002] With the development of network and multimedia technology, video transcoding technology is increasingly used in the fields of network live broadcast, learning and work, entertainment, military, security, etc. Video transcoding refers to converting video compression stream from one type to another. It is of great value for video applications in heterogeneous network environments such as mobile video communication, video live broadcast, and intelligent video surveillance. For example, in the field of intelligent video surveillance, it is necessary to save recent surveillance videos at a lower bit rate, so bit rate reduction transcoding is required. In mobile video communication and live broadcast, the terminals and network bandwidths used by users are different. How to convert video streams to adapt to different network bandwidths, different terminal processing capabilities, and different user needs has brought huge challenges to video transcoding technology.
[0003] However, in many practical applications, such as monitoring systems, a large number of videos are shot at night under low illumination conditions, and the video images are often blurred and of poor quality. For such videos, low-illumination video transcoding is required, that is, video enhancement is performed during the transcoding process to transcode the initial low-illumination video into a normal-illumination video, which has important application value for low-illumination video application scenarios such as monitoring systems. The use of video enhancement processing technology can effectively improve the quality of low-illumination video content. The transcoding service that includes video enhancement technology can not only flexibly change the transcoding parameters of the video, but also make the video content with low visibility clearer. Therefore, the exploration of low-illumination video transcoding technology with video enhancement function has great academic and application value.
[0004] Video transcoding quantization refers to the process of decoding the bitstream that has been quantized once and then input into the transcoding system and then re-encoding and quantizing it. Video quantization is a lossy process that will cause quantization distortion. The video transcoding quantization algorithm can reduce this quantization distortion by selecting the best quantization factor, making the quality of the transcoded video as high as possible while consuming as little bit rate as possible.
[0005] The existing video transcoding quantization algorithms are all for videos with good lighting, but the enhancement of low-light videos will affect the transcoding peak signal-to-noise ratio (PSNR) and the relationship between the transcoding bit rate (Rate) and the light structure quantization factor (LY). Therefore, it is necessary to develop a light structure quantization algorithm for low-light video enhancement transcoding. The light structure quantization algorithm for low-light video transcoding plays an important guiding role in selecting the appropriate transcoding quantization factor. It selects the quantization factor with the lowest bit rate while ensuring that the PSNR of low-light video transcoding is as high as possible.
[0006] The existing video transcoding quantization technology is applied in two aspects: the quantization technology under the same standard is applied in bit rate reduction transcoding; the quantization technology under different standards is a mapping method of quantization factors under different video standards. Bit rate reduction transcoding is widely used in transmission fields such as WiFi transmission, network video streaming, and real-time video broadcasting. Bit rate reduction transcoding refers to quantizing the compressed video stream to reduce it from a larger initial bit rate to a lower target bit rate, thereby adapting to the requirements of network bandwidth. The bit rate is reduced to meet the transmission network conditions while ensuring video quality. In the bit rate reduction transcoding algorithm, research focuses on quantization and bit rate control after quantization. The quantization algorithm is the selection of quantization factors. This selection is not based on the rate distortion model. Therefore, although the bit rate can be reduced, the bit rate cannot be accurately controlled to the target value.
[0007] Video enhancement is an essential operation for blurry low-light video sequences. It is a new and meaningful research and development to perform video transcoding highlight quantization and video enhancement simultaneously, explore the corresponding relationship between the highlight quantization factor and the peak signal-to-noise ratio and bit rate after the low-light video is enhanced, and predict the optimal point of the highlight quantization factor to obtain the best peak signal-to-noise ratio and bit rate.
[0008] The problems to be solved by the prior art low-light video transcoding enhancement and bright structure quantization method and the key technical difficulties of this application include:
[0009] (1) The video transcoding quantization algorithms in the prior art are all for videos with good illumination. However, the enhancement processing of low-illumination videos will affect the transcoding peak signal-to-noise ratio (PSNR) and the relationship between the transcoding bit rate (Rate) and the highlight quantization factor (LY). There is a lack of a special highlight quantization algorithm in the process of low-illumination video enhancement transcoding, which is not conducive to selecting a suitable transcoding quantization factor. It is impossible to select the quantization factor with the lowest bit rate while ensuring that the PSNR of low-illumination video transcoding is as high as possible. The selection of the highlight quantization factor in the prior art is not based on the rate-distortion model. Although it can reduce the bit rate, it cannot accurately control the bit rate to the target value. For low-illumination blurry video sequences, the prior art lacks a method for performing video transcoding highlight quantization and video enhancement at the same time. There is a lack of exploration of the corresponding relationship between the highlight quantization factor and the peak signal-to-noise ratio and bit rate after the low-illumination video is enhanced. It is impossible to predict the optimal point of the highlight quantization factor to obtain the best peak signal-to-noise ratio and bit rate.
[0010] (2) In view of the insufficient clarity of videos recorded under low illumination conditions, the existing video transcoding technology has not yet taken into account the impact of video enhancement. Separating video transcoding and video enhancement will cause new problems. Since video enhancement processes videos in the spatial domain, if video enhancement is performed first and then video transcoding is performed, the bitstream that has been encoded once needs to be decoded first, then video enhanced, and then the quantized normal illumination bitstream needs to be input into the transcoding system. This will add a decoding and encoding process, which is time-consuming and will cause additional video quality loss. If video transcoding is performed first and then video enhancement is performed, since the quantization model has a more obvious effect on the quality of low illumination videos than on normal illumination videos, in addition to adding a decoding and encoding process, it will also cause more serious video quality loss. In view of the above situation, there is an urgent need for a method to combine low-illumination video enhancement and video transcoding, perform video enhancement during the video transcoding process, analyze the connection and difference between low-illumination video transcoding and normal-illumination video transcoding, and obtain a low-illumination video transcoding highlight quantization algorithm. The highlight quantization factor selected by this algorithm can ensure the lowest transcoding bit rate while ensuring the highest possible video quality.
[0011] (3) The existing video transcoding brightness quantization algorithms are all for normal illumination videos. For low illumination video transcoding, the video enhancement process will seriously affect the transcoded video quality and the relationship between the transcoding bit rate and the brightness quantization factor, resulting in the normal illumination video transcoding brightness quantization algorithm is no longer applicable. The existing technology lacks a low illumination video transcoding framework, and cannot combine video transcoding with low illumination video enhancement; lacks research on the relationship between quantization factor, video content, and illumination coefficient on PSNR-LY (video quality-quantization factor), lacks PSNR-LY model and R-LY (bit rate-quantization factor) model for low illumination video transcoding; the mapping relationship between the quantization factors of low illumination video and normal illumination video is unclear, lacks a low illumination video transcoding brightness quantization theoretical formula, lacks PSNR-LY, R-LY model and experimental analysis, and cannot correct the theoretical formula, and cannot accurately calculate the optimal brightness quantization factor of the low illumination video. The video transcoding bit rate is high and the video quality loss is serious. Summary of the invention
[0012] The existing video transcoding brightness quantization algorithms are all for normal illumination videos. For low illumination video transcoding, the video enhancement process will seriously affect the transcoded video quality and the relationship between the transcoding bit rate and the brightness quantization factor, resulting in the problem that the normal illumination video transcoding brightness quantization algorithm is no longer applicable. This application has made three improvements: First, a low illumination video transcoding framework is constructed to combine video transcoding and low illumination video enhancement; second, the influence of quantization factors, video content, and illumination coefficient on the PSNR-LY relationship is studied within this framework, and the factors affecting the selection of the optimal brightness quantization factor are found through theoretical analysis and experiments, and the PSNR-LY model and R-LY model of low illumination video transcoding are established; third, the mapping relationship between the quantization factors of low illumination video and normal illumination video is studied, and the theoretical formula of brightness quantization for low illumination video transcoding is derived, and then the theoretical formula is corrected through PSNR-LY, R-LY models and experimental analysis to obtain the final low illumination video transcoding brightness quantization factor selection formula. The high-light quantization algorithm for low-illumination video transcoding is obtained. The high-light quantization factor selected by the algorithm can ensure the lowest transcoding bit rate while ensuring the highest possible video quality.
[0013] In order to achieve the above technical effects, the technical solutions adopted in this application are as follows:
[0014] The method for enhancing the brightness structure quantization of low-light live video in real-time transcoding combines low-light video enhancement with video transcoding, performs video enhancement during the video transcoding process, and uses the brightness structure quantization factor selected by the low-light video transcoding brightness structure quantization algorithm to ensure the highest possible video quality while minimizing the transcoding bitrate.
[0015] 1) Construct a low-light video transcoding framework: After the low-light video is quantized once by the H.264 encoder and input into the transcoding system, it is first decoded, then enhanced, and finally quantized by the transcoding structure, and the enhanced transcoded bitstream is output;
[0016] 2) Analyze the effects of quantization factor, video content and illumination coefficient on PSNR-LY relationship: In the framework of low-light video transcoding, analyze the variation of PSNR-LY curve under different quantization factors, different video content and different illumination coefficients, and construct PSNR-LY and R-LY models for low-light video transcoding;
[0017] 3) A low-illumination video transcoding brightness quantization algorithm is proposed: By analyzing the low-illumination video quantization model, the mapping rules of quantization factors in the low-illumination video and normal-illumination video encoding quantization models are obtained, and the selection formula of the low-illumination video transcoding brightness quantization factor under ideal conditions is derived. Then, according to the obtained PSNR-LY model, the low-illumination video transcoding brightness quantization algorithm formula is corrected, and finally the low-illumination video transcoding brightness quantization factor calculation formula is obtained. According to the illumination coefficient and the size of the primary quantization factor in the input transcoding system bitstream, it is judged whether it is necessary to perform image enhancement and transcoding. If enhanced transcoding is required, the corresponding transcoding brightness quantization factor should be selected to obtain the optimal transcoding effect, ensuring that the selected quantization factor minimizes the brightness quantization distortion and the highest quality of the transcoded video. On the premise of ensuring that the video quality is at the same level as the highest quality, a transcoding brightness quantization factor with a lower bit rate should be selected as much as possible.
[0018] Preferably, the low-light video real-time transcoding framework: the low-light blurred video sequence VIDEO.yuv is encoded by the H.264 encoder to obtain the low-light code stream VIDEO_LY1.264, which is quantized once, and then the VIDEO_LY1.264 code stream is input into the transcoding system, and is dequantized by the H.264 decoder, and the quantization factor LY1 of the first encoding and the decoded video sequence VIDEO_LY1.yuv are obtained by parsing the code stream information, and the video enhancement is performed on VIDEO_LY1.yuv to obtain the enhanced video. The enhanced sequence is quantized and encoded with LY2 to obtain VIDEO_LY1_ENHANCE_LY2.264. In the whole process of transcoding the initial sequence VIDEO.yuv to the final output bitstream VIDEO_LY1_ENHANCE_LY2.264, it undergoes two quantization models. When it is encoded as the transcoding input sequence VIDEO_LY1.264, it undergoes the first encoding quantization. After entering the transcoding part, it undergoes the second encoding quantization.
[0019] When performing low-illumination transcoding brightness quantization, the transcoded PSNR value is calculated with reference to the initial normal illumination video sequence. Under the premise of ensuring the best possible video quality, the LY2 calculated by the transcoding brightness quantization algorithm should minimize the transcoded bit rate. It is necessary to optimize the relationship between transcoding PSNR and LY2, and the transcoding bit rate R and LY2. The relationship between transcoding PSNR-LY is determined by three factors: quantization model, video content, and low illumination level.
[0020] Preferably, the quantization factor acts on the transcoding PSNR-LY relationship: the transcoding platform has two processes to quantize the video: the code stream is quantized once by the encoder, and the transcoding part is quantized by the encoder; the quantization operation process is expressed as:
[0021]
[0022] Where F(u, v) represents the DCT coefficients of the original video sequence before quantization, F Q (u, v) represents the DCT coefficient of the quantized video, Q(u, v) represents the quantization weighting matrix, q is the quantization step size, and its value is related to the quantization factor LY, round[] is the rounding function, and the peak signal-to-noise ratio PSNR value is used as the objective evaluation standard of video quality;
[0023] Under low illumination conditions, the optimal LY2 value is greater than LY1, and as LY1 increases, the optimal LY2 value will increase accordingly, and the inflection point will gradually move backward.
[0024] Preferably, a PSNR-LY model for low-light video transcoding: a PSNR-LY curve is quantitatively analyzed to construct a PSNR-LY model for H.264 low-light video transcoding. The variation law of the transcoded PSNR value PSNR2 (LY1, LY2) with OP is approximately fitted into a cubic function curve, which is expressed as:
[0025] PSNR2(LY1,LY2)=α·LY2 3 +β·LY2 2 +γ·LY2+δ Formula 2
[0026] The values of the four parameters α, β, γ, and δ are related to the three factors of the primary quantization factor LY1, the low illumination level i1, and the video content. α<0, β>0, γ<0, δ>0, and the value range of α is [-4×10 -4 , -1×10 -5 ], the value range of β is [20, 35]. The values of the four parameters α, β, γ, and δ are greatly affected by the low illumination level i;
[0027] After fitting the PSNR-LY curve into a cubic function curve, the value of PSNR2(LY1, LY2) must have an extreme point, that is, when LY2=LY2', the derivative of the cubic function curve PSNR2'(LY1, LY2)=0, and PSNR2(LY1, LY2) reaches the maximum value PSNR 2max (LY1, LY2), that is, when LY2>LY2′, the derivative of the cubic function curve PSNR2′(LY1, LY2)=0, and the value of PSNR2(LY1, LY2) rises slowly or remains basically unchanged: that is, when LY2>LY2′, the derivative of the cubic function curve PSNR2′(LY1, LY2)<0, and the value of PSNR2(LY1, LY2) drops rapidly;
[0028] By analyzing the degree of low illumination, the primary quantization factor information carried by the input bitstream and the video content of the initial bitstream, a curve model of peak signal-to-noise ratio PSNR2(LY1, LY2) and highlight quantization factor LY2 is established to predict the optimal transcoding highlight quantization factor, so that the transcoded video quality is optimal and the transcoding bitrate is low.
[0029] Preferably, the R-LY model for low illumination video transcoding: the rate-distortion model is introduced into the low illumination video transcoding to establish the R-LY model. The quantization factor LY determines the degree to which the video image information is compressed. The larger the LY, the greater the degree to which the image is compressed, the more information is lost, and the lower the bit rate consumed. The quantization factor LY and the bit rate rate are inversely proportional. R-LY is an inversely proportional function. Different low illumination levels, primary quantization factors, and bit streams of video content are selected for calculation.
[0030] The relationship model between the bit rate and the brightness quantization factor in the low-light video transcoding process is fitted using Formula 3:
[0031]
[0032] Where R represents the transcoding rate, X1 and X2 are coefficients, and Q step is the quantization step length, and its value corresponds to the quantization factor LY one by one. The transcoding bit rate R is inversely proportional to the quantization factor LY. The larger the quantization factor LY, the smaller the transcoding bit rate R. In order to make the bit rate consumed in the transcoding process as low as possible, when selecting the optimal quantization factor, the larger quantization factor should be given priority. When selecting the qualified quantization factor in the A interval, directly select the largest LY2 in the range, which meets the requirements of transcoding quality and transcoding bit rate.
[0033] Preferably, the low illumination and normal illumination video quantization factor mapping association model: firstly, the input compressed bitstream is decoded to obtain the primary quantization factor in the bitstream information, and the decoded information is dequantized with the primary quantization factor to reconstruct the initial YUV sequence, and after the YUV sequence is input to the encoding end, the encoding end uses a larger quantization factor for quantization, and then performs entropy encoding, and finally outputs the encoded bitstream;
[0034] m and n represent the grayscale values of two different pixels in a frame of the initial video. Q1 and Q2 represent two quantization processes. -1 and Q2 -1 Represent two dequantization processes respectively;
[0035] For the input value m, after two quantizations and two dequantizations, its reconstructed value is:
[0036]
[0037] If Q2 is used directly for quantization and dequantization without quantization, the reconstructed value is:
[0038]
[0039] For the input gray value m, the reconstructed value is the same after two quantizations of Q1 and Q2 as after only one quantization of Q2, and no error is introduced;
[0040] For the gray value n, the reconstructed value after two quantizations and dequantizations is:
[0041]
[0042] The reconstructed value after only one quantization and dequantization of Q2 is:
[0043]
[0044] For the input grayscale value n, the reconstructed value after two quantizations of Q1 and Q2 is different from the reconstructed value after only one quantization of Q2, resulting in an error △=NM. The secondary quantization error becomes the reconstructed quantization error. The image grayscale value is transformed by DCT, and then the transformed coefficients are marked on the horizontal coordinate axis according to their amplitude values.
[0045] Preferably, assuming that the quantization factor of the initial low-light video is Q1, and the quantization factor of the encoder for encoding the enhanced YUV sequence during the transcoding process is Q2, the distortion caused by the one-time encoding quantization is expressed as formula 8:
[0046]
[0047] Where y represents the DCT coefficient, p(y) represents the probability density function of the DCT coefficient distribution, and after double quantization with the quantization factor Q2, the distortion caused by the double quantization is expressed as formula 9:
[0048]
[0049] The magnitude of the two quantization distortion values is determined by the DCT coefficients and the quantization step sizes of the two quantizations. Based on the relationship between the DCT coefficients of the normal illumination video and the video after the illumination is reduced, the relationship between the quantization factors of the normal illumination video and the low illumination video under the same distortion conditions is obtained; an 8×8 image block is established, and an 8×8 DCT coefficient block is obtained after the image block is subjected to DCT transformation;
[0050] Multiply the gray value of each pixel by 0.9, 0.8…0.2, 0.1 in turn, round the result to the nearest integer, and then perform DCT transformation on the obtained 9 groups of 8×8 image blocks to obtain 9 DCT coefficient blocks. Plot the relationship between the low-frequency components of these DCT coefficient blocks and the gray value multiplied coefficient as a curve. The DCT coefficient changes linearly with the gray value of the pixel. When the normal illumination video is subjected to illumination reduction processing, if the weighted coefficient for reducing illumination is i1, under absolutely ideal conditions, after the low illumination video is subjected to DCT transformation, the conversion relationship between its DCT coefficient y' and the DCT coefficient y of the normal illumination video is y'=y*i1;
[0051] To make the distortion of low illumination video and normal illumination video consistent after one quantization, the following relationship is adopted for one quantization step length:
[0052]
[0053] where Q′ step Indicates the quantization step size of low-light video, Q step represents the quantization step size of the normal illumination video, i1 represents the weighted coefficient of the illumination change between the two videos, based on the mapping relationship between the quantization coefficient and the quantization step size, Qstep = T(LY1), and equation 10 is written as:
[0054]
[0055] After obtaining the corresponding low-light video quantization step size, reverse lookup is performed to obtain the corresponding low-light video primary quantization factor LY1':
[0056]
[0057] T and T -1They represent table lookup and reverse table lookup respectively. The weighting coefficient i1 reflects the low illumination degree of the low illumination video. The mapping relationship between the quantization factors of videos with different low illumination degrees and normal illumination videos under the ideal state is obtained through formula 12.
[0058] Introducing a correction coefficient σ, correcting equation 12, we get equation 13:
[0059]
[0060] When the bright structure quantization factor LY2=LY1, the overall performance of transcoded video quality and bit rate is the best. Combining the mapping relationship of formula 13, the selection formula 14 for the optimal bright structure quantization factor in low-illumination video transcoding bright structure quantization is obtained:
[0061]
[0062] Calculation of correction factor:
[0063]
[0064] Among them, LY 2(理论) It is expressed as formula 16:
[0065]
[0066] Calculate the correction coefficient σ corresponding to different illumination coefficients i1 and different primary quantization factors LY1 i1 , determine the corresponding correction coefficient σ under different LY1 and i1 i1 After that, any low-light video bitstream input to the transcoding system is decoded to obtain the primary quantization factor LY1 and the illumination coefficient i1, and the theoretical value LY of the optimal brightness quantization factor is calculated. 2(理论) , and then use the corresponding correction coefficient σ i1 The correction is performed to obtain the optimal bright structure quantization factor of the low-illumination video.
[0067] Preferably, the low-light video transcoding light structure quantization algorithm process: when transcoding any input video, the following three judgment rules are set:
[0068] Rule 1: After a video is encoded once, it is input into the transcoding system. After being decoded by the decoder in the transcoding system, the quantization factor LY1 and image grayscale value used in the first encoding are obtained. The dynamic range of the grayscale value is compared with the dynamic range of the grayscale value of the normal illumination video (0-255). If the dynamic range of the grayscale value of the video image is i1 times that of the normal illumination video, and i1>0.6, the video illumination is good and no image enhancement and transcoding are required;
[0069] Rule 2: When i1 < 0.6, it meets the criteria for low-light video and enters the next process to determine the degree of low light. According to the value of i1, the low-light video is divided into three levels: slight low light (0.6 ≥ i1 > 0.4), medium low light (0.4 ≥ i1 > 0.2), and severe low light (i ≤ 0.2). For slight low-light video, when LY1 > 34, the video quality after one encoding is already poor. After video enhancement and secondary encoding, the subjective quality of the video is very poor and unacceptable to the audience. Therefore, there is no need for image enhancement and transcoding. For medium low-light video, when LY1 > 30, there is no need for image enhancement and transcoding. For severe low-light video, when LY1 > 28, there is no need for image enhancement and transcoding.
[0070] Rule 3: In addition to the above two cases, the input video in other cases needs to be enhanced and transcoded for brightness quantization. The corresponding correction coefficient σ is obtained according to the video illumination parameter i1 and the primary quantization factor LY1. i1 , and then select the optimal highlight quantization factor LY2, which can ensure the lowest transcoding bit rate while ensuring the quality of the transcoded video is as good as possible.
[0071] Preferably, the low-illumination video transcoding brightness quantization algorithm divides the video into three levels according to the low-illumination degree. For different illumination parameters and different primary quantization factors, the value of the correction parameter is also different. For slightly low-illumination video, when LY1≤16, the correction parameter σ is 2; when 16<LY1≤20, the correction parameter σ is -2; when 20<LY1≤34, the correction parameter σ is -4; when LY1>34, the video quality is intolerable and no video enhancement and transcoding operations are required; for moderately low-illumination video, when LY1≤16, the correction parameter σ is 0; when 16<LY1≤20, the correction parameter σ is -4; when LY1>34, the video quality is intolerable and no video enhancement and transcoding operations are required; The positive parameter σ is -2; when 20<LY1≤24, the correction parameter σ is -4; when 24<LY1≤30, the correction parameter σ is -6; when LY1>30, the video quality is intolerable, and no video enhancement and transcoding operations are required; for severe low-light videos, when LY1≤16, the correction parameter σ is -2; when 16<LY1≤22, the correction parameter σ is -4; when 22<LY1≤26, the correction parameter σ is -6; when 26<LY1≤28, the correction parameter σ is -8; when LY1>28, the video quality is intolerable, and no video enhancement and transcoding operations are required;
[0072] When a low-light video is input into the transcoding system, the decoder in the transcoding system decodes the video, analyzes the decoded information to obtain the value of the primary quantization factor LY1 and the illumination parameter i1, and based on the correction coefficient σ in different situations, finally according to the formula QP2 = T -1[T(QP1) / i1]+σ, the value of the optimal bright structure quantization factor of the low-illumination video is obtained.
[0073] Compared with the prior art, the innovations and advantages of this application are:
[0074] (1) The existing video transcoding brightness quantization algorithms are all for normal illumination videos. For low illumination video transcoding, the video enhancement process will seriously affect the transcoded video quality and the relationship between the transcoding bit rate and the brightness quantization factor, resulting in the problem that the normal illumination video transcoding brightness quantization algorithm is no longer applicable. This application has made three improvements: First, a low illumination video transcoding framework is constructed to combine video transcoding and low illumination video enhancement; second, within this framework, the influence of quantization factor, video content, and illumination coefficient on the PSNR-LY (video quality-quantization factor) relationship is studied, and the factors affecting the selection of the optimal brightness quantization factor are found through theoretical analysis and experimental data, and the PSNR-LY model and R-LY (bit rate-quantization factor) model of low illumination video transcoding are established; third, the mapping relationship between the quantization factors of low illumination video and normal illumination video is studied, and the brightness quantization theoretical formula of low illumination video transcoding is derived. Then, the theoretical formula is corrected through the PSNR-LY, R-LY model and experimental analysis to obtain the final low illumination video transcoding brightness quantization factor selection formula. This application combines low-illumination video enhancement and video transcoding, performs video enhancement during the video transcoding process, and analyzes the connection and difference between low-illumination video transcoding and normal-illumination video transcoding. Through theoretical analysis and experimental verification, a low-illumination video transcoding highlight quantization algorithm is obtained. The highlight quantization factor selected by the algorithm can ensure the lowest transcoding bit rate while ensuring the highest possible video quality.
[0075] (2) For the low-illumination video input into the transcoding system, the present application first analyzes the decoded information to obtain the value of the primary quantization factor and the illumination coefficient, thereby determining the corresponding correction coefficient, and then according to the low-illumination video transcoding illumination quantization factor selection formula, the optimal illumination quantization factor of the low-illumination video can be calculated. Experimental verification analysis shows that in the case of slight low illumination (illumination coefficient is 0.5), the error between the selected illumination quantization factor LY and the optimal illumination quantization factor LY is 0; in the case of moderate low illumination (illumination coefficient is 0.3), the maximum error between the LY selected by the present algorithm and the optimal LY is 2, the corresponding average PSNR error is -0.013db, and the corresponding average Rate error is -3.3%; in the case of severe low illumination (illumination coefficient is 0.2), the maximum error between the LY selected by the present application and the optimal LY is 2, the corresponding average PSNR error is 0.01db, and the corresponding average Rate error is 6.73%. The transcoding illumination quantization factor selected by the present algorithm is very close to the optimal illumination quantization factor, and can simultaneously meet the requirements of high quality and low bit rate.
[0076] (3) The present application proposes a low-illumination video transcoding brightness quantization algorithm. By analyzing the low-illumination video quantization model, the mapping law of quantization factors in the low-illumination video and normal-illumination video encoding quantization models is obtained, and the selection formula of the low-illumination video transcoding brightness quantization factor under ideal conditions is derived. Then, according to the obtained PSNR-LY model, the low-illumination video transcoding brightness quantization algorithm formula is corrected, and finally the low-illumination video transcoding brightness quantization factor calculation formula is obtained. According to the illumination coefficient and the size of the primary quantization factor in the input transcoding system bitstream, it is judged whether it is necessary to perform image enhancement and transcoding. If enhanced transcoding is required, the corresponding transcoding brightness quantization factor is selected to obtain the optimal transcoding effect, ensuring that the selected quantization factor minimizes the brightness quantization distortion and the highest quality of the transcoded video. On the premise of ensuring that the video quality is at the same level as the highest quality, the transcoding brightness quantization factor with a lower bit rate is selected as much as possible. The low illumination video enhancement is combined with video transcoding, and the video enhancement is performed during the video transcoding process. The brightness quantization factor selected by the low illumination video transcoding brightness quantization algorithm ensures the lowest transcoding bit rate while ensuring the highest possible video quality.
[0077] Figure determination
[0078] Figure 1 It is a schematic diagram of the fitting relationship curve between PSNR2(LY1, LY2) and LY2.
[0079] Figure 2 This is the Avenuc transcoding bitrate statistics for medium-low illumination sequences.
[0080] Figure 3 This is a diagram of the initial bitstream undergoing two quantization and two reconstruction processes.
[0081] Figure 4 It is a schematic diagram of the quantization values of the DCT coefficients in the two quantization processes.
[0082] Figure 5 It is a schematic diagram of an 8×8 block before and after DCT transformation.
[0083] Figure 6 It is a flow chart of the low-light video transcoding light structure quantization algorithm.
[0084] Figure 7 This is a schematic diagram of the PSNR-Rate curve under slightly low illumination.
[0085] Figure 8 It is a schematic diagram of the experimental subjective comparison of slightly low-light videos.
[0086] Fig. 9 This is a schematic diagram of the PSNR-Rate curve under severe low illumination.
[0087] Fig.10 It is a schematic diagram of the experimental subjective comparison of severe low-light videos. DETAILED DESCRIPTION
[0088] The following, in conjunction with the accompanying drawings, further describes the technical solution of the low-illumination live video real-time transcoding enhanced bright structure quantization method provided by the present application, so that technical personnel in the field can better understand the present application and implement it.
[0089] Video transcoding refers to converting a video bitstream that has been encoded and compressed into another video bitstream, which can effectively solve the problem of compatibility of video data on different platforms and terminal devices. The video transcoding brightness quantization algorithm refers to selecting the best brightness quantization factor to consume the minimum bit rate while ensuring the quality of the transcoded video is as high as possible. The existing video transcoding brightness quantization algorithms are all for normal illumination videos. For low illumination video transcoding, the normal illumination video transcoding brightness quantization algorithm is no longer applicable because the video enhancement process will seriously affect the transcoded video quality and the relationship between the transcoding bitrate and the brightness quantization factor.
[0090] In response to this problem, the present application has done the following work: 1) construct a low-light video transcoding framework, combining video transcoding and low-light video enhancement; 2) within this framework, study the influence of quantization factor, video content, and illumination coefficient on the PSNR-LY (video quality-quantization factor) relationship, find out the factors affecting the selection of the optimal brightness structure quantization factor through theoretical analysis and experimental data, and establish the PSNR-LY model and R-LY (bit rate-quantization factor) model for low-light video transcoding; 3) study the mapping relationship between the quantization factors of low-light video and normal-light video, derive the theoretical formula for brightness structure quantization of low-light video transcoding, and then correct the theoretical formula through PSNR-LY, R-LY model and experimental analysis to obtain the final low-light video transcoding brightness structure quantization factor selection formula. For the low-light video input into the transcoding system, the algorithm of the present application first analyzes the decoded information to obtain the value of the primary quantization factor and the illumination coefficient, thereby determining the corresponding correction coefficient, and then according to the low-light video transcoding brightness structure quantization factor selection formula, the optimal brightness structure quantization factor of the low-light video can be calculated.
[0091] The experimental verification analysis of the algorithm of this application shows that in the case of slight low illumination (illuminance coefficient is 0.5), the error between the selected highlight quantization factor LY and the optimal highlight quantization factor LY is 0; in the case of medium low illumination (illuminance coefficient is 0.3), the maximum error between the LY selected by this algorithm and the optimal LY is 2, the corresponding PSNR average error is -0.013db, and the corresponding Rate average error is -3.3%; in the case of severe low illumination (illuminance coefficient is 0.2), the maximum error between the LY selected by this application and the optimal LY is 2, the corresponding PSNR average error is 0.01db, and the corresponding Rate average error is 6.73%. The transcoding highlight quantization factor selected by the algorithm of this application is very close to the optimal highlight quantization factor, which can take into account the requirements of high quality and low bit rate at the same time.
[0092] 1. Low-light video real-time transcoding framework
[0093] The low-light blurred video sequence VIDEO.yuv is encoded through the H.264 encoder to obtain the low-light code stream VIDEO_LY1.264 (one quantization), and then the VIDEO_LY1.264 code stream is input into the transcoding system, and is dequantized by the H.264 decoder. The quantization factor LYl during the first encoding and the decoded video sequence VIDEO_LY1.yuv are obtained by parsing the code stream information. Video enhancement is performed on VIDEO_LY1.yuv to obtain the enhanced video sequence VIDEO_LY1_ENHANCE.yuv, and then the enhanced sequence is quantized and encoded with LY2 to obtain VIDEO_LY1_ENHANCE_LY2.264. In the whole process of transcoding the initial sequence VIDEO.yuv into the final output code stream VIDEO_LY1_ENHANCE_LY2.264, it undergoes two quantization models. When encoded as the transcoding input sequence VIDEO_LY1.264, it undergoes the first encoding quantization, and after entering the transcoding part, it undergoes the second encoding quantization.
[0094] When performing low-light transcoding brightness quantization, the transcoded PSNR value is calculated with reference to the initial normal illumination video sequence, rather than the video sequence before transcoding. Under the premise of ensuring the best possible video quality, the LY2 calculated by the transcoding brightness quantization algorithm should minimize the bit rate after transcoding. Therefore, it is necessary to optimize the relationship between transcoding PSNR and LY2, and between transcoding bit rate R and LY2. The relationship between transcoding PSNR-LY is determined by three factors: quantization model, video content, and low-light level.
[0095] 2. Low-light live video conversion PSNR-LY model
[0096] (I) Quantization factor effect transcoding PSNR-LY relationship
[0097] The transcoding platform has two processes to quantize the video: the first quantization of the code stream after the encoder and the bright structure quantization of the transcoding part encoder; the quantization operation process is expressed as:
[0098]
[0099] Where F(u,v) represents the DCT coefficients of the original video sequence before quantization, F Q (u, v) represents the DCT coefficient of the quantized video, Q(u, v) represents the quantization weighting matrix, q is the quantization step size, and its value is related to the quantization factor LY, round[] is the rounding function, and the peak signal-to-noise ratio PSNR value is used as the objective evaluation standard of video quality;
[0100] The rule for determining the optimal LY2 under normal illumination conditions is not applicable to low-illumination videos. Under low-illumination conditions, the optimal LY2 value is greater than LY1, and as LY1 increases, the optimal LY2 value will increase accordingly, and the inflection point will gradually move backward.
[0101] (II) PSNR-LY relationship between video content and transcoding
[0102] A quantitative analysis of the transcoded brightness structure of three video sequences with different levels of picture complexity and motion intensity shows that for video sequences with flat and single pictures and gentle motion, most of the energy is concentrated in the low-frequency part of the upper left corner after DCT transformation; for video sequences with more complex picture textures and more intense motion, the energy is distributed more toward the high-frequency part of the lower right corner after DCT transformation. Since the information of the high-frequency part, to which the human eye is not sensitive, is lost when the DCT coefficients are quantized, while the information of the low-frequency part is relatively well preserved, the overall PSNR value decreases with the increase of video complexity and motion intensity. However, different video content has little effect on the optimal transcoded brightness structure quantization factor LY2. This feature is similar to the normal illumination video transcoding process. For normal illumination video, the optimal brightness structure quantization factor LY2 is always equal to LY l , does not change with different video content. Therefore, when performing low-light video transcoding brightness quantization, the video content can be ignored as a determining factor.
[0103] (III) Effect of illumination coefficient on transcoding PSNR-LY relationship
[0104] The low illumination level of the sequence will affect the distortion generated during the first quantization encoding, thus affecting the quality of the first decoding and enhanced YUV sequence, and ultimately affecting the PSNR-LY curve of the second encoding. By comparing the inflection point data obtained from the experiment with the theoretical value under ideal conditions, it is found that the inflection point of the curve has moved to the left as a whole, and as the low illumination level gradually increases, the amplitude of the inflection point moving to the left gradually increases. This is because when the illumination of the normal illumination video is reduced, the normal illumination video is superimposed on the RGB three channels with the parameter i1 and the pure black image. The superimposed video effect is better than the effect of directly multiplying the grayscale value of each pixel by i1, and the lower the illumination, the more obvious the difference between the two effects.
[0105] (IV) PSNR-LY model for low-light video transcoding
[0106] The PSNR-LY curve is quantitatively analyzed, and the PSNR-LY model of H.264 low-light video transcoding is constructed. The variation law of the transcoded PSNR value PSNR2 (LY1, LY2) with 0P is approximately fitted into a cubic function curve, which is expressed as:
[0107] PSNR2(LY1,LY2)=α·LY2 3 +β·LY2 2 +γ·LY2+δ Formula 2
[0108] The values of the four parameters α, β, γ, and δ are related to the three factors of the primary quantization factor LY1, the low illumination level i1, and the video content. α<0, β>0, γ<0, δ>0, and the value range of α is [-4×10 -4 , -1×10 -5 ], the value range of β is [20, 35]. The values of the four parameters α, β, γ, and δ are greatly affected by the low illumination level i;
[0109] After fitting the PSNR-LY curve into a cubic function curve, the value of PSNR2(LY1, LY2) must have an extreme point, that is, when LY2=LY2', the derivative of the cubic function curve PSNR2'(LY1, LY2)=0, and PSNR2(LY1, LY2) reaches the maximum value PSNR 2max (LY1, LY2), that is, when LY2>LY2′, the derivative of the cubic function curve PSNR2′(LY1, LY2)=0, and the value of PSNR2(LY1, LY2) rises slowly or remains basically unchanged: that is, when LY2>LY2′, the derivative of the cubic function curve PSNR2′(LY1, LY2)<0, and the value of PSNR2(LY1, LY2) drops rapidly;
[0110] like Figure 1As shown, the transcoded PSNR2(LY1, LY2)-LY2 curve is divided into three areas: A, B, and C. First, the peak PSNR of RSNR is determined. 2max (LY1, LY2), the value range of interval A is [PSNR 2max (LY1, LY2) -0.12dB, PSNR 2max (LY1, LY2)], in the I interval, the transcoded video quality is the highest, and the LY2 corresponding to the PSNR2(LY1, LY2) falling in this interval is a better brightness quantization factor. In addition to ensuring the transcoding quality, the bit rate must also be taken into account to ensure that the scheme with the smallest bit rate is selected under the premise of close quality. The value range of the A interval is only 0.12dB. In this small range, the difference in video quality is small. In the A interval where the transcoding PSNR is not much different, the brightness quantization factor with the lowest bit rate should be selected as the best LY2; the value range of the B interval is [PSNR 2max (LY1, LY2) -0.8dB, PSNR 2max (LY1, LY2)-0.12dB] In this interval, the video quality begins to change significantly. With the increase of the brightness quantization factor, the subjective and objective quality of the transcoded video begins to decrease significantly, but its quality is still within an acceptable range; the value range of the C interval is [0, PSNR 2max (LY1, LY2)-0.8dB], within this range, with the increase of the highlight quantization factor, the subjective and objective quality of the transcoded video decreases rapidly, and the LY2 value corresponding to PSNR2(LY1, LY2) in this area is not suitable as the transcoding highlight quantization factor.
[0111] By analyzing the degree of low illumination, the primary quantization factor information carried by the input bitstream and the video content of the initial bitstream, a curve model of peak signal-to-noise ratio PSNR2(LY1, LY2) and highlight quantization factor LY2 is established to predict the optimal transcoding highlight quantization factor, so that the transcoded video quality is optimal and the transcoding bitrate is low.
[0112] 3. R-LY Model for Low-Illumination Video Transcoding
[0113] The rate-distortion model is introduced into low-illumination video transcoding, and the R-LY model is established. The quantization factor LY determines the degree of compression of the video image information. The larger LY is, the greater the degree of image compression, the more information is lost, and the lower the bit rate consumed. The quantization factor LY and the bit rate rate are inversely proportional. R-LY is an inversely proportional function. Different low-illumination levels, primary quantization factors, and bit streams of video content are selected for calculation. Figure 2 The variation of the transcoding bitrate of the medium low illumination video sequence Avenue with LY2 was statistically analyzed.
[0114] The relationship model between the bit rate and the brightness quantization factor in the low-light video transcoding process is fitted using Formula 3:
[0115]
[0116] Where R represents the transcoding rate, X1 and X2 are coefficients, and Q step is the quantization step length, and its value corresponds to the quantization factor LY one by one. The transcoding bit rate R is inversely proportional to the quantization factor LY. The larger the quantization factor LY, the smaller the transcoding bit rate R. In order to make the bit rate consumed in the transcoding process as low as possible, when selecting the optimal quantization factor, the larger quantization factor should be given priority. When selecting the qualified quantization factor in the A interval, directly select the largest LY2 in the range, which meets the requirements of transcoding quality and transcoding bit rate.
[0117] 4. H.264 low-light video transcoding quantization algorithm
[0118] (I) Low-illumination and normal-illumination video quantization factor mapping association model
[0119] The quantization of the transcoding system will bring quantization errors. First, the input compressed bitstream is decoded to obtain the primary quantization factor in the bitstream information. The decoded information is dequantized with the primary quantization factor to reconstruct the initial YUV sequence. After the YUV sequence is input into the encoder, the encoder uses a larger quantization factor for quantization, performs entropy encoding, and finally outputs the encoded bitstream. Figure 3 The reasons for the errors in the initial bitstream during two quantization and two reconstruction processes are described.
[0120] exist Figure 3 In the figure, m and n represent the grayscale values of two different pixels in a frame of the initial video, Q1 and Q2 represent two quantization processes, Q1 -1 and Q2 -1 Represent two dequantization processes respectively;
[0121] For the input value m, after two quantizations and two dequantizations, its reconstructed value is:
[0122]
[0123] If Q2 is used directly for quantization and dequantization without quantization, the reconstructed value is:
[0124]
[0125] For the input gray value m, the reconstructed value is the same after two quantizations of Q1 and Q2 as after only one quantization of Q2, and no error is introduced;
[0126] for Figure 3 The gray value n in , after two quantization and dequantization, is reconstructed as follows:
[0127]
[0128] The reconstructed value after only one quantization and dequantization of Q2 is:
[0129]
[0130] For the input gray value n, the reconstructed value after two quantizations of Q1 and Q2 is different from the reconstructed value after only one quantization of Q2, resulting in an error △ = NM. The secondary quantization error becomes the reconstructed quantization error. The image gray value is transformed by DCT, and then the transformed coefficients are marked on the horizontal coordinate axis according to their amplitude values, such as Figure 4 shown.
[0131] exist Figure 4 In (a), the DCT coefficient of the rectangular area is in the range of [j(j+0.5)Q2, (j+1.5)Q2], and is encoded only once by the encoder. Its value is quantized to (j+1)Q2. If it is transcoded according to the transcoding process, it is first quantized to iQ1 by Q1 in the first encoding, and then quantized to j Q2 by the encoder of the transcoded part with the quantization factor Q2 (iQ1 is in the range of [(j-0.5)Q2, (j+0.5)Q2]). Figure 4 (b) Horizontal shift to obtain Figure 4 (c) Figure 4 (a)(c) forms a rectangular block area. The DCT coefficients in this area are quantized into two different values after encoding and transcoding, resulting in errors.
[0132] Assuming that the quantization factor of the initial low-light video is Q1, and the quantization factor of the encoder for encoding the enhanced YUV sequence during the transcoding process is Q2, the distortion caused by the one-time encoding quantization is expressed as formula 8:
[0133]
[0134] Where y represents the DCT coefficient, p(y) represents the probability density function of the DCT coefficient distribution, and after secondary quantization with the quantization factor Q2, the distortion caused by the double quantization is expressed as formula 9:
[0135]
[0136] The magnitude of the two quantization distortion values is determined by the DCT coefficients and the quantization step size of the two quantizations. Based on the relationship between the DCT coefficients of the normal illumination video and the video after the illumination is reduced, the relationship between the quantization factors of the normal illumination video and the low illumination video under the same distortion conditions is obtained; the following is established: Figure 5 The 8×8 image block shown in (a) is transformed by DCT to obtain Figure 5 (b) The 8×8 DCT coefficient block shown;
[0137] Will Figure 5 The gray value of each pixel in (a) is multiplied by 0.9, 0.8...0.2, 0.1 in turn, and the result is rounded off. Then, the 9 groups of 8×8 image blocks are subjected to DCT transformation respectively to obtain 9 DCT coefficient blocks. The relationship between the low-frequency components of these DCT coefficient blocks and the coefficients multiplied by the gray value is plotted as a curve. The DCT coefficient changes linearly with the change of the gray value of the pixel. When the normal illumination video is subjected to illumination reduction processing, if the weighted coefficient for reducing the illumination is i1, under absolutely ideal conditions, after the low illumination video is subjected to DCT transformation, the conversion relationship between its DCT coefficient y' and the DCT coefficient y of the normal illumination video is y'=y*i1.
[0138] To make the distortion of low illumination video and normal illumination video consistent after one quantization, the following relationship is adopted for one quantization step length:
[0139]
[0140] where Q′ step Indicates the quantization step size of low-light video, Q step represents the quantization step size of the normal illumination video, i1 represents the weighted coefficient of the illumination change between the two videos, based on the mapping relationship between the quantization coefficient and the quantization step size, Qstep = T(LY1), and equation 10 is written as:
[0141]
[0142] After obtaining the corresponding low-light video quantization step size, reverse lookup is performed to obtain the corresponding low-light video primary quantization factor LY1':
[0143]
[0144] T and T -1 They represent table lookup and reverse table lookup respectively. The weighting coefficient i1 reflects the low illumination degree of the low illumination video. Formula 12 is used to obtain the mapping relationship between the quantization factors of videos with different low illumination degrees and normal illumination videos under ideal conditions.
[0145] Formula 12 is proposed for an 8×8 block with a single grayscale value and a simple change rule. The quantization factor calculated under ideal conditions is not completely applicable in practical applications. It is necessary to introduce a correction coefficient σ to correct Formula 12 to obtain Formula 13:
[0146]
[0147] When the bright structure quantization factor LY2=LY1, the overall performance of transcoded video quality and bit rate is the best. Combining the mapping relationship of formula 13, the selection formula 14 for the optimal bright structure quantization factor in low-illumination video transcoding bright structure quantization is obtained:
[0148]
[0149] Calculation of correction factor:
[0150]
[0151] Among them, LY 2(理论) It is expressed as formula 16:
[0152]
[0153] LY 2(理论) It is calculated by the primary quantization factor LY1 and the illumination coefficient i1. Its value has nothing to do with the video content. Different video contents will cause the overall increase or decrease of the transcoding PSNR value, but will not affect the inflection point of the PSNR-LY curve. That is, the optimal quantization factor LY for low-illumination video transcoding is 2(实际) Determined by the primary quantization factor and the illumination coefficient, it has nothing to do with the video content. 2(理论) and LY 2(实际) are irrelevant to the video content, and the difference σ i1 It also has nothing to do with the content of the video.
[0154] Calculate the correction coefficient σ corresponding to different illumination coefficients i1 and different primary quantization factors LY1 i1 , determine the corresponding correction coefficient σ under different LY1 and i1 i1 After that, any low-light video bitstream input to the transcoding system is decoded to obtain the primary quantization factor LY1 and the illumination coefficient i1, and the theoretical value LY of the optimal brightness quantization factor is calculated. 2(理论) , and then use the corresponding correction coefficient σ i1 The correction is performed to obtain the optimal bright structure quantization factor of the low-illumination video.
[0155] (II) Low-light video transcoding quantization algorithm process
[0156] When transcoding any input video, set the following three judgment rules:
[0157] Rule 1: After a video is encoded once, it is input into the transcoding system. After being decoded by the decoder in the transcoding system, the quantization factor LY1 and the image grayscale value (Y channel value) used in the encoding are obtained. The dynamic range of the grayscale value is compared with the dynamic range of the grayscale value of the normal illumination video (0-255). If the dynamic range of the grayscale value of the video image is i1 times that of the normal illumination video, and i1>0.6, the video illumination is good and no image enhancement and transcoding are required;
[0158] Rule 2: When i1 < 0.6, it meets the criteria for low-light video and enters the next process to determine the degree of low light. According to the value of i1, the low-light video is divided into three levels: slight low light (0.6 ≥ i1 > 0.4), medium low light (0.4 ≥ i1 > 0.2), and severe low light (i ≤ 0.2). For slight low-light video, when LY1 > 34, the video quality after one encoding is already poor. After video enhancement and secondary encoding, the subjective quality of the video is very poor and unacceptable to the audience. Therefore, there is no need for image enhancement and transcoding. For medium low-light video, when LY1 > 30, there is no need for image enhancement and transcoding. For severe low-light video, when LY1 > 28, there is no need for image enhancement and transcoding.
[0159] Rule 3: In addition to the above two cases, the input video in other cases needs to be enhanced and transcoded for brightness quantization. The corresponding correction coefficient σ is obtained according to the video illumination parameter i1 and the primary quantization factor LY1. i1 , and then select the optimal highlight quantization factor LY2, which can ensure the lowest transcoding bit rate while ensuring the quality of the transcoded video is as good as possible.
[0160] The H.264 low-light video transcoding quantization algorithm is an optimization selection algorithm for quantization factors. The process is as follows Figure 6 .
[0161] The low-illumination video transcoding quantization algorithm divides the video into three levels according to the low-illumination degree. For different illumination parameters and different primary quantization factors, the value of the correction parameter is also different. For slightly low-illumination video, when LY1≤16, the correction parameter σ is 2; when 16<LY1≤20, the correction parameter σ is -2; when 20<LY1≤34, the correction parameter σ is -4; when LY1>34, the video quality is intolerable and no video enhancement and transcoding operations are required; for moderate low-illumination video, when LY1≤16, the correction parameter σ is 0; when 16<LY1≤20, the correction parameter σ is 0. The number σ is -2; when 20<LY1≤24, the correction parameter σ is -4; when 24<LY1≤30, the correction parameter σ is -6; when LY1>30, the video quality is intolerable, and no video enhancement and transcoding operations are required; for severe low-light video, when LY1≤16, the correction parameter σ is -2; when 16<LY1≤22, the correction parameter σ is -4; when 22<LY1≤26, the correction parameter σ is -6; when 26<LY1≤28, the correction parameter σ is -8; when LY1>28, the video quality is intolerable, and no video enhancement and transcoding operations are required.
[0162] When a low-light video is input into the transcoding system, the decoder in the transcoding system decodes the video, analyzes the decoded information to obtain the value of the primary quantization factor LY1 and the illumination parameter i1, and based on the correction coefficient σ in different situations, finally according to the formula QP2 = T -1 [T(QP1) / i1]+σ, the value of the optimal bright structure quantization factor of the low-illumination video is obtained.
[0163] The low-illumination video transcoding brightness quantization selects the optimal transcoding brightness quantization factor to achieve the best transcoded video quality, while ensuring that the bit rate is minimized when the transcoded video PSNR value is maximized. The influence of quantization factor, video content and illumination coefficient on the PSNR-LY relationship of low-illumination video transcoding is analyzed, and the PSNR-LY model and R-LY model of low-illumination video transcoding are established. According to the mapping relationship between the quantization factors of low-illumination video and normal-illumination video, the theoretical formula of the brightness quantization factor of low-illumination video transcoding is derived, and the theoretical formula is corrected to finally obtain the calculation formula of the brightness quantization factor of low-illumination video transcoding. According to the illumination coefficient and the size of the primary quantization factor in the bitstream of the input transcoding system, it is judged whether it is necessary to perform image enhancement and transcoding. If enhanced transcoding is required, the corresponding transcoding brightness quantization factor should be selected to obtain the optimal transcoding effect.
[0164] V. Experiment and Results Analysis
[0165] The H.264 low-light video transcoding quantization algorithm of this application is experimentally verified and analyzed. The transcoding is performed in a full decoding and full encoding manner. The Retinex video enhancement module is connected in series after the decoder of the transcoding system, and the enhanced code stream is encoded with the H.264 encoder. The video sequences used in the experiment are all IPPPP structures. When calculating the PSNR value and objectively evaluating the video quality, each frame of the image group is used as a reference. The PSNR value unit reflecting the objective quality of the video in all experiments is dB, and the bit rate unit is kb / s.
[0166] (I) Experimental verification of slightly low-light video
[0167] The experimental verification part selected three randomly shot video sequences, including the Grassland sequence with simple content and mostly static background; the Traffic sequence with complex background, consistent moving object trajectories and relatively smooth scenes; and the Crossroad sequence with complex background, violent human movements and irregular movement trajectories. The resolution of the three test videos is 640>480, the sequence length is 50 frames, and the illumination coefficient i1 used for reducing illumination is 0.5 (slightly low illumination).
[0168] The low-light code stream is first quantized and encoded with LY1={20, 24}, and then input into the transcoding system for decoding. The decoded low-light YUV sequence is then subjected to video enhancement processing and transcoded with the bright quantization factor LY2, where the value of LY2 is LY2={14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 36, 40}. The transcoded video sequence is compared with the initial normal illumination video sequence, the transcoded PSNR is calculated, and the peak signal-to-noise ratio PSNR and transcoding bit rate Rate are recorded. The error between PSNR and Rate refers to the error between the peak signal-to-noise ratio PSNR and bit rate Rate corresponding to LY2 selected by the above two methods.
[0169] Plot the data as a rate-distortion curve, such as Figure 7 As shown, the transcoding bit rate Rate is the horizontal axis, the transcoding peak signal-to-noise ratio PSNR is the vertical axis, and the points on the curve represent the Rate and PSNR values corresponding to the brightness quantization factor LY2 = {40, 36, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14} from left to right.
[0170] from Figure 7It can be seen that the LY2 selected by the algorithm of this application is consistent with the best OP2, which is marked with "*" in the figure. The LY2 selected by the algorithm of this application is located at the inflection point of the curve, while ensuring the highest possible video quality, the transcoding bit rate is kept as low as possible. In slightly low illumination, the error between the LY2 selected by the algorithm of this application and the best LY2 is 0, and the corresponding PSNR and Rate errors are both 0.
[0171] Since the PSNR value corresponding to the best LY2 selected by the algorithm of this application is not the maximum value of PSNR, in order to analyze the subjective effect of the video after quantization by the LY2 selected by the algorithm of this application, Figure 8 The subjective image effects before and after quantization using the algorithm LY2 of this application and transcoding with the PSNR maximum point corresponding to LY2 are given. The selected bitstreams are the 10th frame of the Grassland bitstream, the 8th frame of the Traffic bitstream, and the 42nd frame of the Crossroad bitstream when LY1=24. Comparing the images before and after transcoding, it is found that the subjective quality of the video image is significantly improved after low-light video transcoding. Figure 8 (b) and Figure 8 The subjective quality of the image in (c) is compared, and there is almost no difference in quality, which shows that the brightness quantization factor selected by the algorithm of the present application can ensure that the quality of the transcoded video is as high as possible.
[0172] (II) Experimental verification of severe low-light video
[0173] This part of the experiment uses the Grassland sequence with a simple picture content and mostly static background; the Traffic sequence with a relatively complex background, consistent moving object trajectories, and a relatively smooth picture; the Crossroad sequence with a complex background, violent human movements and irregular movement trajectories. The resolution of the three test videos is 640×480, the sequence length is 50 frames, and the weight coefficient i used for reducing illumination is 0.2.
[0174] The low-light code stream is first quantized and encoded with LY1={20, 24}, and then input into the transcoding system for decoding. The decoded low-light YUV sequence is then subjected to video enhancement processing and transcoded with the bright quantization factor LY2, where the value of LY2 is LY2={20, 22, 24, 26, 28, 30, 32, 34, 36, 38}. The transcoded video sequence is compared with the initial normal-light video sequence, the transcoded PSNR is calculated, and the peak signal-to-noise ratio PSNR and the transcoding bit rate Rate are recorded.
[0175] Plot the data as a rate-distortion curve, such as Fig. 9As shown, the transcoding bit rate Rate is the horizontal axis, the transcoding peak signal-to-noise ratio PSNR is the vertical axis, and the points on the curve represent the Rate and PSNR values corresponding to the brightness quantization factor LY2 = {38, 36, 34, 32, 30, 28, 26, 24, 22, 20} from left to right.
[0176] exist Fig. 9 In the figure, if the LY2 selected by the algorithm of this application matches the best LYz, it is marked with "*". If the two do not match, the selected LY2 is marked with "*" and the best LY2 is marked with "△". From the data, it can be seen that the LY2 selected by the algorithm of this application for the video sequences Crossroad0.2_20 and Traffic_0.2_24 differs from the best LY2 by 2, and the corresponding PSNR values differ by 0.026dB and 0.036dB respectively, and the bit rates differ by 22% and 18.4% respectively. The average PSNR error of the six sets of experimental data is 0.01dB, and the average Rate error is 6.73%.
[0177] Fig.10 The subjective image effect after quantization using the algorithm LY2 of this application and quantization of the PSNR maximum point corresponding to LY2 (LY1=24) is given. Comparison of the images before and after transcoding shows that the subjective quality of the video image is significantly improved after low-light video transcoding. Fig.10 (b) and Fig.10 By comparing the subjective quality of the image in (c), it is found that there is almost no difference in quality, which shows that the brightness quantization factor selected by the algorithm of the present application can ensure that the quality of the transcoded video is as high as possible.
[0178] The illumination of different sequences of the above content is reduced to different degrees to simulate the video shot under actual low-light conditions. For videos with different contents and different low-light levels, a certain primary quantization factor LY1 and a brightness quantization factor LY2 are selected for quantization, and the corresponding PSNR and Rate are recorded. After a large number of experiments, it was found that the relationship between PSNR-LY and R-LY conforms to the PSNR-LY model and R-LY model for low-light video transcoding proposed in this application. Then, the PSNR-Rate curve after enhanced transcoding is drawn with the bit rate Rate as the horizontal coordinate and the peak signal-to-noise ratio PSNR as the vertical coordinate. It can be seen from the curve that most of the LY2 predicted by the algorithm of this application are at the inflection point of the curve and are the same as the optimal LY2. The average PSNR error under different low-light levels is within 0.05db, and the average Rate error is within ±10%. There is no difference in subjective effect between the bitstream transcoded with the optimal LY2 selected by the algorithm of this application and the bitstream transcoded with the optimal LY2. The algorithm of this application also has a good effect on the transcoding of low-light videos shot in reality.
Claims
1. A method for enhancing brightness structure quantization by real-time transcoding of low-light live video, characterized in that: Combine low-light video enhancement with video transcoding, perform video enhancement during video transcoding, and use the brightness quantization factor selected by the low-light video transcoding brightness quantization algorithm to ensure the highest possible video quality while minimizing the transcoding bitrate; 1) Construct a low-light video transcoding framework: After the low-light video is quantized once by the H.264 encoder and input into the transcoding system, it is first decoded, then enhanced, and finally quantized by the transcoding structure, and the enhanced transcoded bitstream is output; 2) Analyze the effects of quantization factor, video content and illumination coefficient on PSNR-LY relationship: In the framework of low-light video transcoding, analyze the variation of PSNR-LY curve under different quantization factors, different video content and different illumination coefficients, and construct PSNR-LY and R-LY models for low-light video transcoding; 3) Propose a low-illumination video transcoding brightness quantization algorithm: By analyzing the low-illumination video quantization model, the mapping law of quantization factors in the low-illumination video and normal-illumination video coding quantization models is obtained, and the selection formula of the low-illumination video transcoding brightness quantization factor under ideal conditions is derived. Then, according to the obtained PSNR-LY model, the low-illumination video transcoding brightness quantization algorithm formula is corrected, and finally the low-illumination video transcoding brightness quantization factor calculation formula is obtained. According to the illumination coefficient and the size of the primary quantization factor in the input transcoding system bitstream, it is judged whether it is necessary to perform image enhancement and transcoding. If enhanced transcoding is required, the corresponding transcoding brightness quantization factor is selected to obtain the optimal transcoding effect, ensuring that the selected quantization factor minimizes the brightness quantization distortion and the highest quality of the transcoded video. On the premise of ensuring that the video quality is at the same level as the highest quality, the transcoding brightness quantization factor with a lower bit rate is selected as much as possible; Low-light video real-time transcoding framework: The low-light blurred video sequence VIDEO.yuv is encoded through the H.264 encoder to obtain the low-light code stream VIDEO_LY1.264, which is quantized once. The VIDEO_LY1.264 code stream is then input into the transcoding system, dequantized through the H.264 decoder, and the quantization factor LYl of the first encoding and the decoded video sequence VIDEO_LY1.yuv are obtained by parsing the code stream information. The video is enhanced on VIDEO_LY1.yuv to obtain the enhanced video sequence. The enhanced sequence is then quantized and encoded with LY2 to obtain VIDEO_LY1_ENHANCE_LY2.
264. In the whole process of transcoding the initial sequence VIDEO.yuv to the final output bitstream VIDEO_LY1_ENHANCE_LY2.264, it undergoes two quantization models. When it is encoded as the transcoding input sequence VIDEO_LY1.264, it undergoes the first encoding quantization. After entering the transcoding part, it undergoes the second encoding quantization. When performing low-illumination transcoding brightness quantization, the transcoded PSNR value is calculated with reference to the initial normal illumination video sequence. Under the premise of ensuring the best video quality, the LY2 calculated by the transcoding brightness quantization algorithm should reduce the bit rate after transcoding as much as possible. It is necessary to optimize the relationship between transcoding PSNR and LY2, and between transcoding bit rate R and LY2. The relationship between transcoding PSNR and LY is determined by three factors: quantization model, video content, and low illumination level. Quantization factor effect transcoding PSNR-LY relationship: The transcoding platform has two processes to quantize the video: the code stream is quantized once by the encoder, and the bright structure quantization of the transcoding encoder; the quantization operation process is expressed as: Where F(u,v) represents the DCT coefficients of the original video sequence before quantization, F Q (u, v) represents the DCT coefficient of the quantized video, Q(u, v) represents the quantization weighting matrix, q is the quantization step size, and its value is related to the quantization factor LY, round[] is the rounding function, and the peak signal-to-noise ratio PSNR value is used as the objective evaluation standard of video quality; Under low illumination conditions, the optimal LY2 value is greater than LY1, and as LY1 increases, the optimal LY2 value increases accordingly, and the inflection point gradually moves backward; PSNR-LY model for low-light video transcoding: Quantitative analysis of the PSNR-LY curve is performed to construct a PSNR-LY model for H.264 low-light video transcoding. The variation of the transcoded PSNR value PSNR2(LY1,LY2) with OP is approximately fitted into a cubic function curve, which is expressed as: The values of the four parameters α, β, γ, and δ are related to the primary quantization factor LY1 and the low illumination level i l , video content, these three factors are related, α<0, β>0, γ<0, δ>0, and the value range of α is [-4×10 -4 , -1×10 -5 ], the value range of β is [20, 35]. The values of the four parameters α, β, γ, and δ are greatly affected by the low illumination level i; After fitting the PSNR-LY curve into a cubic function curve, the value of PSNR2(LY1,LY2) must have an extreme point, that is, when LY2=LY2', the derivative of the cubic function curve PSNR2'(LY1,LY2)=0, and PSNR2(LY1,LY2) reaches the maximum value PSNR 2max (LY1, LY2), that is, when LY2>LY2′, the derivative of the cubic function curve PSNR2′(LY1, LY2)=0, and the value of PSNR2(LY1, LY2) rises slowly or remains basically unchanged: that is, when LY2>LY2′, the derivative of the cubic function curve PSNR2′(LY1, LY2)<0, and the value of PSNR2(LY1, LY2) drops rapidly; By analyzing the degree of low illumination, the primary quantization factor information carried by the input bitstream and the video content of the initial bitstream, a curve model of peak signal-to-noise ratio PSNR2(LY1, LY2) and highlight quantization factor LY2 is established to predict the optimal transcoding highlight quantization factor, so that the transcoded video quality is optimal and the transcoding bitrate is low.
2. According to the method for real-time transcoding of low-light live video to enhance brightness quantization according to claim 1, it is characterized in that: R-LY model for low-light video transcoding: The rate-distortion model is introduced into low-light video transcoding to establish the R-LY model. The quantization factor LY determines the degree of compression of the video image information. The larger the LY, the greater the degree of image compression, the more information is lost, and the lower the bit rate consumed. The quantization factor LY and the bit rate rate are inversely proportional. R-LY is an inversely proportional function. Different low-light levels, primary quantization factors, and bit streams of video content are selected for calculation. The relationship model between the bit rate and the brightness quantization factor in the low-light video transcoding process is fitted using Formula 3: Where R represents the transcoding rate, X1 and X2 are coefficients, and Q step is the quantization step length, and its value corresponds to the quantization factor LY one by one. The transcoding bit rate R is inversely proportional to the quantization factor LY. The larger the quantization factor LY, the smaller the transcoding bit rate R. In order to make the bit rate consumed in the transcoding process as low as possible, when selecting the optimal quantization factor, the larger quantization factor should be given priority. When selecting the qualified quantization factor in the A interval, directly select the largest LY2 in the range, which meets the requirements of transcoding quality and transcoding bit rate.
3. According to claim 1, the method for enhancing the brightness structure quantization of low-light live video real-time transcoding is characterized in that: The mapping association model of low illumination and normal illumination video quantization factors: First, the input compressed bitstream is decoded to obtain the primary quantization factor in the bitstream information, and the decoded information is dequantized with the primary quantization factor to reconstruct the initial YUV sequence. After the YUV sequence is input to the encoder, the encoder uses a larger quantization factor for quantization, and then performs entropy encoding, and finally outputs the encoded bitstream; m and n represent the grayscale values of two different pixels in a frame of the initial video. Q1 and Q2 represent two quantization processes. -1 and Q2 -1 Represent two dequantization processes respectively; For the input value m, after two quantizations and two dequantizations, its reconstructed value is: If Q2 is used directly for quantization and dequantization without quantization, the reconstructed value is: For the input gray value m, the reconstructed value is the same after quantization twice by Q1 and Q2 as it is after quantization once by Q2, and no error is introduced; For the gray value n, the reconstructed value after two quantizations and dequantizations is: The reconstructed value after only one quantization and dequantization of Q2 is: For the input grayscale value n, the reconstructed value after two quantizations of Q1 and Q2 is different from the reconstructed value after only one quantization of Q2, resulting in an error △=NM. The secondary quantization error becomes the reconstructed quantization error. The image grayscale value is transformed by DCT, and then the transformed coefficients are marked on the horizontal coordinate axis according to their amplitude values.
4. According to claim 3, the method for enhancing the brightness structure quantization of low-light live video real-time transcoding is characterized in that: Assuming that the quantization factor of the initial low-light video is Q1, and the quantization factor of the encoder for encoding the enhanced YUV sequence during the transcoding process is Q2, the distortion caused by the one-time encoding quantization is expressed as formula 8: Where y represents the DCT coefficient, p(y) represents the probability density function of the DCT coefficient distribution, and after secondary quantization with the quantization factor Q2, the distortion caused by the double quantization is expressed as formula 9: The magnitude of the two quantization distortion values is determined by the DCT coefficients and the quantization step sizes of the two quantizations. Based on the relationship between the DCT coefficients of the normal illumination video and the video after the illumination is reduced, the relationship between the quantization factors of the normal illumination video and the low illumination video under the same distortion conditions is obtained; Create an 8×8 image block, and perform DCT transformation on the image block to obtain an 8×8 DCT coefficient block; Multiply the gray value of each pixel by 0.9, 0.8…0.2, 0.1 in turn, round the result to the nearest integer, and then perform DCT transformation on the obtained 9 groups of 8×8 image blocks to obtain 9 DCT coefficient blocks. Plot the relationship between the low-frequency components of these DCT coefficient blocks and the gray value multiplied coefficient as a curve. The DCT coefficient changes linearly with the gray value of the pixel. When the normal illumination video is subjected to illumination reduction processing, if the weighted coefficient for reducing illumination is i1, under absolutely ideal conditions, after the low illumination video is subjected to DCT transformation, the conversion relationship between its DCT coefficient y' and the DCT coefficient y of the normal illumination video is y'=y*i1; To make the distortion of low illumination video and normal illumination video consistent after one quantization, the following relationship is adopted for one quantization step length: where Q′ step Indicates the quantization step size of low-light video, Q step represents the quantization step size of the normal illumination video, i1 represents the weighted coefficient of the illumination change between the two videos, based on the mapping relationship between the quantization coefficient and the quantization step size, Qstep = T(LY1), and equation 10 is written as: After obtaining the corresponding low-light video quantization step size, reverse lookup is performed to obtain the corresponding low-light video primary quantization factor LY1': T and T -1 They represent table lookup and reverse table lookup respectively. The weighting coefficient i1 reflects the low illumination degree of the low illumination video. The mapping relationship between the quantization factors of videos with different low illumination degrees and normal illumination videos under the ideal state is obtained through formula 12. Introducing a correction coefficient σ, correcting equation 12, we get equation 13: When the bright structure quantization factor LY2=LY1, the overall performance of transcoded video quality and bit rate is the best. Combining the mapping relationship of formula 13, the selection formula 14 for the optimal bright structure quantization factor in low-illumination video transcoding bright structure quantization is obtained: Calculation of correction factor: Among them, LY 2(理论) It is expressed as formula 16: Calculate the correction coefficient σ corresponding to different illumination coefficients i1 and different primary quantization factors LY1 i1 , determine the corresponding correction coefficient σ under different LY1 and i1 i1 After that, any low-light video bitstream input to the transcoding system is decoded to obtain the primary quantization factor LY1 and the illumination coefficient i1, and the theoretical value LY of the optimal brightness quantization factor is calculated. 2(理论) , and then use the corresponding correction coefficient σ i1 The correction is performed to obtain the optimal bright structure quantization factor of the low-illumination video.
5. According to claim 1, the method for enhancing the brightness structure quantization of low-light live video real-time transcoding is characterized in that: Low-light video transcoding light structure quantization algorithm process: When transcoding any input video, set the following three judgment rules: Rule 1: After a video is encoded once, it is input into the transcoding system. After being decoded by the decoder in the transcoding system, the quantization factor LY1 and image grayscale value used in the first encoding are obtained. The dynamic range of the grayscale value is compared with the dynamic range of the grayscale value of the normal illumination video (0-255). If the dynamic range of the grayscale value of the video image is i1 times that of the normal illumination video, and i1>0.6, the video illumination is good and no image enhancement and transcoding are required; Rule 2: When i1 < 0.6, it meets the criteria for low-light video and enters the next process to determine the degree of low light. According to the value of i1, the low-light video is divided into three levels: slight low light (0.6 ≥ i1 > 0.4), medium low light (0.4 ≥ i1 > 0.2), and severe low light (i ≤ 0.2). For slight low-light video, when LY1 > 34, the video quality after one encoding is already poor. After video enhancement and secondary encoding, the subjective quality of the video is very poor and unacceptable to the audience. Therefore, there is no need for image enhancement and transcoding. For medium low-light video, when LY1 > 30, there is no need for image enhancement and transcoding. For severe low-light video, when LY1 > 28, there is no need for image enhancement and transcoding. Rule 3: In addition to the above two cases, the input video in other cases needs to be enhanced and transcoded for brightness quantization. The corresponding correction coefficient σ is obtained according to the video illumination parameter i1 and the primary quantization factor LY1. i1 , and then select the optimal highlight quantization factor LY2, which can ensure the lowest transcoding bit rate while ensuring the quality of the transcoded video is as good as possible.
6. According to claim 1, the method for enhancing the brightness structure quantization of low-light live video real-time transcoding is characterized in that: The low-illumination video transcoding quantization algorithm divides the video into three levels according to the low-illumination degree. For different illumination parameters and different primary quantization factors, the value of the correction parameter is also different. For slightly low-illumination video, when LY1≤16, the correction parameter σ is 2; when 16<LY1≤20, the correction parameter σ is -2; when 20<LY1≤34, the correction parameter σ is -4; when LY1>34, the video quality is intolerable and no video enhancement and transcoding operations are required; for moderate low-illumination video, when LY1≤16, the correction parameter σ is 0; when 16<LY1≤20, the correction parameter σ is 0. The number σ is -2; when 20<LY1≤24, the correction parameter σ is -4; when 24<LY1≤30, the correction parameter σ is -6; when LY1>30, the video quality is intolerable, and no video enhancement and transcoding operations are required; for severe low-light video, when LY1≤16, the correction parameter σ is -2; when 16<LY1≤22, the correction parameter σ is -4; when 22<LY1≤26, the correction parameter σ is -6; when 26<LY1≤28, the correction parameter σ is -8; when LY1>28, the video quality is intolerable, and no video enhancement and transcoding operations are required; When a low-light video is input into the transcoding system, the decoder in the transcoding system decodes the video, analyzes the decoded information to obtain the value of the primary quantization factor LY1 and the illumination parameter i1, and based on the correction coefficient σ in different situations, finally according to the formula QP2 = T -1 [T(QP1) / i1]+σ, the value of the optimal bright structure quantization factor of the low-illumination video is obtained.
Citation Information
Patent Citations
VMS video sharpening processing network system framework under low illumination and pre-detection method
CN104092924A
Video transcoding method and device, computer equipment and computer readable storage medium
CN111385577A
Video image high-quality transcoding method with excellent error code resistance
CN111510722A
Method and device for estimating image quality of compressed images and / or video sequences
US20080175503A1
