CN112004087A - Code rate control optimization method and storage medium with double frames as control unit - Google Patents
Code rate control optimization method and storage medium with double frames as control unit Download PDFInfo
- Publication number
- CN112004087A CN112004087A CN201910445837.XA CN201910445837A CN112004087A CN 112004087 A CN112004087 A CN 112004087A CN 201910445837 A CN201910445837 A CN 201910445837A CN 112004087 A CN112004087 A CN 112004087A
- Authority
- CN
- China
- Prior art keywords
- rate control
- frame
- current
- code rate
- control unit
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
- H04N19/146—Data rate or code amount at the encoder output
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/124—Quantisation
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The invention provides a code rate control optimization method taking double frames as a control unit, which comprises the following steps: s1, acquiring the coding information of the coded frame; s2, calculating and acquiring the code rate and the quantization parameter of the current coding frame according to the obtained coding information; s3, obtaining the code rate control error of the current coding frame according to the code rate of the current coding frame and the expected code rate of the current coding frame in the step S2; s4, adjusting the quantization parameter of the current coding frame according to the code rate control error and the criticality; judging whether the code rate control error of the current coding frame is smaller than a set error or not; if not, finishing the optimization of the quantization parameter of the current coding frame; if yes, go to S5; s5, judging whether the current coding frame is a key frame; if not: when qp is increased: qp _ next0 ═ qp _ current + qp _ delta/2; qp _ next1 q _ current +3 q _ delta/2; if so: when qp is decreased: qp _ next0 q _ qp _ delta/2; qp _ next1 is qp _ current-qp _ delta/2.
Description
Technical Field
The present invention relates to the field of video encoding/decoding technologies, and in particular, to a code rate control optimization method using dual frames as a control unit and a computer-readable storage medium.
Background
The statements in this section merely provide background information related to the present disclosure and may not constitute prior art.
Today's society is a highly digital society, and video coding technology has been widely applied to many fields, such as cable television, digital broadcasting, video conferencing, etc. In the application process, the data processing of the computer must be matched with the processing of the video information and the transmission of the network, and the audio-visual quality must be ensured to reach the acceptable range of the general level of people. In order to save transmission bandwidth and storage space, video coding technology has been the focus of scientific research. The method has the advantages that better image quality is obtained under the limits of bandwidth, time delay, cache and the like, the coded data are efficiently transmitted under the code rate, good and stable quality is guaranteed, and the code rate control is a key technology of video coding.
In inter-frame prediction, the quality of a reference frame affects the accuracy of motion search, and thus affects the code rate and quality of a current frame. In video coding, a previous frame is generally used as a reference frame for inter-frame prediction. The quality of the previous frame is determined by the qp of the previous frame. Therefore, the qp alignment order affects the encoding effect. However, the conventional rate control does not consider the influence of qp alignment on coding. Wherein, video code rate: the video code rate is the number of data bits transmitted per unit time during data transmission, and generally, the unit used is kbps, namely kilobits per second. The popular understanding is that the sampling rate is higher, the higher the sampling rate in unit time is, the higher the precision is, and the closer the processed file is to the original file. qp, the abbreviation of quant parameter, controls the quantization step size of the residual coefficients, thus affecting the code rate and quality of the encoding. Rate Control (RC): rate control is actually an optimization algorithm for coding, and is used to realize control of the size of the video stream code stream. In the same video coding format, the code stream is large, the more information the code stream contains, and the clearer the corresponding image is. Two commonly used code stream control methods at present are VBR and CBR, where VBR is a dynamic bit rate and CBR is a fixed bit rate. CBR: abbreviation of Constant Bit Rate. When Motion occurs, the code rate is constant, the size of the code word can be reduced only by increasing QP, the image quality is poor, and when the scene is static, the image quality is good, so the image quality is unstable. This algorithm prioritizes the code rate (bandwidth). VBR: abbreviation of Variable Bit Rate. The dynamic bit rate can change with the complexity of the image, so the coding efficiency is high, and the mosaic is few when the motion occurs. The code rate control algorithm determines the used bit rate according to the image content, if the image content is simpler, less code rate is distributed (the code word seems to be more appropriate), and if the image content is complex, more code words are distributed, so that the quality is ensured, and the bandwidth limitation is also considered. Such algorithms prioritize image quality. Rate Control (RC): when transmitting compression-coded video, two issues have to be considered: video quality and transmission bandwidth, if the bandwidth is large, the video with better quality is certainly transmitted as much as possible; if the bandwidth is low, the compression ratio needs to be improved, and the code stream needs to be reduced; if the bandwidth changes dynamically, the code stream also needs to change dynamically to adapt to the bandwidth, and in any case, the code stream is closely related to the bandwidth. Meanwhile, it is desirable to obtain a high-definition restored image as much as possible, so compressing the video as much as possible within an acceptable video quality range to improve the bandwidth utilization rate is essential to the rate control. The bandwidth utilization rate is improved, and the bandwidth is reduced as much as possible under the condition of keeping the video restoration definition. Inter-frame prediction: the aim of image compression is achieved by utilizing the correlation between video image frames, namely the time correlation. In image transmission technology, video images are the main objects of interest. A video image is a temporal image sequence consisting of successive image frames spaced apart in time by a frame period, which has a greater correlation in time than in space. Most of video images have little detail change between adjacent frames, namely the video images have strong correlation between frames, and the compression ratio higher than that of intra-frame coding can be obtained by using the characteristic of the correlation of the frames to carry out inter-frame coding.
In inter-frame prediction, the quality of a reference frame affects the accuracy of motion search, and thus affects the code rate and quality of a current frame. In video coding, a previous frame is generally used as a reference frame for inter-frame prediction. The quality of the previous frame is determined by the qp of the previous frame. Therefore, the qp alignment order affects the encoding effect. However, the conventional rate control does not consider the influence of qp alignment on coding.
Disclosure of Invention
In order to solve the problems in the prior art, the present invention aims to: the invention upgrades the original code rate control method, and adopts double frames as the control unit, thereby realizing optimization.
The application provides a code rate control optimization method taking double frames as a control unit, and the optimization method comprises the following steps:
s1, acquiring the coding information of the coded frame;
s2, calculating and acquiring the code rate and the quantization parameter of the current coding frame according to the obtained coding information;
s3, obtaining the code rate control error of the current coding frame according to the code rate of the current coding frame and the expected code rate of the current coding frame in the step S2;
s4, adjusting the quantization parameter of the current coding frame according to the code rate control error and the criticality; judging whether the code rate control error of the current coding frame is smaller than a set error or not;
if not, finishing the optimization of the quantization parameter of the current coding frame;
if yes, go to S5;
s5, judging whether the current coding frame is a key frame:
if not: (1) when qp is increased:
qp_next0=qp_current+qp_delta/2;
qp_next1=qp_current+3*qp_delta/2;
if so: (2) when qp is decreased:
qp_next0=qp_current-3*qp_delta/2;
qp_next1=qp_current-qp_delta/2;
wherein the content of the first and second substances,
qp _ next0, qp of the first frame of the next rate control unit when controlling the rate of double frames;
qp _ next1, qp of the first frame (next frame) of the next rate control unit in the double-frame rate control;
qp _ current is qp of the current rate control unit;
qp _ delta is the absolute value of the difference between the next rate control unit qp and the current rate control unit qp.
The present application further provides an electronic device, comprising: a processor for executing a computer program stored by the memory; a memory having stored thereon a computer program that, when executed by the processor, implements a method for rate control optimization with dual frames as a control unit as described in any one of the above.
The present application further provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements a method for rate control optimization with dual frames as a control unit according to any of the above.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention.
Fig. 1 is a diagram of the relationship between rate control and coding.
FIG. 2A is one of the complete flow charts of the optimization method of the present invention.
FIG. 2B is a second flowchart of the optimization method of the present invention.
Detailed Description
Rate control is an important loop in video coding technology. Video quality and transmission bandwidth are two considerations for rate control. The code rate prioritization algorithm is referred to as cbr and the quality prioritization algorithm is referred to as vbr. The balance between the coding rate and the quality is realized by adjusting qp.
The existing code rate control is adjusted by a single frame, and the qp is adjusted once by one frame. And determining the qp size of the next frame according to the feedback of the code rate of the current frame. As shown in fig. 1, the relationship between rate control and coding is shown.
Furthermore, inter prediction: the aim of image compression is achieved by utilizing the correlation between video image frames, namely the time correlation.
And (3) reconstructing a frame: and decoding the coded code stream to obtain a frame.
Reference frame: in inter-frame prediction, a frame is used as a reference. The reconstructed frame is used as a reference frame in video coding and decoding.
qp _ next is qp of the next rate control unit (next frame) at the time of single frame rate control.
qp _ next0 is qp of the first frame of the next rate control unit in rate control of two frames.
qp _ next1 is qp of the first frame of the next rate control unit in rate control of two frames.
qp _ current is qp of the current rate control unit.
qp _ delta is the absolute value of the difference between the next rate control unit qp and the current rate control unit qp.
Single frame rate control: the original code rate control algorithm takes a single frame as a control unit.
And (3) double-frame code rate control: the invention relates to an optimized code rate control algorithm which takes double frames as a control unit.
The original code rate control takes a single frame as a control unit. The invention upgrades the original code rate control algorithm, and adopts double frames as the control unit.
The original single-frame code rate control method comprises the following steps:
when qp is increased: qp _ next ═ qp _ current + qp _ delta;
when qp is decreased: qp _ next ═ qp _ current-qp _ delta;
the upgraded double-frame code rate control method comprises the following steps:
when qp is increased:
qp_next0=qp_current+qp_delta/2;
qp_next1=qp_current+3*qp_delta/2;
when qp is decreased:
qp_next0=qp_current-3*qp_delta/2;
qp_next1=qp_current-qp_delta/2;
specifically, as shown in fig. 2A and 2B, a method for optimizing rate control with dual frames as a control unit includes:
s1, acquiring the coding information of the coded frame;
s2, calculating and acquiring the code rate and the quantization parameter of the current coding frame according to the obtained coding information;
s3, obtaining the code rate control error of the current coding frame according to the code rate of the current coding frame and the expected code rate of the current coding frame in the step S2;
s4, adjusting the quantization parameter of the current coding frame according to the code rate control error and the criticality; judging whether the code rate control error of the current coding frame is smaller than a set error or not;
if not, finishing the optimization of the quantization parameter of the current coding frame;
if yes, go to S5;
s5, judging whether the current coding frame is a key frame:
if not: (1) when qp is increased:
qp_next0=qp_current+qp_delta/2;
qp_next1=qp_current+3*qp_delta/2;
if so: (2) when qp is decreased:
qp_next0=qp_current-3*qp_delta/2;
qp_next1=qp_current-qp_delta/2;
wherein the content of the first and second substances,
qp _ next0, qp of the first frame of the next rate control unit when controlling the rate of double frames;
qp _ next1, qp of the first frame (next frame) of the next rate control unit in the double-frame rate control;
qp _ current is qp of the current rate control unit;
qp _ delta is the absolute value of the difference between the next rate control unit qp and the current rate control unit qp.
The present application further provides an electronic device, comprising: a processor for executing a computer program stored by the memory; a memory having stored thereon a computer program that, when executed by the processor, implements a method for rate control optimization with dual frames as a control unit as described in any one of the above.
The present application further provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements a method for rate control optimization with dual frames as a control unit according to any of the above.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes may be made to the embodiment of the present invention by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (4)
1. A method for optimizing rate control using dual frames as control units, the method comprising:
s1, acquiring the coding information of the coded frame;
s2, calculating and acquiring the code rate and the quantization parameter of the current coding frame according to the obtained coding information;
s3, obtaining the code rate control error of the current coding frame according to the code rate of the current coding frame and the expected code rate of the current coding frame in the step S2;
s4, adjusting the quantization parameter of the current coding frame according to the code rate control error and the criticality; judging whether the code rate control error of the current coding frame is smaller than a set error or not;
if not, finishing the optimization of the quantization parameter of the current coding frame;
if yes, go to S5;
s5, judging whether the current coding frame is a key frame:
if not: (1) when qp is increased:
qp_next0=qp_current+qp_delta/2;
qp_next1=qp_current+3*qp_delta/2;
if so: (2) when qp is decreased:
qp_next0=qp_current-3*qp_delta/2;
qp_next1=qp_current-qp_delta/2;
wherein the content of the first and second substances,
qp _ next0, qp of the first frame of the next rate control unit when controlling the rate of double frames;
qp _ next1, qp of the first frame (next frame) of the next rate control unit in the double-frame rate control;
qp _ current is qp of the current rate control unit;
qp _ delta is the absolute value of the difference between the next rate control unit qp and the current rate control unit qp.
2. The method as claimed in claim 1, wherein the video file encoded by the rate control method complies with the video and audio encoding and decoding specification of the IPTV service in china.
3. An electronic device, comprising: a processor for executing a computer program stored by the memory; a memory having stored thereon a computer program which, when executed by a processor, implements a method for rate control optimization with dual frames as a control unit as claimed in claim 1 or 2 above.
4. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements a rate control optimization method for a dual frame as a control unit according to claim 1 or 2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910445837.XA CN112004087B (en) | 2019-05-27 | 2019-05-27 | Code rate control optimization method taking double frames as control units and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910445837.XA CN112004087B (en) | 2019-05-27 | 2019-05-27 | Code rate control optimization method taking double frames as control units and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112004087A true CN112004087A (en) | 2020-11-27 |
CN112004087B CN112004087B (en) | 2023-05-09 |
Family
ID=73461900
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910445837.XA Active CN112004087B (en) | 2019-05-27 | 2019-05-27 | Code rate control optimization method taking double frames as control units and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112004087B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1988659A (en) * | 2006-12-30 | 2007-06-27 | 清华大学 | Method for control video frequency coding rate |
CN101478676A (en) * | 2008-12-08 | 2009-07-08 | 四川虹微技术有限公司 | Method for B frame code rate controlling |
CN102186084A (en) * | 2011-06-07 | 2011-09-14 | 东莞电子科技大学电子信息工程研究院 | Spatial enhancement layer code rate control realization method for scalable video coding |
CN102970540A (en) * | 2012-11-21 | 2013-03-13 | 宁波大学 | Multi-view video code rate control method based on key frame code rate-quantitative model |
CN104954792A (en) * | 2014-03-24 | 2015-09-30 | 兴唐通信科技有限公司 | Method and device for carrying out subjective video quality optimization coding on P-frame sequence |
US20170295368A1 (en) * | 2016-04-07 | 2017-10-12 | Mstar Semiconductor, Inc. | Bit rate controlling method and video encoding device |
-
2019
- 2019-05-27 CN CN201910445837.XA patent/CN112004087B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1988659A (en) * | 2006-12-30 | 2007-06-27 | 清华大学 | Method for control video frequency coding rate |
CN101478676A (en) * | 2008-12-08 | 2009-07-08 | 四川虹微技术有限公司 | Method for B frame code rate controlling |
CN102186084A (en) * | 2011-06-07 | 2011-09-14 | 东莞电子科技大学电子信息工程研究院 | Spatial enhancement layer code rate control realization method for scalable video coding |
CN102970540A (en) * | 2012-11-21 | 2013-03-13 | 宁波大学 | Multi-view video code rate control method based on key frame code rate-quantitative model |
CN104954792A (en) * | 2014-03-24 | 2015-09-30 | 兴唐通信科技有限公司 | Method and device for carrying out subjective video quality optimization coding on P-frame sequence |
US20170295368A1 (en) * | 2016-04-07 | 2017-10-12 | Mstar Semiconductor, Inc. | Bit rate controlling method and video encoding device |
Non-Patent Citations (1)
Title |
---|
方权亮: "视频编码中自适应的初始量化参数预测算法", 微型机与应用 * |
Also Published As
Publication number | Publication date |
---|---|
CN112004087B (en) | 2023-05-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5485211A (en) | Multiple encoder output buffer apparatus for differential coding of video information | |
KR101644208B1 (en) | Video encoding using previously calculated motion information | |
EP2088782B1 (en) | A method and a device for transcoding video | |
US10616498B2 (en) | High dynamic range video capture control for video transmission | |
US20130251031A1 (en) | Method for bit rate control within a scalable video coding system and system therefor | |
US7145946B2 (en) | MPEG video drift reduction | |
US11343501B2 (en) | Video transcoding method and device, and storage medium | |
US7826529B2 (en) | H.263/MPEG video encoder for efficiently controlling bit rates and method of controlling the same | |
KR0152013B1 (en) | Moving estimation device considering variable length coding | |
Wang | Bit rate control for hybrid DPCM/DCT video codec | |
CN112004084B (en) | Code rate control optimization method and system by utilizing quantization parameter sequencing | |
WO2021007702A1 (en) | Video encoding method, video decoding method, video encoding device, and video decoding device | |
CN113727102B (en) | Low-delay lossy image encoder and decoder | |
JP2001016580A (en) | Encoding device | |
CN112004087B (en) | Code rate control optimization method taking double frames as control units and storage medium | |
CN112004082B (en) | Optimization method for code rate control by using double frames as control unit | |
CN112004083B (en) | Method and system for optimizing code rate control by utilizing inter-frame prediction characteristics | |
JPWO2003092302A1 (en) | Moving picture transmission system, moving picture encoding apparatus, moving picture decoding apparatus, and moving picture transmission program | |
EP1841237A1 (en) | Method and apparatus for video encoding | |
WO2024082971A1 (en) | Video processing method and related device | |
KR20030083109A (en) | apparatus for transcoding bit rate | |
KR100323752B1 (en) | Method and Telephone for still picture transport | |
CN117676266A (en) | Video stream processing method and device, storage medium and electronic equipment | |
CN114430501A (en) | Content adaptive encoding method and system for file transcoding | |
Kamariotis | Bridging the gap between CBR and VBR for H264 standard |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |