CN107343205A - A kind of coding method of long term reference code stream and code device - Google Patents

A kind of coding method of long term reference code stream and code device Download PDF

Info

Publication number
CN107343205A
CN107343205A CN201610275515.1A CN201610275515A CN107343205A CN 107343205 A CN107343205 A CN 107343205A CN 201610275515 A CN201610275515 A CN 201610275515A CN 107343205 A CN107343205 A CN 107343205A
Authority
CN
China
Prior art keywords
frame
term reference
idr
bit stream
data
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
Application number
CN201610275515.1A
Other languages
Chinese (zh)
Other versions
CN107343205B (en
Inventor
朱江明
陆金刚
姚卫忠
方伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN201610275515.1A priority Critical patent/CN107343205B/en
Priority claimed from CN201610275515.1A external-priority patent/CN107343205B/en
Publication of CN107343205A publication Critical patent/CN107343205A/en
Application granted granted Critical
Publication of CN107343205B publication Critical patent/CN107343205B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/573Motion compensation with multiple frame prediction using two or more reference frames in a given prediction direction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction
    • H04N19/51Motion estimation or motion compensation
    • H04N19/58Motion compensation with long-term prediction, i.e. the reference frame for a current frame not being the temporally closest one

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The problem of the invention discloses a kind of coding method of long term reference code stream and code device, and long term reference coded system is not supported to solve original yard of stream generating device, and cost is higher.This method is:Code stream generating device chooses an every IDR frame as current long term reference frame, P frame codings are carried out to original yuv data corresponding to other each every IDR frames in addition to current long term reference frame respectively, corresponding target P frame bit stream datas are obtained, short term reference bit stream data corresponding to other each every IDR frames in addition to current long term reference frame is replaced with into corresponding target P frame bit stream datas respectively.So, original yard of stream generating device is utilized, it is possible to realize the synthesis of long term reference code stream, implementation process is simple, efficient, ensure that picture quality, reduces encoder bit rate, saves memory space.

Description

A kind of coding method of long term reference code stream and code device
Technical field
The present invention relates to coding method and the coding of field of video encoding, more particularly to a kind of long term reference code stream Device.
Background technology
At present, the encoder in code stream generating device is raw after the yuv data to collecting encodes Into encoding code stream form such as Fig. 1 (a) shown in, as IDRpp...ppIDRpp...pp, wherein, immediately The code stream size of decoding refresh frame (Instantaneous Decoding Refresh, IDR) is typically preceding to pre- Survey the code stream size of coded frame P frames several times even more than ten times, stored to rebuilding yuv data When, substantial amounts of storage resource can be taken.
In the prior art, the encoding code stream lattice of the full P frames of single every IDR frame of the generally use as shown in Fig. 1 (b) Formula (IDRpp...ppppp...pp), code stream size is reduced, save storage resource, still, above-mentioned single IDR In the encoding code stream form of the full P frames of frame, with the continuity of P frames, exist because object is mobile or noise draws Enter, the problem of causing the image quality of image worse and worse, and exist due to the bit stream data of any one P frame Occur mistake, cause all P frames code stream decodings after any one above-mentioned P frame fail the problem of.
In order to solve the problems, such as that the encoding code stream form of the full P frames of above-mentioned single every IDR frame is present, it is proposed that Yi Zhongchang The synthetic method of phase reference encoder code stream, it is specific to close shown in encoding code stream form such as Fig. 1 (c) of generation It is as follows into method:
P frames (the P_L1 frames in such as Fig. 1 (c)) on each setting interval are with first every IDR frame Encoded for long term reference background frames, remaining each P frame (the P_L0 frames in such as Fig. 1 (c)) Encoded using previous P frames as reference frame, the encoding code stream form of generation is IDRpp...ppPpp...pp.
It follows that due to setting the P_L1 frames on interval carried on the back by long term reference of first every IDR frame Scape frame is encoded, so, image quality can be brushed at the time of each P_L1 frame corresponds to Newly, so as to ensure that effect that image is presented, if moreover, mistake occurs in the bit stream data of any one P frame, Also the P frames code stream decoding failure set in interval where any one above-mentioned P frame can only be caused, will not be right P frame code stream decodings in other setting intervals have any impact.
Based on above-mentioned analysis, although above-mentioned long term reference coded system solves the full P frames of above-mentioned single every IDR frame The problem of encoding code stream form is present, but above-mentioned long term reference coded system needs to use first every IDR frame Referred to two kinds of reference frames of P_L1 frames on setting interval, considerably increase the cost of manufacture of chip. Moreover, the encoder of current most code stream generating device is stone encoder, do not support above-mentioned long-term Reference encoder function, to use above-mentioned long term reference coded system, it can only utilize in code stream generating device Central manager (Central Processing Unit, CPU) realizes that this is just to code stream generating device Performance requirement is higher, and most code stream generating device is difficult the synthesis for completing long term reference encoding code stream.
The content of the invention
The embodiments of the invention provide a kind of coding method of long term reference code stream and code device, to solve Most bitstream generation equipment does not support long term reference coded system of the prior art, and prior art In long term reference coded system cost it is higher the problem of.
Concrete technical scheme provided in an embodiment of the present invention is as follows:
A kind of coding method of long term reference code stream, including:
Code stream generating device is respectively to original corresponding to each instantaneous decoding refresh every IDR frame for collecting Yuv data carries out short term reference coding, generates corresponding short term reference bit stream data;
Code stream generating device chooses an every IDR frame as current long term reference frame, and based on described current long Phase reference frame, respectively to original corresponding to other each every IDR frames in addition to the current long term reference frame Yuv data carries out P frame codings, and obtains corresponding target P frame bit stream datas;
Code stream generating device is respectively by other each every IDR frames pair in addition to the current long term reference frame The short term reference bit stream data answered replaces with corresponding target P frame bit stream datas.
Preferably, code stream generating device is to other any one IDR in addition to the current long term reference frame Original yuv data carries out P frame codings corresponding to frame, and obtains corresponding target P frame bit stream datas, wraps Include:
Code stream generating device obtains the quantization parameter QP values and QP variable quantities of any one every IDR frame;
Code stream generating device is based on the current long term reference frame, according to the QP values of acquisition and the QP Variable quantity, P frame codings are carried out to original yuv data corresponding to any one described every IDR frame, obtain phase The target P frame bit stream datas answered.
Preferably, code stream generating device obtains the QP variable quantities of any one every IDR frame, including:
Code stream generating device further obtains short term reference reconstruction YUV corresponding to any one described every IDR frame Data;Wherein, the short term reference of any one every IDR frame, which rebuilds yuv data, is:To described any Original yuv data carries out what is generated during short term reference coding corresponding to one every IDR frame;
The short term reference that code stream generating device calculates any one every IDR frame rebuilds yuv data, and right The first Y-PSNR PSNR between the original yuv data answered;
Code stream generating device is based on the first PSNR, obtains the QP changes of any one every IDR frame Amount.
Preferably, code stream generating device is based on the current long term reference frame, according to the QP values of acquisition With the QP variable quantities, P frame volumes are carried out to original yuv data corresponding to any one described every IDR frame Code, obtains corresponding target P frame bit stream datas, including:
Code stream generating device is based on the current long term reference frame, according to the QP values of acquisition and the QP Variable quantity, multiple P frames are carried out to original yuv data corresponding to any one described every IDR frame and encoded, are obtained Obtain multiple P frames bit stream datas accordingly;
Code stream generating device chooses a P frame bit stream data from the multiple P frames bit stream data, as The target P frame bit stream datas of any one every IDR frame.
Preferably, code stream generating device is based on the current long term reference frame, according to the QP values of acquisition With the QP variable quantities, multiple P is carried out to original yuv data corresponding to any one described every IDR frame Frame encodes, and obtains corresponding multiple P frames bit stream datas, including at least two in following operation:
Code stream generating device is based on the current long term reference frame, according to the QP values of acquisition, to described Original yuv data carries out P frame codings corresponding to any one every IDR frame, obtains corresponding first P frame codes Flow data;
Code stream generating device is based on the current long term reference frame, is changed according to the QP values and the QP Difference between amount, P frame codings are carried out to original yuv data corresponding to any one described every IDR frame, Obtain corresponding 2nd P frame bit stream datas;
Code stream generating device is based on the current long term reference frame, is changed according to the QP values and the QP Sum is measured, P frame codings are carried out to original yuv data corresponding to any one described every IDR frame, obtain phase The 3rd P frame bit stream datas answered.
Preferably, code stream generating device from the multiple P frames bit stream data, chooses a P frame code stream number According to, as the target P frame bit stream datas of any one every IDR frame, including:
Code stream generating device further obtains multiple P frames reconstruction YUV corresponding to any one described every IDR frame Data, wherein, a P frame, which rebuilds yuv data, corresponding to any one described every IDR frame is:To described Original yuv data corresponding to any one every IDR frame carries out what is generated during a P frames coding, and one P frames rebuild the corresponding P frame bit stream data of yuv data;
Code stream generating device calculates each P frame reconstruction YUV corresponding to any one described every IDR frame respectively Data, corresponding with any one described every IDR frame short term reference rebuild between yuv data second PSNR, obtain multiple 2nd PSNR corresponding to any one described every IDR frame;
Code stream generating device chooses the PSNR of target the 2nd from the multiple 2nd PSNR;
It is corresponding to choose the PSNR of target the 2nd from the multiple P frames bit stream data for code stream generating device P frame bit stream datas, the target P frame bit stream datas as any one every IDR frame.
Preferably, code stream generating device chooses an every IDR frame as current long term reference frame, including:
Code stream generating device is using collect first every IDR frame as current long term reference frame;Or
When code stream generating device determines that any one target the 2nd PSNR is not more than default threshold value, by institute Every IDR frame corresponding to any one target the 2nd PSNR is stated as current long term reference frame.
Preferably, code stream generating device respectively by addition to the current long term reference frame other each Short term reference bit stream data corresponding to every IDR frame replaces with corresponding target P frame bit stream datas, including:
Code stream generating device filters out from other all every IDR frames in addition to the current long term reference frame All PSNR of the target the 2nd are more than the every IDR frame of default threshold value;
Code stream generating device respectively replaces short term reference bit stream data corresponding to each every IDR frame filtered out It is changed to corresponding target P frame bit stream datas.
Preferably, code stream generating device is by short term reference code stream number corresponding to any one every IDR frame filtered out According to replacing with corresponding target P frame bit stream datas, including:
Code stream generating device is by grammer corresponding to the target P frame bit stream datas of any one every IDR frame filtered out Element, changed according to default long term reference coded system, and any one described every IDR frame is corresponded to Short term reference bit stream data, replace with conversion after target P frame bit stream datas;Or
Code stream generating device directly by short term reference bit stream data corresponding to any one every IDR frame filtered out, Replace with corresponding target P frame bit stream datas.
A kind of code device of long term reference code stream, including:
First coding unit, for respectively to former corresponding to each instantaneous decoding refresh every IDR frame for collecting Beginning yuv data carries out short term reference coding, generates corresponding short term reference bit stream data;
Second coding unit, work as choosing an every IDR frame as current long term reference frame, and based on described Preceding long term reference frame, respectively to corresponding to other each every IDR frames in addition to the current long term reference frame Original yuv data carries out P frame codings, and obtains corresponding target P frame bit stream datas;
Replacement unit, for respectively by other each every IDR frames pair in addition to the current long term reference frame The short term reference bit stream data answered replaces with corresponding target P frame bit stream datas.
Preferably, to original corresponding to other any one every IDR frames in addition to the current long term reference frame Yuv data carries out P frame codings, and when obtaining corresponding target P frame bit stream datas, second coding Unit is used for:
Obtain the quantization parameter QP values and QP variable quantities of any one every IDR frame;
It is right according to the QP values of acquisition and the QP variable quantities based on the current long term reference frame Original yuv data carries out P frame codings corresponding to any one described every IDR frame, obtains corresponding target P Frame bit stream data.
Preferably, when obtaining the QP variable quantities of any one every IDR frame, second coding unit is used In:
Short term reference corresponding to further obtaining any one described every IDR frame rebuilds yuv data;Wherein, The short term reference of any one every IDR frame rebuilds yuv data:To any one described every IDR frame pair The original yuv data answered carries out what is generated during short term reference coding;
The short term reference for calculating any one every IDR frame rebuilds yuv data, with corresponding original YUV The first Y-PSNR PSNR between data;
Based on the first PSNR, the QP variable quantities of acquisition any one every IDR frame.
Preferably, being based on the current long term reference frame, become according to the QP values of acquisition and the QP Change amount, P frame codings are carried out to original yuv data corresponding to any one described every IDR frame, obtained corresponding Target P frame bit stream datas when, second coding unit is used for:
It is right according to the QP values of acquisition and the QP variable quantities based on the current long term reference frame Original yuv data corresponding to any one described every IDR frame carries out multiple P frames coding, obtains corresponding more Individual P frames bit stream data;
From the multiple P frames bit stream data, choose a P frame bit stream data, as it is described any one The target P frame bit stream datas of every IDR frame.
Preferably, being based on the current long term reference frame, become according to the QP values of acquisition and the QP Change amount, multiple P frames are carried out to original yuv data corresponding to any one described every IDR frame and encoded, are obtained During corresponding multiple P frames bit stream datas, second coding unit is used to perform following at least two operation:
Based on the current long term reference frame, according to the QP values of acquisition, to any one described IDR Original yuv data carries out P frame codings corresponding to frame, obtains corresponding first P frame bit stream datas;
Based on the current long term reference frame, according to the difference between the QP values and the QP variable quantities, P frame codings are carried out to original yuv data corresponding to any one described every IDR frame, obtain corresponding second P frame bit stream datas;
Based on the current long term reference frame, according to the QP values and the QP variable quantities sum, to institute State original yuv data corresponding to any one every IDR frame and carry out P frame codings, obtain corresponding 3rd P frames Bit stream data.
Preferably, from the multiple P frames bit stream data, a P frame bit stream data is chosen, as described During the target P frame bit stream datas of any one every IDR frame, second coding unit is used for:
Multiple P frames corresponding to further obtaining any one described every IDR frame rebuild yuv data, wherein, A P frame, which rebuilds yuv data, corresponding to any one described every IDR frame is:To any one described IDR Original yuv data corresponding to frame carries out what is generated during a P frames coding, and a P frame rebuilds YUV The corresponding P frame bit stream data of data;
Each P frame corresponding to any one described every IDR frame is calculated respectively rebuilds yuv data, it is and described The 2nd PSNR that short term reference corresponding to any one every IDR frame is rebuild between yuv data, described in acquisition Multiple 2nd PSNR corresponding to any one every IDR frame;
From the multiple 2nd PSNR, the PSNR of target the 2nd is chosen;
From the multiple P frames bit stream data, P frame code stream numbers corresponding to the PSNR of target the 2nd are chosen According to the target P frame bit stream datas as any one every IDR frame.
Preferably, when choosing an every IDR frame as current long term reference frame, second coding unit is used for:
Using collect first every IDR frame as current long term reference frame;Or
, will any one described mesh when determining that any one target the 2nd PSNR is not more than default threshold value Every IDR frame corresponding to the 2nd PSNR is marked as current long term reference frame.
Preferably, respectively will be short corresponding to other each every IDR frames in addition to the current long term reference frame When phase replaces with corresponding target P frame bit stream datas with reference to bit stream data, the replacement unit is used for:
From other all every IDR frames in addition to the current long term reference frame, all mesh are filtered out Mark the every IDR frame that the 2nd PSNR is more than default threshold value;
Short term reference bit stream data corresponding to each every IDR frame filtered out is replaced with into corresponding mesh respectively Mark P frame bit stream datas.
Preferably, short term reference bit stream data corresponding to any one every IDR frame filtered out is replaced with accordingly Target P frame bit stream datas when, the replacement unit is used for:
By syntactic element corresponding to the target P frame bit stream datas of any one every IDR frame filtered out, according to pre- If long term reference coded system changed, and will short term reference code corresponding to any one described every IDR frame Flow data, replace with the target P frame bit stream datas after conversion;Or
Directly by short term reference bit stream data corresponding to any one every IDR frame filtered out, replace with corresponding Target P frame bit stream datas.
The embodiment of the present invention has the beneficial effect that:
In the embodiment of the present invention, need not both any hardware modifications be done to current code stream generating device, Coding protocol need not be changed, utilizes original yard of stream generating device, it is possible to except current long term reference frame Outside other each every IDR frames corresponding to original yuv data carry out P frame codings, it is long-term so as to realize With reference to the synthesis of code stream, implementation process is simple, efficient, is not take up excessive internal resource.
Further, code stream generating device corresponds to according to the QP values and QP variable quantities of acquisition to every IDR frame Original yuv data carry out multiple P frames coding, reduce the excessive loss that P frames coding-belt comes, moreover, The short term reference bit stream data for being only more than the every IDR frame of default threshold value to the PSNR of target the 2nd carries out target The replacement of P frame bit stream datas, while picture quality is ensured, encoder bit rate is significantly reduced, saved Memory space.
Brief description of the drawings
Fig. 1 (a) is the encoding code stream form schematic diagram that short term reference generates after encoding in the prior art;
Fig. 1 (b) is the encoding code stream form schematic diagram of the full P frames of single every IDR frame in the prior art;
Fig. 1 (c) is the encoding code stream form schematic diagram generated in the prior art using long term reference mode;
Fig. 2 is the data flow architecture schematic diagram of code stream generating device in the embodiment of the present invention;
Fig. 3 is the overview schematic diagram of the synthetic method of long-term reference encoder code stream in the embodiment of the present invention;
Fig. 4 is the idiographic flow schematic diagram of the synthetic method of long-term reference encoder code stream in the embodiment of the present invention;
Fig. 5 is the illustrative view of functional configuration of the synthesizer of long-term reference encoder code stream in the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear Chu, it is fully described by, it is clear that described embodiment is only part of the embodiment of the present invention, is not Whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art are not making creation Property work under the premise of the every other embodiment that is obtained, belong to the scope of protection of the invention.
Long term reference of the prior art is not supported to compile in order to solve most of existing code stream generating devices Code mode and synthesize long term reference encoding code stream cost it is higher the problem of, in the embodiment of the present invention, utilize Existing code stream generating device, after carrying out short term reference coding to each every IDR frame collected, without carrying out Decoding, can directly choose an every IDR frame as current long term reference frame, and be based on current long term reference frame, Respectively other each every IDR frames in addition to current long term reference frame are carried out with P frame codings, generation is corresponding Target P frame bit stream datas, and respectively by other each IDR in addition to above-mentioned current long term reference frame Short term reference bit stream data corresponding to frame replaces with corresponding target P frame bit stream datas.
The present invention program is described in detail below by specific embodiment, certainly, the present invention is not limited to Following examples.
In the embodiment of the present invention, code stream generating device can gather data frame (the above-mentioned data frame monitored in real time Including every IDR frame and non-every IDR frame), and the data frame to collecting carries out short term reference coding, due to current Most bitstream generation equipment does not support long term reference coded system, therefore, the encoding code stream form of generation Generally IDRpp...ppIDRpp...pp encoding code stream form, as shown in fig.2, being set for code stream generation Standby data flow architecture schematic diagram, the data acquisition module in code stream generating device can gather in real time to be monitored Original yuv data corresponding to each data frame, and will be original corresponding to each data frame collected Yuv data stores Double Data Rate synchronous DRAM (Double Data Rate, DDR) In, the encoder in code stream generating device is in original YUV numbers corresponding to each data frame to collecting According to, it is necessary to first obtain relevant coded data from DDR memory, then being based on when carrying out short term reference coding The relevant coded data of acquisition, original yuv data corresponding to each data frame for collecting is carried out short Phase reference encoder, and the corresponding short term reference bit stream data generated after short term reference is encoded and short-term ginseng Reconstruction yuv data is examined to store into DDR memory.
As shown in fig.3, in the embodiment of the present invention, a kind of specific stream of the coding method of long term reference code stream Journey is as follows:
Step 300:Code stream generating device is respectively to original YUV corresponding to each every IDR frame for collecting Data carry out short term reference coding, generate corresponding short term reference bit stream data.
Specifically, when performing step 300, it can use but be not limited in the following manner:
Code stream generating device each data frame that collection monitors in real time (above-mentioned data frame include every IDR frame and Non- every IDR frame) corresponding to original yuv data, and preserve original corresponding to each data frame for collecting Yuv data, code stream generating device be directed to each data frame for collecting corresponding to original yuv data enter When row short term reference encodes, exist but be not limited to following three kinds of situations:
The first situation:Code stream generating device determines that the current data frame for carrying out short term reference coding is every IDR frame When, short term reference coding directly is carried out to original yuv data corresponding to above-mentioned every IDR frame, obtained corresponding Short term reference bit stream data, further obtain corresponding short term reference and rebuild yuv data.
Second of situation:Code stream generating device determines that the current data frame for carrying out short term reference coding is:It is adjacent Two every IDR frames between first P frame when, based on first IDR in two adjacent every IDR frames The short term reference of frame rebuilds yuv data, and original yuv data corresponding to above-mentioned first P frame is carried out Short term reference encodes, and obtains corresponding short term reference bit stream data, further obtains corresponding short term reference weight Build yuv data.
The third situation:Code stream generating device determines that the current data frame for carrying out short term reference coding is:It is adjacent Two every IDR frames between all P frames of other in addition to first P frame in any one P frame when, The short term reference of previous P frames based on any one above-mentioned P frame rebuilds yuv data, to above-mentioned any Original yuv data carries out short term reference coding corresponding to one P frame, obtains corresponding short term reference code stream Data, further obtain corresponding short term reference and rebuild yuv data.
Such as:Code stream generating device 1 gathers original YUV corresponding to each data frame monitored in real time Data, and preserve original yuv data corresponding to each data frame collected.
It is short that code stream generating device 1 is directed to original yuv data progress corresponding to each data frame collected Phase reference encoder, only the data frame between two adjacent every IDR frames is carried out with code stream generating device 1 below Illustrated exemplified by short term reference coding, it is assumed that the P frames of 5 between every IDR frame A and every IDR frame B be present (being followed successively by P frame 1-P frames 5).
When the data frame that code stream generating device 1 determines currently to carry out short term reference coding is every IDR frame A, base Short term reference coding, generation short term reference bit stream data A are carried out in every IDR frame A original yuv data A Yuv data A is rebuild with short term reference.
Code stream generating device 1 determines that the current data frame for carrying out short term reference coding is that P frames 1 (are IDR First P frame between frame A and every IDR frame B) when, the short term reference based on every IDR frame A rebuilds YUV Data A, short term reference coding is carried out to the original yuv data 1 of P frames 1, generates short term reference code stream Data 1 and short term reference rebuild yuv data 1.
Code stream generating device 1 determines that the current data frame for carrying out short term reference coding is that P frames 2 (are IDR Any one P frame in all P frames of other in addition to first P frame between frame A and every IDR frame B) When, the short term reference based on P frames 1 rebuilds yuv data 1, to the original yuv data 2 of P frames 2 Short term reference coding is carried out, generation short term reference bit stream data 2 and short term reference rebuild yuv data 2.
Code stream generating device 1 determines that the current data frame for carrying out short term reference coding is that P frames 3 (are IDR Any one P frame in all P frames of other in addition to first P frame between frame A and every IDR frame B) When, the short term reference based on P frames 2 rebuilds yuv data 2, to the original yuv data 3 of P frames 3 Short term reference coding is carried out, generation short term reference bit stream data 3 and short term reference rebuild yuv data 3.
Code stream generating device 1 determines that the current data frame for carrying out short term reference coding is that P frames 4 (are IDR Any one P frame in all P frames of other in addition to first P frame between frame A and every IDR frame B) When, the short term reference based on P frames 3 rebuilds yuv data 3, to the original yuv data 4 of P frames 4 Short term reference coding is carried out, generation short term reference bit stream data 4 and short term reference rebuild yuv data 4.
Code stream generating device 1 determines that the current data frame for carrying out short term reference coding is that P frames 5 (are IDR Any one P frame in all P frames of other in addition to first P frame between frame A and every IDR frame B) When, the short term reference based on P frames 4 rebuilds yuv data 4, to the original yuv data 5 of P frames 5 Short term reference coding is carried out, generation short term reference bit stream data 5 and short term reference rebuild yuv data 5.
When the data frame that code stream generating device 1 determines currently to carry out short term reference coding is every IDR frame B, base Short term reference coding, generation short term reference bit stream data B are carried out in every IDR frame B original yuv data B Yuv data B is rebuild with short term reference.
Step 310:Code stream generating device chooses an every IDR frame as current long term reference frame, and based on upper Current long term reference frame is stated, respectively to other each every IDR frames pair in addition to above-mentioned current long term reference frame The original yuv data answered carries out P frame codings, and obtains corresponding target P frame bit stream datas.
Specifically, when performing step 310, it can use but be not limited to following steps:
First, code stream generating device chooses an every IDR frame as current long term reference frame, calculates respectively except upper The short term reference for stating other each every IDR frames outside current long term reference frame rebuilds yuv data, and right The first PSNR between the original yuv data answered, and all first PSNR based on acquisition, are counted respectively The QP variable quantities of other each every IDR frames in addition to above-mentioned current long term reference frame are calculated, and are marked from coding In standard, the QP values of other each every IDR frames in addition to above-mentioned current long term reference frame are directly obtained.
Then, code stream generating device is based on above-mentioned current long term reference frame, according to acquisition except above-mentioned current long The QP values of other each every IDR frames outside phase reference frame and corresponding QP variable quantities, respectively to except upper Original yuv data corresponding to other each every IDR frames outside current long term reference frame is stated, is carried out multiple P frames encode, and generate corresponding multiple P frames bit stream datas.
Preferably, code stream generating device is to other any one IDR in addition to above-mentioned current long term reference frame Original yuv data corresponding to frame, multiple P frames coding is carried out, generates corresponding multiple P frames bit stream datas When, it can perform but be not limited at least two steps in following steps:
Code stream generating device is based on above-mentioned current long term reference frame, according to the above-mentioned QP values of acquisition, to above-mentioned Original yuv data carries out P frame codings corresponding to any one every IDR frame, obtains corresponding first P frame codes Flow data, it can also further obtain corresponding P frames and rebuild yuv data.
Code stream generating device is based on above-mentioned current long term reference frame, is changed according to above-mentioned QP values and above-mentioned QP Difference between amount, P frame codings are carried out to original yuv data corresponding to any one above-mentioned every IDR frame, Corresponding 2nd P frame bit stream datas are obtained, corresponding P frames can also be further obtained and rebuild yuv data.
Code stream generating device is based on above-mentioned current long term reference frame, is changed according to above-mentioned QP values and above-mentioned QP Sum is measured, P frame codings are carried out to original yuv data corresponding to any one above-mentioned every IDR frame, obtain phase The 3rd P frame bit stream datas answered, it can also further obtain corresponding P frames and rebuild yuv data.
Secondly, code stream generating device obtains other each every IDR frames in addition to above-mentioned current long term reference frame Corresponding multiple P frames rebuild yuv data, and calculate its in addition to above-mentioned current long term reference frame respectively Multiple 2nd PSNR corresponding to his each every IDR frame, wherein, multiple second corresponding to an every IDR frame PSNR is:Each P frame that said one every IDR frame generated after multiple P frames coding rebuilds YUV Data, the 2nd PSNR that short term reference corresponding with said one every IDR frame is rebuild between yuv data.
Finally, code stream generating device is from other each every IDR frames pair in addition to above-mentioned current long term reference frame The multiple P frames bit stream datas answered and multiple P frames are rebuild in yuv data, respectively except above-mentioned current long-term Other each every IDR frames outside reference frame, target P frame bit stream datas are chosen, preferably, above-mentioned target P frames bit stream data can be but not limited to:The PSNR of target the 2nd (can be but not limited to:Maximum the Two PSNR) corresponding to P frame bit stream datas.
Preferably, when code stream generating device chooses an every IDR frame as current long term reference frame, can choose But following two every IDR frames are not limited to as current long term reference frame:
The first chooses mode:First every IDR frame collected is chosen as current long term reference frame.
Second of selection mode:Determine that any one target the 2nd PSNR (can be but not limited to:It is maximum 2nd PSNR) when being not more than default threshold value, it is corresponding to choose above-mentioned any one target the 2nd PSNR Every IDR frame as current long term reference frame.
Such as:Continue to use the example above, it is assumed that code stream generating device 1 chooses first every IDR frame collected (i.e. Every IDR frame A) current long term reference frame is used as, and the current data frame for carrying out P frame codings is every IDR frame B, Only carried out below so that code stream generating device 1 carries out P frame codings to every IDR frame B original yuv data as an example Illustrate, wherein, code stream generating device 1 can be to original YUV corresponding to each every IDR frame for collecting in real time Data carry out P frame codings respectively.
Code stream generating device 1 chooses first every IDR frame (i.e. every IDR frame A) collected as current long Phase reference frame, and the short term reference for calculating every IDR frame B rebuilds yuv data, with corresponding original YUV The first PSNR2 between data.
Code first PSNR 2 of the stream generating device 1 based on acquisition, every IDR frame B QP variable quantities 2 are calculated, And from coding standard, obtain every IDR frame B QP values 2.
Code stream generating device 1 is based on every IDR frame A, respectively according to QP values 2, QP values 2 and QP variable quantities 2 sums, and QP values 2 and the difference of QP variable quantities 2,3 P frames codings are carried out to every IDR frame B, Obtain corresponding 3 P frames bit stream data (P frame bit stream data B1, P frame bit stream data B2, P frame code streams Data B3), further obtain corresponding 3 P frames and rebuild yuv data (P frames reconstruction yuv data B1, P frame rebuild yuv data B2, P frame and rebuild yuv data B3).
Code stream generating device 1 P frames according to corresponding to every IDR frame B rebuild yuv data B1 and short term reference Rebuild yuv data B, P frame and rebuild yuv data B2 and short term reference reconstruction yuv data B, and P frames rebuild yuv data B3 and short term reference rebuilds yuv data B, and it is corresponding to calculate every IDR frame B respectively The 2nd PSNR B1, the 2nd PSNR B2 and the 2nd PSNR B3.
Code stream generating device 13 the 2nd PSNR (the 2nd PSNR according to corresponding to the every IDR frame B calculated B1, the 2nd PSNR B2 and the 2nd PSNR B3), the 2nd maximum PSNR B1 of numerical value are chosen as mesh The 2nd PSNR is marked, and chooses P frame code stream numbers corresponding to the 2nd PSNR B1 (i.e. the PSNR of target the 2nd) According to target P frame bit stream datas of the B1 as every IDR frame B.
Step 320:Code stream generating device respectively by addition to above-mentioned current long term reference frame other each Short term reference bit stream data corresponding to every IDR frame replaces with corresponding target P frame bit stream datas.
Specifically, when performing step 320, it can use but be not limited to following steps:
First, code stream generating device is from other all every IDR frames in addition to above-mentioned current long term reference frame, Filter out all every IDR frames that the 2nd PSNR of maximum (i.e. the PSNR of target the 2nd) is more than default threshold value.
Then, code stream generating device is respectively by short term reference code stream number corresponding to each every IDR frame filtered out According to replacing with corresponding target P frame bit stream datas.
Preferably, in order to ensure that the image quality of monitoring image is clear, code stream generating device is only by the 2nd PSNR of maximum (i.e. the PSNR of target the 2nd) replaces more than short term reference bit stream data corresponding to the every IDR frame of default threshold value Corresponding target P frame bit stream datas are changed to, do not replace the 2nd PSNR of maximum (i.e. the PSNR of target the 2nd) No more than short term reference bit stream data corresponding to the every IDR frame of default threshold value.
Tellable to be, code stream generating device is respectively by short term reference corresponding to each every IDR frame filtered out When bit stream data replaces with corresponding target P frame bit stream datas, it can use but be not limited to following two modes:
First way:P frame hard coded modes, i.e., by there is the special chip of integrated decoding function to complete, The coded system participated in without operating system and corresponding software.Specifically, code stream generating device will filter out Syntactic element corresponding to the target P frame bit stream datas of each every IDR frame, encoded according to default long term reference Mode is changed, and by short term reference bit stream data corresponding to each above-mentioned every IDR frame, is replaced with corresponding Conversion after target P frame bit stream datas.
Wherein, above-mentioned P frames hard coded mode, the head transcoding of target P frame bit stream datas, nothing are related only to Decoding re-encoding need to be carried out to short term reference bit stream data, implementation process is simple, efficient, is not take up excessive Internal resource, low to the performance requirement of code stream generating device, the code stream generating device of main flow can be completed for a long time The synthesis of reference encoder code stream.
The second way:The soft coded system of P frames, i.e., completed by CPU, need operating system to support and have phase Close the coded system that software participates in.Specifically, each every IDR frame that code stream generating device will directly filter out Corresponding short term reference bit stream data, replace with corresponding target P frame bit stream datas.
Wherein, the above-mentioned soft coded system of P frames, it is not necessary to carry out syntactic element transcoding, simply single frames is with reference to volume Code, and a frame is just encoded within several seconds, the code stream life of main flow not high to the performance requirement of code stream generating device Forming apparatus can be achieved.
Such as:Continue to use the example above, code stream generating device 1 determines every IDR frame B the 2nd PSNR B1 (i.e. The PSNR of target the 2nd) when being more than default threshold value, by target P frame bit stream datas corresponding to every IDR frame B Corresponding syntactic element, transcoding is carried out according to long term reference coded system, and will be short corresponding to every IDR frame B Phase replaces with the target P frame bit stream datas after transcoding with reference to bit stream data B.
Further, code stream generating device 1 replaces by short term reference bit stream data B corresponding to every IDR frame B It is each to what is collected using above-mentioned P frame coding modes after being changed to the target P frame bit stream datas after transcoding Individual every IDR frame carries out P frame codings respectively, and respectively by the 2nd PSNR of maximum (i.e. the PSNR of target the 2nd) More than all every IDR frames of default threshold value short term reference bit stream data replace with corresponding transcoding after Target P frame bit stream datas.
Such as:Code stream generating device 1 replaces with by short term reference bit stream data B corresponding to every IDR frame B After target P frame bit stream datas after transcoding, using above-mentioned P frame coding modes, to the every IDR frame C collected Original yuv data carry out P frame codings, determine the every IDR frame C PSNR of maximum the 2nd (i.e. targets the Two PSNR) when being less than default threshold value, short term reference bit stream data corresponding to every IDR frame C is not replaced C, and in original YUV numbers corresponding to next every IDR frame (being assumed to be every IDR frame D) to collecting When carrying out corresponding P frames coding according to D, every IDR frame C can be chosen as current long term reference frame.
Above-described embodiment is described in further detail using specific application scenarios below, as shown in fig.4, In the embodiment of the present invention, the idiographic flow of the coding method of long term reference code stream is as follows:
Step 400:Code stream generating device 1 gathers original corresponding to each data frame monitored in real time Yuv data, and preserve original yuv data corresponding to each data frame collected.
Step 401:Code stream generating device 1 is directed to original YUV corresponding to each data frame collected Data carry out short term reference coding.
Short term reference is only carried out to the data frame between two adjacent every IDR frames with code stream generating device 1 below Illustrated exemplified by coding, it is assumed that the P frames between every IDR frame A and every IDR frame B in the presence of 5 (are followed successively by P frame 1-P frames 5).
When the data frame that code stream generating device 1 determines currently to carry out short term reference coding is every IDR frame A, base Short term reference coding, generation short term reference bit stream data A are carried out in every IDR frame A original yuv data A Yuv data A is rebuild with short term reference.
Code stream generating device 1 determines that the current data frame for carrying out short term reference coding is that P frames 1 (are IDR First P frame between frame A and every IDR frame B) when, the short term reference based on every IDR frame A rebuilds YUV Data A, short term reference coding is carried out to the original yuv data 1 of P frames 1, generates short term reference code stream Data 1 and short term reference rebuild yuv data 1.
Code stream generating device 1 determines that the current data frame for carrying out short term reference coding is that P frames 2 (are IDR Any one P frame in all P frames of other in addition to first P frame between frame A and every IDR frame B) When, the short term reference based on P frames 1 rebuilds yuv data 1, to the original yuv data 2 of P frames 2 Short term reference coding is carried out, generation short term reference bit stream data 2 and short term reference rebuild yuv data 2.
Code stream generating device 1 determines that the current data frame for carrying out short term reference coding is that P frames 3 (are IDR Any one P frame in all P frames of other in addition to first P frame between frame A and every IDR frame B) When, the short term reference based on P frames 2 rebuilds yuv data 2, to the original yuv data 3 of P frames 3 Short term reference coding is carried out, generation short term reference bit stream data 3 and short term reference rebuild yuv data 3.
Code stream generating device 1 determines that the current data frame for carrying out short term reference coding is that P frames 4 (are IDR Any one P frame in all P frames of other in addition to first P frame between frame A and every IDR frame B) When, the short term reference based on P frames 3 rebuilds yuv data 3, to the original yuv data 4 of P frames 4 Short term reference coding is carried out, generation short term reference bit stream data 4 and short term reference rebuild yuv data 4.
Code stream generating device 1 determines that the current data frame for carrying out short term reference coding is that P frames 5 (are IDR Any one P frame in all P frames of other in addition to first P frame between frame A and every IDR frame B) When, the short term reference based on P frames 4 rebuilds yuv data 4, to the original yuv data 5 of P frames 5 Short term reference coding is carried out, generation short term reference bit stream data 5 and short term reference rebuild yuv data 5.
When the data frame that code stream generating device 1 determines currently to carry out short term reference coding is every IDR frame B, base Short term reference coding, generation short term reference bit stream data B are carried out in every IDR frame B original yuv data B Yuv data B is rebuild with short term reference.
Step 402:(P is only carried out to every IDR frame B original yuv data with code stream generating device 1 below Illustrated exemplified by frame coding, wherein, code stream generating device 1 understands each every IDR frame to collecting in real time Corresponding original yuv data carries out P frames coding respectively) code stream generating device 1 choose collect first Individual every IDR frame (i.e. every IDR frame A) is used as current long term reference frame, and calculates every IDR frame B short term reference Yuv data is rebuild, with the first PSNR2 between corresponding original yuv data.
Step 403:Code first PSNR 2 of the stream generating device 1 based on acquisition, calculate every IDR frame B QP Variable quantity 2, and obtain every IDR frame B QP values 2.
Step 404:Code stream generating device 1 be based on every IDR frame A, respectively according to QP values 2, QP values 2 and The sum of QP variable quantities 2, and QP values 2 and the difference of QP variable quantities 2,3 P are carried out to every IDR frame B Frame encodes, the corresponding 3 P frames bit stream data of generation (P frame bit stream data B1, P frame bit stream datas B2, P frames bit stream data B3) and 3 P frames reconstruction yuv datas (P frames reconstruction yuv data B1, P frames Rebuild yuv data B2, P frame and rebuild yuv data B3).
Step 405:Code stream generating device 1 P frames according to corresponding to every IDR frame B rebuild yuv data B1 Yuv data B, P frame, which are rebuild, with short term reference rebuilds yuv data B2 and short term reference reconstruction YUV Data B, and P frames rebuild yuv data B3 and short term reference rebuilds yuv data B, calculate respectively 2nd PSNR B1 corresponding to every IDR frame B, the 2nd PSNR B2 and the 2nd PSNR B3.
Step 406:Code stream generating device 13 the 2nd PSNR according to corresponding to the every IDR frame B calculated (the 2nd PSNR B1, the 2nd PSNR B2 and the 2nd PSNR B3), choose the 2nd maximum PSNR of numerical value B1 is chosen corresponding to the 2nd PSNR B1 (i.e. the PSNR of target the 2nd) as the PSNR of target the 2nd P frame bit stream datas B1 is every IDR frame B target P frame bit stream datas.
Step 407:Code stream generating device 1 determines the every IDR frame B PSNR B1 of maximum the 2nd (i.e. targets the Two PSNR) when being more than default threshold value, by grammer corresponding to every IDR frame B target P frame bit stream datas Element, transcoding is carried out according to long term reference coded system.
Step 408:Code stream generating device 1 replaces short term reference bit stream data B corresponding to every IDR frame B For the target P frame bit stream datas after transcoding.
Step 409:Code stream generating device 1 uses above-mentioned P frame coding modes, to each IDR collected Frame carries out P frame codings respectively, and is respectively more than the 2nd PSNR of maximum (i.e. the PSNR of target the 2nd) in advance If the short term reference bit stream data of all every IDR frames of threshold value replace with the target P after corresponding transcoding Frame bit stream data.
Wherein, code stream generating device 1 replaces with by short term reference bit stream data B corresponding to every IDR frame B After target P frame bit stream datas after transcoding, using above-mentioned P frame coding modes, to the every IDR frame C collected Original yuv data carry out P frame codings, determine every IDR frame C the PSNR of maximum 2nd be less than preset Threshold value when, do not replace short term reference bit stream data C corresponding to every IDR frame C, and to collecting Original yuv data D carries out corresponding P frames corresponding to next every IDR frame (being assumed to be every IDR frame D) During coding, every IDR frame C can be chosen as current long term reference frame.
Based on above-described embodiment, as shown in fig.5, in the embodiment of the present invention, the coding of long term reference code stream Device, comprise at least:
First coding unit 500, for being corresponded to respectively to each the instantaneous decoding refresh every IDR frame collected Original yuv data carry out short term reference coding, generate corresponding short term reference bit stream data;
Second coding unit 510, for choosing an every IDR frame as current long term reference frame, and based on upper Current long term reference frame is stated, respectively to other each every IDR frames pair in addition to above-mentioned current long term reference frame The original yuv data answered carries out P frame codings, and obtains corresponding target P frame bit stream datas;
Replacement unit 520, for respectively by other each IDR in addition to above-mentioned current long term reference frame Short term reference bit stream data corresponding to frame replaces with corresponding target P frame bit stream datas.
Preferably, to original corresponding to other any one every IDR frames in addition to above-mentioned current long term reference frame Yuv data carries out P frame codings, and when obtaining corresponding target P frame bit stream datas, above-mentioned second coding Unit 510 is used for:
Obtain the quantization parameter QP values and QP variable quantities of any one above-mentioned every IDR frame;
It is right according to the above-mentioned QP values of acquisition and above-mentioned QP variable quantities based on above-mentioned current long term reference frame Original yuv data carries out P frame codings corresponding to any one above-mentioned every IDR frame, obtains corresponding target P Frame bit stream data.
Preferably, when obtaining the QP variable quantities of any one above-mentioned every IDR frame, above-mentioned second coding unit 510 For:
Further obtain short term reference corresponding to any one above-mentioned every IDR frame and rebuild yuv data;Wherein, The short term reference of any one above-mentioned every IDR frame rebuilds yuv data:To any one above-mentioned every IDR frame pair The original yuv data answered carries out what is generated during short term reference coding;
The short term reference for calculating any one above-mentioned every IDR frame rebuilds yuv data, with corresponding original YUV The first Y-PSNR PSNR between data;
Based on above-mentioned first PSNR, the QP variable quantities of any one above-mentioned every IDR frame of acquisition.
Preferably, being based on above-mentioned current long term reference frame, become according to the above-mentioned QP values of acquisition and above-mentioned QP Change amount, P frame codings are carried out to original yuv data corresponding to any one above-mentioned every IDR frame, obtained corresponding Target P frame bit stream datas when, above-mentioned second coding unit 510 is used for:
It is right according to the above-mentioned QP values of acquisition and above-mentioned QP variable quantities based on above-mentioned current long term reference frame Original yuv data corresponding to any one above-mentioned every IDR frame carries out multiple P frames coding, obtains corresponding more Individual P frames bit stream data;
From above-mentioned multiple P frames bit stream datas, choose a P frame bit stream data, as it is above-mentioned any one The target P frame bit stream datas of every IDR frame.
Preferably, being based on above-mentioned current long term reference frame, become according to the above-mentioned QP values of acquisition and above-mentioned QP Change amount, multiple P frames are carried out to original yuv data corresponding to any one above-mentioned every IDR frame and encoded, are obtained During corresponding multiple P frames bit stream datas, above-mentioned second coding unit 510 is used to perform following at least two behaviour Make:
Based on above-mentioned current long term reference frame, according to the above-mentioned QP values of acquisition, to any one above-mentioned IDR Original yuv data carries out P frame codings corresponding to frame, obtains corresponding first P frame bit stream datas;
Based on above-mentioned current long term reference frame, according to the difference between above-mentioned QP values and above-mentioned QP variable quantities, P frame codings are carried out to original yuv data corresponding to any one above-mentioned every IDR frame, obtain corresponding second P frame bit stream datas;
Based on above-mentioned current long term reference frame, according to above-mentioned QP values and above-mentioned QP variable quantities sum, to upper State original yuv data corresponding to any one every IDR frame and carry out P frame codings, obtain corresponding 3rd P frames Bit stream data.
Preferably, from above-mentioned multiple P frames bit stream datas, a P frame bit stream data is chosen, as above-mentioned During the target P frame bit stream datas of any one every IDR frame, above-mentioned second coding unit 510 is used for:
Further obtain multiple P frames corresponding to any one above-mentioned every IDR frame and rebuild yuv data, wherein, A P frame, which rebuilds yuv data, corresponding to any one above-mentioned every IDR frame is:To any one above-mentioned IDR Original yuv data corresponding to frame carries out what is generated during a P frames coding, and a P frame rebuilds YUV The corresponding P frame bit stream data of data;
Each P frame corresponding to any one above-mentioned every IDR frame is calculated respectively rebuilds yuv data, it is and above-mentioned The 2nd PSNR that short term reference corresponding to any one every IDR frame is rebuild between yuv data, obtain above-mentioned Multiple 2nd PSNR corresponding to any one every IDR frame;
From above-mentioned multiple 2nd PSNR, the PSNR of target the 2nd is chosen;
From above-mentioned multiple P frames bit stream datas, P frame code stream numbers corresponding to the above-mentioned PSNR of target the 2nd are chosen According to the target P frame bit stream datas as any one above-mentioned every IDR frame.
Preferably, when choosing an every IDR frame as current long term reference frame, above-mentioned second coding unit 510 For:
Using collect first every IDR frame as current long term reference frame;Or
When determining that any one target the 2nd PSNR is not more than default threshold value, by any one above-mentioned mesh Every IDR frame corresponding to the 2nd PSNR is marked as current long term reference frame.
Preferably, respectively will be short corresponding to other each every IDR frames in addition to above-mentioned current long term reference frame When phase replaces with corresponding target P frame bit stream datas with reference to bit stream data, above-mentioned replacement unit 520 is used for:
From other all every IDR frames in addition to above-mentioned current long term reference frame, all above-mentioned mesh are filtered out Mark the every IDR frame that the 2nd PSNR is more than default threshold value;
Short term reference bit stream data corresponding to each every IDR frame filtered out is replaced with into corresponding mesh respectively Mark P frame bit stream datas.
Preferably, short term reference bit stream data corresponding to any one every IDR frame filtered out is replaced with accordingly Target P frame bit stream datas when, above-mentioned replacement unit 520 is used for:
By syntactic element corresponding to the target P frame bit stream datas of any one every IDR frame filtered out, according to pre- If long term reference coded system changed, and by short term reference code corresponding to any one above-mentioned every IDR frame Flow data, replace with the target P frame bit stream datas after conversion;Or
Directly by short term reference bit stream data corresponding to any one every IDR frame filtered out, replace with corresponding Target P frame bit stream datas.
In summary, in the embodiment of the present invention, code stream generating device is carried out to each every IDR frame collected After short term reference coding, an every IDR frame is chosen as current long term reference frame, and be based on current long term reference Frame, P frame codings are carried out to other each every IDR frames in addition to current long term reference frame respectively, generate phase The target P frame bit stream datas answered, and respectively by addition to the current long term reference frame other each Short term reference bit stream data corresponding to every IDR frame replaces with corresponding target P frame bit stream datas.So, neither Need to do any hardware modifications to current code stream generating device, it is not required that modification coding protocol, utilize Original yard of stream generating device, it is possible to other each every IDR frames pair in addition to current long term reference frame The original yuv data answered carries out P frame codings, so as to realize the synthesis of long term reference code stream, implementation process Simply, efficiently, it is not take up excessive internal resource.
Further, code stream generating device corresponds to according to the QP values and QP variable quantities of acquisition to every IDR frame Original yuv data carry out multiple P frames coding, so as to reduce the excessive loss that P frames coding-belt comes, And the short term reference bit stream data for being only more than the every IDR frame of default threshold value to the PSNR of target the 2nd is carried out The replacement of target P frame bit stream datas, while picture quality is ensured, encoder bit rate is significantly reduced, Save memory space.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or meter Calculation machine program product.Therefore, the present invention can use complete hardware embodiment, complete software embodiment or knot The form of embodiment in terms of conjunction software and hardware.Wherein wrapped in one or more moreover, the present invention can use Containing computer usable program code computer-usable storage medium (include but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) on the form of computer program product implemented.
The present invention is produced with reference to method according to embodiments of the present invention, equipment (system) and computer program The flow chart and/or block diagram of product describes.It should be understood that can by computer program instructions implementation process figure and / or each flow in block diagram and/or square frame and flow in flow chart and/or block diagram and/ Or the combination of square frame.These computer program instructions can be provided to all-purpose computer, special-purpose computer, insertion Formula processor or the processor of other programmable data processing devices are to produce a machine so that pass through calculating The instruction of the computing device of machine or other programmable data processing devices is produced for realizing in flow chart one The device for the function of being specified in individual flow or multiple flows and/or one square frame of block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable datas to handle and set In the standby computer-readable memory to work in a specific way so that be stored in the computer-readable memory Instruction produce and include the manufacture of command device, command device realization is in one flow or multiple of flow chart The function of being specified in one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices, made Obtain and series of operation steps is performed on computer or other programmable devices to produce computer implemented place Reason, so as to which the instruction that is performed on computer or other programmable devices is provided for realizing in flow chart one The step of function of being specified in flow or multiple flows and/or one square frame of block diagram or multiple square frames.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know base This creative concept, then other change and modification can be made to these embodiments.So appended right will Ask and be intended to be construed to include preferred embodiment and fall into having altered and changing for the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification without de- to the embodiment of the present invention From the spirit and scope of the embodiment of the present invention.So, if these modifications and variations category of the embodiment of the present invention Within the scope of the claims in the present invention and its equivalent technologies, then the present invention be also intended to comprising these change and Including modification.

Claims (18)

  1. A kind of 1. coding method of long term reference code stream, it is characterised in that including:
    Code stream generating device is respectively to original corresponding to each instantaneous decoding refresh every IDR frame for collecting Yuv data carries out short term reference coding, generates corresponding short term reference bit stream data;
    Code stream generating device chooses an every IDR frame as current long term reference frame, and based on described current long-term Reference frame, respectively to original corresponding to other each every IDR frames in addition to the current long term reference frame Yuv data carries out P frame codings, and obtains corresponding target P frame bit stream datas;
    Code stream generating device is respectively by other each every IDR frames pair in addition to the current long term reference frame The short term reference bit stream data answered replaces with corresponding target P frame bit stream datas.
  2. 2. the method as described in claim 1, it is characterised in that code stream generating device is to except described current Original yuv data carries out P frame codings corresponding to other any one every IDR frames outside long term reference frame, And corresponding target P frame bit stream datas are obtained, including:
    Code stream generating device obtains the quantization parameter QP values and QP variable quantities of any one every IDR frame;
    Code stream generating device is based on the current long term reference frame, according to the QP values of acquisition and the QP Variable quantity, P frame codings are carried out to original yuv data corresponding to any one described every IDR frame, obtain phase The target P frame bit stream datas answered.
  3. 3. method as claimed in claim 2, it is characterised in that code stream generating device obtains described any The QP variable quantities of one every IDR frame, including:
    Code stream generating device further obtains short term reference reconstruction YUV corresponding to any one described every IDR frame Data;Wherein, the short term reference of any one every IDR frame, which rebuilds yuv data, is:To described any Original yuv data carries out what is generated during short term reference coding corresponding to one every IDR frame;
    The short term reference that code stream generating device calculates any one every IDR frame rebuilds yuv data, and right The first Y-PSNR PSNR between the original yuv data answered;
    Code stream generating device is based on the first PSNR, obtains the QP changes of any one every IDR frame Amount.
  4. 4. method as claimed in claim 2, it is characterised in that code stream generating device is based on described current Long term reference frame, according to the QP values of acquisition and the QP variable quantities, to any one described IDR Original yuv data carries out P frame codings corresponding to frame, obtains corresponding target P frame bit stream datas, including:
    Code stream generating device is based on the current long term reference frame, according to the QP values of acquisition and the QP Variable quantity, multiple P frames are carried out to original yuv data corresponding to any one described every IDR frame and encoded, are obtained Obtain multiple P frames bit stream datas accordingly;
    Code stream generating device chooses a P frame bit stream data from the multiple P frames bit stream data, as The target P frame bit stream datas of any one every IDR frame.
  5. 5. method as claimed in claim 4, it is characterised in that code stream generating device is based on described current Long term reference frame, according to the QP values of acquisition and the QP variable quantities, to any one described IDR Original yuv data corresponding to frame carries out multiple P frames coding, obtains corresponding multiple P frames bit stream datas, Including in following operation at least two:
    Code stream generating device is based on the current long term reference frame, according to the QP values of acquisition, to described Original yuv data carries out P frame codings corresponding to any one every IDR frame, obtains corresponding first P frame codes Flow data;
    Code stream generating device is based on the current long term reference frame, is changed according to the QP values and the QP Difference between amount, P frame codings are carried out to original yuv data corresponding to any one described every IDR frame, Obtain corresponding 2nd P frame bit stream datas;
    Code stream generating device is based on the current long term reference frame, is changed according to the QP values and the QP Sum is measured, P frame codings are carried out to original yuv data corresponding to any one described every IDR frame, obtain phase The 3rd P frame bit stream datas answered.
  6. 6. method as claimed in claim 4, it is characterised in that code stream generating device is from the multiple P In frame bit stream data, a P frame bit stream data, the target P as any one every IDR frame are chosen Frame bit stream data, including:
    Code stream generating device further obtains multiple P frames reconstruction YUV corresponding to any one described every IDR frame Data, wherein, a P frame, which rebuilds yuv data, corresponding to any one described every IDR frame is:To described Original yuv data corresponding to any one every IDR frame carries out what is generated during a P frames coding, and one P frames rebuild the corresponding P frame bit stream data of yuv data;
    Code stream generating device calculates each P frame reconstruction YUV corresponding to any one described every IDR frame respectively Data, corresponding with any one described every IDR frame short term reference rebuild between yuv data second PSNR, obtain multiple 2nd PSNR corresponding to any one described every IDR frame;
    Code stream generating device chooses the PSNR of target the 2nd from the multiple 2nd PSNR;
    It is corresponding to choose the PSNR of target the 2nd from the multiple P frames bit stream data for code stream generating device P frame bit stream datas, the target P frame bit stream datas as any one every IDR frame.
  7. 7. method as claimed in claim 6, it is characterised in that code stream generating device chooses an IDR Frame as current long term reference frame, including:
    Code stream generating device is using collect first every IDR frame as current long term reference frame;Or
    When code stream generating device determines that any one target the 2nd PSNR is not more than default threshold value, by institute Every IDR frame corresponding to any one target the 2nd PSNR is stated as current long term reference frame.
  8. 8. method as claimed in claim 6, it is characterised in that code stream generating device will remove described respectively Short term reference bit stream data corresponding to other each every IDR frames outside current long term reference frame replaces with phase The target P frame bit stream datas answered, including:
    Code stream generating device filters out from other all every IDR frames in addition to the current long term reference frame All PSNR of the target the 2nd are more than the every IDR frame of default threshold value;
    Code stream generating device respectively replaces short term reference bit stream data corresponding to each every IDR frame filtered out It is changed to corresponding target P frame bit stream datas.
  9. 9. method as claimed in claim 8, it is characterised in that code stream generating device is appointed what is filtered out Short term reference bit stream data corresponding to one every IDR frame of meaning replaces with corresponding target P frame bit stream datas, including:
    Code stream generating device is by grammer corresponding to the target P frame bit stream datas of any one every IDR frame filtered out Element, changed according to default long term reference coded system, and any one described every IDR frame is corresponded to Short term reference bit stream data, replace with conversion after target P frame bit stream datas;Or
    Code stream generating device directly by short term reference bit stream data corresponding to any one every IDR frame filtered out, Replace with corresponding target P frame bit stream datas.
  10. A kind of 10. code device of long term reference code stream, it is characterised in that including:
    First coding unit, for respectively to former corresponding to each instantaneous decoding refresh every IDR frame for collecting Beginning yuv data carries out short term reference coding, generates corresponding short term reference bit stream data;
    Second coding unit, work as choosing an every IDR frame as current long term reference frame, and based on described Preceding long term reference frame, respectively to corresponding to other each every IDR frames in addition to the current long term reference frame Original yuv data carries out P frame codings, and obtains corresponding target P frame bit stream datas;
    Replacement unit, for respectively by other each every IDR frames pair in addition to the current long term reference frame The short term reference bit stream data answered replaces with corresponding target P frame bit stream datas.
  11. 11. code device as claimed in claim 10, it is characterised in that to except the current long-term ginseng Examine original yuv data corresponding to other any one every IDR frames outside frame and carry out P frame codings, and obtain During corresponding target P frame bit stream datas, second coding unit is used for:
    Obtain the quantization parameter QP values and QP variable quantities of any one every IDR frame;
    It is right according to the QP values of acquisition and the QP variable quantities based on the current long term reference frame Original yuv data carries out P frame codings corresponding to any one described every IDR frame, obtains corresponding target P Frame bit stream data.
  12. 12. code device as claimed in claim 11, it is characterised in that obtain any one described IDR During the QP variable quantities of frame, second coding unit is used for:
    Short term reference corresponding to further obtaining any one described every IDR frame rebuilds yuv data;Wherein, The short term reference of any one every IDR frame rebuilds yuv data:To any one described every IDR frame pair The original yuv data answered carries out what is generated during short term reference coding;
    The short term reference for calculating any one every IDR frame rebuilds yuv data, with corresponding original YUV The first Y-PSNR PSNR between data;
    Based on the first PSNR, the QP variable quantities of acquisition any one every IDR frame.
  13. 13. code device as claimed in claim 11, it is characterised in that based on the current long-term ginseng Frame is examined, it is corresponding to any one described every IDR frame according to the QP values of acquisition and the QP variable quantities Original yuv data carry out P frame codings, when obtaining corresponding target P frame bit stream datas, described second Coding unit is used for:
    It is right according to the QP values of acquisition and the QP variable quantities based on the current long term reference frame Original yuv data corresponding to any one described every IDR frame carries out multiple P frames coding, obtains corresponding more Individual P frames bit stream data;
    From the multiple P frames bit stream data, choose a P frame bit stream data, as it is described any one The target P frame bit stream datas of every IDR frame.
  14. 14. code device as claimed in claim 13, it is characterised in that based on the current long-term ginseng Frame is examined, it is corresponding to any one described every IDR frame according to the QP values of acquisition and the QP variable quantities Original yuv data carry out multiple P frames coding, it is described when obtaining corresponding multiple P frames bit stream datas Second coding unit is used to perform following at least two operation:
    Based on the current long term reference frame, according to the QP values of acquisition, to any one described IDR Original yuv data carries out P frame codings corresponding to frame, obtains corresponding first P frame bit stream datas;
    Based on the current long term reference frame, according to the difference between the QP values and the QP variable quantities, P frame codings are carried out to original yuv data corresponding to any one described every IDR frame, obtain corresponding second P frame bit stream datas;
    Based on the current long term reference frame, according to the QP values and the QP variable quantities sum, to institute State original yuv data corresponding to any one every IDR frame and carry out P frame codings, obtain corresponding 3rd P frames Bit stream data.
  15. 15. code device as claimed in claim 13, it is characterised in that from the multiple P frames code stream In data, a P frame bit stream data, the target P frame code streams as any one every IDR frame are chosen During data, second coding unit is used for:
    Multiple P frames corresponding to further obtaining any one described every IDR frame rebuild yuv data, wherein, A P frame, which rebuilds yuv data, corresponding to any one described every IDR frame is:To any one described IDR Original yuv data corresponding to frame carries out what is generated during a P frames coding, and a P frame rebuilds YUV The corresponding P frame bit stream data of data;
    Each P frame corresponding to any one described every IDR frame is calculated respectively rebuilds yuv data, it is and described The 2nd PSNR that short term reference corresponding to any one every IDR frame is rebuild between yuv data, described in acquisition Multiple 2nd PSNR corresponding to any one every IDR frame;
    From the multiple 2nd PSNR, the PSNR of target the 2nd is chosen;
    From the multiple P frames bit stream data, P frame code stream numbers corresponding to the PSNR of target the 2nd are chosen According to the target P frame bit stream datas as any one every IDR frame.
  16. 16. code device as claimed in claim 15, it is characterised in that choose an every IDR frame conduct During current long term reference frame, second coding unit is used for:
    Using collect first every IDR frame as current long term reference frame;Or
    , will any one described mesh when determining that any one target the 2nd PSNR is not more than default threshold value Every IDR frame corresponding to the 2nd PSNR is marked as current long term reference frame.
  17. 17. code device as claimed in claim 15, it is characterised in that will remove respectively described current long Short term reference bit stream data corresponding to other each every IDR frames outside phase reference frame replaces with corresponding mesh When marking P frame bit stream datas, the replacement unit is used for:
    From other all every IDR frames in addition to the current long term reference frame, all mesh are filtered out Mark the every IDR frame that the 2nd PSNR is more than default threshold value;
    Short term reference bit stream data corresponding to each every IDR frame filtered out is replaced with into corresponding mesh respectively Mark P frame bit stream datas.
  18. 18. code device as claimed in claim 17, it is characterised in that by any one filtered out When short term reference bit stream data corresponding to every IDR frame replaces with corresponding target P frame bit stream datas, the replacement Unit is used for:
    By syntactic element corresponding to the target P frame bit stream datas of any one every IDR frame filtered out, according to pre- If long term reference coded system changed, and will short term reference code corresponding to any one described every IDR frame Flow data, replace with the target P frame bit stream datas after conversion;Or
    Directly by short term reference bit stream data corresponding to any one every IDR frame filtered out, replace with corresponding Target P frame bit stream datas.
CN201610275515.1A 2016-04-28 A kind of coding method of long term reference code stream and code device Active CN107343205B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610275515.1A CN107343205B (en) 2016-04-28 A kind of coding method of long term reference code stream and code device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610275515.1A CN107343205B (en) 2016-04-28 A kind of coding method of long term reference code stream and code device

Publications (2)

Publication Number Publication Date
CN107343205A true CN107343205A (en) 2017-11-10
CN107343205B CN107343205B (en) 2019-07-16

Family

ID=

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110708569A (en) * 2019-09-12 2020-01-17 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN116684610A (en) * 2023-05-17 2023-09-01 北京百度网讯科技有限公司 Method and device for determining reference state of long-term reference frame and electronic equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070199011A1 (en) * 2006-02-17 2007-08-23 Sony Corporation System and method for high quality AVC encoding
US20090251528A1 (en) * 2008-04-02 2009-10-08 Friel Joseph T Video Switching Without Instantaneous Decoder Refresh-Frames
US20090323801A1 (en) * 2008-06-25 2009-12-31 Fujitsu Limited Image coding method in thin client system and computer readable medium
US20110249729A1 (en) * 2010-04-07 2011-10-13 Apple Inc. Error resilient hierarchical long term reference frames
CN102378008A (en) * 2011-11-02 2012-03-14 深圳市融创天下科技股份有限公司 Video encoding method, video encoding device and video encoding system for shortening waiting time for playing
US20130114715A1 (en) * 2011-11-08 2013-05-09 Texas Instruments Incorporated Delayed Duplicate I-Picture for Video Coding
CN103167283A (en) * 2011-12-19 2013-06-19 华为技术有限公司 Video coding method and device
CN104519364A (en) * 2014-12-10 2015-04-15 北京中星微电子有限公司 Video encoding method and device
WO2016002140A1 (en) * 2014-07-03 2016-01-07 パナソニック インテレクチュアル プロパティ コーポレーション オブ アメリカ Image encoding method, image decoding method, image encoding device, and image decoding device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070199011A1 (en) * 2006-02-17 2007-08-23 Sony Corporation System and method for high quality AVC encoding
US20090251528A1 (en) * 2008-04-02 2009-10-08 Friel Joseph T Video Switching Without Instantaneous Decoder Refresh-Frames
US20090323801A1 (en) * 2008-06-25 2009-12-31 Fujitsu Limited Image coding method in thin client system and computer readable medium
US20110249729A1 (en) * 2010-04-07 2011-10-13 Apple Inc. Error resilient hierarchical long term reference frames
CN102378008A (en) * 2011-11-02 2012-03-14 深圳市融创天下科技股份有限公司 Video encoding method, video encoding device and video encoding system for shortening waiting time for playing
US20130114715A1 (en) * 2011-11-08 2013-05-09 Texas Instruments Incorporated Delayed Duplicate I-Picture for Video Coding
CN103167283A (en) * 2011-12-19 2013-06-19 华为技术有限公司 Video coding method and device
WO2016002140A1 (en) * 2014-07-03 2016-01-07 パナソニック インテレクチュアル プロパティ コーポレーション オブ アメリカ Image encoding method, image decoding method, image encoding device, and image decoding device
CN104519364A (en) * 2014-12-10 2015-04-15 北京中星微电子有限公司 Video encoding method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110708569A (en) * 2019-09-12 2020-01-17 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN110708569B (en) * 2019-09-12 2021-08-13 北京达佳互联信息技术有限公司 Video processing method and device, electronic equipment and storage medium
CN116684610A (en) * 2023-05-17 2023-09-01 北京百度网讯科技有限公司 Method and device for determining reference state of long-term reference frame and electronic equipment

Similar Documents

Publication Publication Date Title
CN104883574B (en) The method and apparatus coded and decoded to video
CN104967846B (en) To the decoded equipment of video
CN106454362A (en) Image coding apparatus, and image coding method, and image decoding apparatus, and image decoding method
CN107333133A (en) A kind of method and device of the code stream coding of code stream receiving device
CN1843039B (en) System and method for encoding and decoding enhancement layer data using descriptive model parameters
CN108028945A (en) The apparatus and method of conversion are performed by using singleton coefficient update
CN103379333B (en) The decoding method and its corresponding device of decoding method, video sequence code stream
CN105992004B (en) Image encoder bit rate control method based on video encoding standard
CN104065966B (en) The method and apparatus that thumbnail is extracted in H.264 video file
CN103096048B (en) A kind of scalable video quantization parameter defining method and device
CN104967855B (en) A kind of coding method suitable for monitor video
CN103096076B (en) Method for video coding
CN108810531B (en) Video coding processing method, device and electronic equipment
CN106572352A (en) Keyframe size control method and device
CN104980764B (en) Parallel decoding method, apparatus and system based on complex degree equalization
CN104023245B (en) A kind of net cast stream based on B/S frameworks compiles acceptance system and implementation method soon
JP5458451B2 (en) Rate matching method, rate matching device, rate dematching method, and rate dematching device
CN104093024B (en) Decoding method and device
CN110536087A (en) Electronic equipment and its motion profile picture synthesis method, device and embedded equipment
CN107343205A (en) A kind of coding method of long term reference code stream and code device
CN108009111A (en) Data flow connection method and device
CN103973310A (en) Test data compression method based on xor logical operation binary classification
CN104093025B (en) Decoding method and device
CN111107359A (en) Intra-frame prediction coding unit dividing method suitable for HEVC standard
CN110049339A (en) Prediction direction choosing method, device and storage medium in image coding

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