Summary of the invention
The object of the present invention is to provide a kind of digital TV decoding method and system, strengthen the Synchronization Control stability of Digital Television.
Digital TV decoding method of the present invention comprises the steps:
A, from transport stream TS extracting time information, frame head information and data message;
B, according to described time information generating local program clock reference PCR;
C, by to the comparison of described data message and described frame head information, to local program clock reference PCR or separate audio speed adjustment, the reading of control audio and video data.
In this technical scheme:
Among the described step C, produce calibrating signal when data message is consistent with the comparative result of frame head information, according to the triggering of calibrating signal to local program clock reference PCR or separate audio speed adjustment.
Described step B comprises the steps:
Timer reference of programs PCR initialization to demultiplexing;
It is loaded into the timer reference of programs PCR that sets up this locality in the local counter.
In the described steps A, comprise timer reference of programs PCR, audio decoder time tag DTS and video playback time tag PTS by the temporal information of extracting in the transport stream TS, described frame head information comprises audio frame head pointer and video frame header pointer, and described data message comprises basic stream ES.
Described step C comprises the steps:
C1, according to the comparative result of ES flow index and audio frame head pointer, to local program clock reference PCR or separate audio speed adjustment;
C2, according to the comparative result of ES flow index and video frame header pointer, set up the corresponding relation of decode video data and reproduction time label PTS;
C3, in field blanking finish time, according to the difference of video playback time tag PTS and local program clock reference PCR, local program clock reference PCR adjusted or controls read the address signal operation.
Described step C1 comprises the steps:
C1A, when the read pointer that reads ES stream when audio decoder equals the audio frame head pointer, produce first calibrating signal;
C1B, according to the triggering of described first calibrating signal, with the absolute value D0 of the difference of audio decoder time tag DTS and local program clock reference PCR and the first fixed threshold T1 relatively, carry out following operation:
C1B1, if absolute value D0 greater than this threshold value T1, is loaded into the Decoding Time Stamp DTS of audio frequency among the local program clock reference PCR;
C1B2 otherwise, do not carry out any operation.
Described step C1 comprises the steps:
C1a, when the read pointer that reads ES stream when audio decoder equals the audio frame head pointer, produce first calibrating signal;
C1b, according to the triggering of described first calibrating signal, with the absolute value D0 of the difference of audio decoder time tag DTS and local program clock reference PCR and the first fixed threshold T1 relatively, carry out following operation:
C1b1, if absolute value D0 greater than this threshold value T1, according to the quickening of the magnitude relationship of audio decoder time tag DTS and local program clock reference PCR or slow down and separate audio speed;
C1b2 otherwise, do not carry out any operation.
Described step C2 comprises the steps:
C21, when the read pointer that reads ES stream when Video Decoder equals the video frame header pointer, produce second calibrating signal;
C22, according to the triggering of described second calibrating signal, carry out following operation:
C221, if decode video data has video playback time tag PTS, then produce " having " sign, and write down this video playback time tag PTS;
C222 otherwise, produce " nothings " and indicate.
Described step C3 comprises the steps:
C3A, in field blanking finish time, with the absolute value P0 of the difference of video playback time tag PTS and local program clock reference PCR and the second fixed threshold T2 relatively, carry out following operation:
C3A1, if absolute value P0 greater than this threshold value T2, address signal operation is read in control, repeats to show or skip a two field picture.
C3A2 otherwise, the order display image.
Described step C3 comprises the steps:
C3a, in field blanking finish time, with the absolute value P0 of the difference of video playback time tag PTS and local program clock reference PCR and the second fixed threshold T2 relatively, carry out following operation:
C3a1, if absolute value P0 greater than this threshold value T2, video playback time tag PTS is loaded among the local program clock reference PCR;
C3a2 otherwise, do not carry out any operation.
The digital TV decoding system that the present invention adopts comprises demultiplexing module, audio decoder, Video Decoder and data storage, and described data storage is used for buffer memory sound, video data information, also comprises synchronization control module, wherein,
Described demultiplexing module analyzing atransmission stream TS, extracting time information, frame head information and data message, described data message sends to described data storage;
Described audio decoder receives described frame head information, and the audio frame head pointer in comparing data information and the frame head information sends to described synchronization control module with comparative result;
Described Video Decoder receives described frame head information, and the video frame header pointer in comparing data information and the frame head information sends to described synchronization control module with comparative result;
Described synchronization control module receives described temporal information, produces local program clock reference PCR, receives described comparative result, and to local program clock reference PCR or separate audio speed adjustment, control audio and video data read.
In this technical scheme, wherein,
The described temporal information that described demultiplexing module is extracted comprises timer reference of programs PCR, audio decoder time tag DTS and video playback time tag PTS, and is sent to synchronization control module; The described frame head information of extracting comprises audio frame head pointer and video frame header pointer, is sent to audio decoder and Video Decoder respectively; The described data message that extracts is basic stream ES, is sent to data storage and preserves.
Read pointer and audio frame head pointer that described audio decoder reads the ES flow index produce first calibrating signal and send it to synchronization control module, synchronization control module according to the triggering of described first calibrating signal to local program clock reference PCR or separate audio speed adjustment.
Read pointer and video frame header pointer that described Video Decoder reads the ES flow index produce second calibrating signal and send it to synchronization control module, synchronization control module is set up the corresponding relation of decode video data and reproduction time label PTS according to the triggering of described second calibrating signal, according to reproduction time label PTS and local program clock reference PCR difference, local program clock reference PCR is adjusted or controls the address signal of reading of display module and operate.
Beneficial effect of the present invention is: in the present invention, extraction time from transport stream TS, frame head information and data message, according to the corresponding local program clock reference of time information generating PCR, comparison by data message and frame head information, to local program clock reference PCR or separate audio speed adjustment, control audio and video data read, specifically, the present invention is a bridge with local program clock reference PCR, can adopt three kinds of benchmark control models: be holotype with the audio frequency, be holotype with the video and be holotype with the timer reference of programs, the invention provides multiple Synchronization Control pattern, it is single to have overcome in the prior art control model, uses the shortcoming of underaction, has strengthened the Synchronization Control performance, and, PCR is a bridge with the local program clock reference, and the system that makes controls flexibly, has improved the application extension performance, for example, can realize more easily adding that captions are synchronous etc.
The present invention adopts audio/video frame head address pointer to set up the contact of reproduction time label PTS or Decoding Time Stamp DTS and frame data (ES stream), can guarantee that reproduction time label PTS or Decoding Time Stamp DTS and frame data (ES stream) are synchronous, strengthen the stability of synchronization of system.The present invention sets up corresponding relation by adopting reproduction time label PTS and frame head address pointer, for example have video playback time tag PTS for decode video data, produce " having " sign, and write down this video playback time tag PTS, otherwise, produce " nothing " sign, increased the getting in touch of address pointer of reproduction time label PTS and bag data, can solve at reproduction time label PTS or Decoding Time Stamp DTS and produce stationary problem when losing, for example, after error in data or other reasons caused reproduction time label PTS and data corresponding relation mistake, the present invention can recover synchronous regime automatically, has further improved practicality of the present invention and reliability.
Embodiment
With embodiment the present invention is described in further detail with reference to the accompanying drawings below:
According to Fig. 2, digital TV decoding system among the present invention comprises demultiplexing module 10, audio decoder 20, Video Decoder 30, data storage 40, display module 50 and synchronization control module 60, and what the digital TV decoding system was commonly used in actual applications is set-top box.
As shown in Figure 2, described demultiplexing module 10 analyzing atransmission stream TS, extracting time information, frame head information and data message, the information of being extracted is as follows:
Temporal information: timer reference of programs PCR, audio decoder time tag DTS and video playback time tag PTS.
Frame head information: audio frame head pointer and video frame header pointer.
Data message: flow ES substantially.
As shown in Figure 2, wherein temporal information is sent to synchronization control module 60; Audio frame head pointer in the frame head information and video frame header pointer are sent to audio decoder 20 and Video Decoder 30 respectively; Data message is sent to data storage 40 and preserves.
As shown in Figure 2, audio decoder 20 is resolved audio stream by data storage 40 reading of data, produces voice data; Video Decoder 30 is resolved video flowing by data storage 40 reading of data, produces video data and transmission.Display module 50 is used for the video data that the display video decoder sends, and data storage 40 is used for sound, video data buffer memory, and the described data message of buffer memory flows ES substantially.
As shown in Figure 2, synchronization control module 60 is according to the corresponding local program clock reference of time information generating PCR, the decoding of information interaction control audio between this synchronization control module 60 and the audio decoder 20, and with Video Decoder 30, information interaction between the display module 50, the demonstration of control of video, produce calibrating signal when wherein data message is consistent with the comparative result of frame head information, synchronization control module 60 according to the triggering of calibrating signal to local program clock reference PCR or separate audio speed adjustment, particularly, audio decoder 20 produces first calibrating signal and sends it to synchronization control module 60 according to ES flow index and audio frame head pointer, synchronization control module 60 according to the triggering of first calibrating signal to local program clock reference PCR or separate audio speed adjustment.Video Decoder 30 produces second calibrating signal and sends it to synchronization control module 60 according to ES flow index and video frame header pointer, synchronization control module 60 is set up the corresponding relation of decode video data and reproduction time label PTS according to the triggering of second calibrating signal, according to reproduction time label PTS and local program clock reference PCR difference, local program clock reference PCR is adjusted or controls the address signal of reading of display module 50 and operate.
As Fig. 2 and as shown in Figure 3, basic controlling flow process of the present invention is as follows:
A) demultiplexing module 10 extraction time, frame head information and data message from transport stream TS.
B) synchronization control module 60 is according to the corresponding local program clock reference of time information generating PCR.
C) comparison by data message and frame head information, synchronization control module 60 pairs of local program clock references PCR or separate audio speed adjustment.
D) by the comparison of data message and frame head information, synchronization control module 60 is set up the corresponding relation of decode video data and reproduction time label PTS.
E) in field blanking finish time, synchronization control module 60 is according to video playback time tag PTS and local program clock reference PCR difference, reads the address signal operation to what local program clock reference PCR adjusted or controlled display module 50.
Comparison by data message and frame head information can realize like this: synchronization control module 60 repeating query comparing data information and frame head information, when the read pointer that relatively reads ES stream when synchronization control module 60 equals audio/video frame head pointer and equates, simultaneously described follow-up signal is adjusted.And preferred implementation is: produce calibrating signal when the read pointer that reads ES stream equals audio/video frame head pointer, send to synchronization control module 60, according to the triggering of calibrating signal described follow-up signal is adjusted.
The present invention adopts audio/video frame head address pointer to set up the contact of reproduction time label PTS or Decoding Time Stamp DTS and frame data (ES stream), can guarantee that reproduction time label PTS or Decoding Time Stamp DTS and frame data (ES stream) are synchronous, strengthen the stability of synchronization of system.
As Fig. 2 and shown in Figure 4, first kind of (is holotype with the audio frequency) concrete control flow of digital TV decoding method of the present invention is as follows:
1. demultiplexing module 10 extraction time, frame head information and data message from transport stream TS, particularly, temporal information comprises timer reference of programs PCR, audio decoder time tag DTS and video playback time tag PTS; Frame head information comprises audio frame head pointer and video frame header pointer; Data message is basic stream ES (being ES stream).Demultiplexing module 10 is sent to synchronization control module 60, audio decoder 20 and Video Decoder 30, data storage 40 respectively with temporal information, frame head information, data message.
2. the timer reference of programs PCR initialization of 60 pairs of demultiplexings of synchronization control module.
3. synchronization control module 60 is loaded into it and sets up local program clock reference PCR in local 27M counter.
4. the stream of the ES in the audio decoder 20 reading of data memories 40 when the read pointer that reads ES stream equals the audio frame head pointer, produces first calibrating signal and sends it to synchronization control module 60.
5. synchronization control module 60 receives first calibrating signal, and first calibrating signal triggers the absolute value D0 and the first fixed threshold T1 of the difference of comparing audio Decoding Time Stamp DTS and local program clock reference PCR as trigger impulse, carries out following operation:
51. if absolute value D0 is greater than this threshold value T1, the Decoding Time Stamp DTS of audio frequency is loaded among the local program clock reference PCR, continues following steps 6.
52. otherwise, do not carry out any operation, continue following steps 6.
6. Video Decoder 30 reads ES stream, when read pointer equals the video frame header pointer, produces second calibrating signal and sends it to synchronization control module 60.
7. synchronization control module 60 receives second calibrating signal, and second calibrating signal triggers and carries out following operation as trigger impulse:
71. if decode video data has video playback time tag PTS, then produce " having " sign, and write down this video playback time tag PTS, continue following steps 8.
72. otherwise, produce " nothing " sign, continue following steps 8.
8. display module 50 sends end signal to synchronization control module 60 in field blanking the finish time, synchronization control module 60 compares the absolute value P0 and the second fixed threshold T2 of the difference of video playback time tag PTS and local program clock reference PCR, carries out following operation:
81. read the address signal operation if absolute value P0, controls display module 50 greater than this threshold value T2, make display module 50 repeat to show or skip a two field picture.
82. otherwise, do not carry out special operational, make display module 50 order display images.
Present embodiment is set up corresponding relation by adopting reproduction time label PTS and frame head address pointer, for example have video playback time tag PTS for decode video data, produce " having " sign, and write down this video playback time tag PTS, otherwise, produce " nothing " sign, increased the getting in touch of address pointer of reproduction time label PTS and bag data, can solve at reproduction time label PTS or Decoding Time Stamp DTS and produce stationary problem when losing, for example, after error in data or other reasons cause reproduction time label PTS and data corresponding relation mistake, present embodiment can recover synchronous regime automatically, has further improved practicality of the present invention and reliability.
As Fig. 2 and shown in Figure 5, second kind of (is holotype with the video) concrete control flow of digital TV decoding method of the present invention is as follows:
1) demultiplexing module 10 extraction time, frame head information and data message from transport stream TS, particularly, temporal information comprises timer reference of programs PCR, audio decoder time tag DTS and video playback time tag PTS; Frame head information comprises audio frame head pointer and video frame header pointer; Data message is basic stream ES (being ES stream).Demultiplexing module 10 is sent to synchronization control module 60, audio decoder 20, Video Decoder 30, data storage 40 respectively with temporal information, frame head information, data message.
2) the timer reference of programs PCR initialization of 60 pairs of demultiplexings of synchronization control module.
3) synchronization control module 60 is loaded into it and sets up local program clock reference PCR in local 27M counter.
4) stream of the ES in the audio decoder 20 reading of data memories 40 when the read pointer that reads ES stream equals the audio frame head pointer, produces first calibrating signal and sends it to synchronization control module 60.
5) synchronization control module 60 receives this first calibrating signal, and first calibrating signal triggers the absolute value D0 and the first fixed threshold T1 of the difference of comparing audio Decoding Time Stamp DTS and local program clock reference PCR as trigger impulse, carries out following operation:
51) if absolute value D0 greater than this threshold value T1, accelerates or slows down and separate audio speed according to the magnitude relationship of audio decoder time tag DTS and local program clock reference PCR, promptly work as DTS>PCR, slow down and separate audio speed, as DTS<PCR, accelerate to separate audio speed, continue following steps 6).
52) otherwise, do not carry out any operation, continue following steps 6).
6) Video Decoder 30 reads ES stream, when read pointer equals the video frame header pointer, produces second calibrating signal and sends it to synchronization control module 60.
7) synchronization control module 60 receives second calibrating signal, and second calibrating signal triggers and carries out following operation as trigger impulse:
71) if decode video data has video playback time tag PTS, then produce " having " sign, and write down this video playback time tag PTS, continue following steps 8).
72) otherwise, produce " nothings " sign, continuation following steps 8).
8) display module 50 sends end signal to synchronization control module 60 in field blanking the finish time, synchronization control module 60 compares the absolute value P0 and the second fixed threshold T2 of the difference of video playback time tag PTS and local program clock reference PCR, carries out following operation:
81) if absolute value P0 greater than this threshold value T2, is loaded into video playback time tag PTS among the local program clock reference PCR.
82) otherwise, do not carry out any operation.
As Fig. 2 and shown in Figure 6, the concrete control flow of digital TV decoding method of the present invention the third (is holotype with the timer reference of programs) is as follows:
I. demultiplexing module 10 extraction time, frame head information and data message from transport stream TS, particularly, temporal information comprises timer reference of programs PCR, audio decoder time tag DTS and video playback time tag PTS; Frame head information comprises audio frame head pointer and video frame header pointer; Data message is basic stream ES (being ES stream).Demultiplexing module 10 is sent to synchronization control module 60, audio decoder 20, Video Decoder 30, data storage 40 respectively with temporal information, frame head information, data message.
II. the timer reference of programs PCR initialization of 60 pairs of demultiplexings of synchronization control module.
III. synchronization control module 60 is loaded into it and sets up local program clock reference PCR in local 27M counter.
IV. the stream of the ES in the audio decoder 20 reading of data memories 40 when the read pointer that reads ES stream equals the audio frame head pointer, produces first calibrating signal and sends it to synchronization control module 60.
V. synchronization control module 60 receives this first calibrating signal, and first calibrating signal triggers the absolute value D0 and the first fixed threshold T1 of the difference of comparing audio Decoding Time Stamp DTS and local program clock reference PCR as trigger impulse, carries out following operation:
V1. if absolute value D0 greater than this threshold value T1, accelerates or slows down and separate audio speed, continuation following steps VI according to the magnitude relationship of audio decoder time tag DTS and local program clock reference PCR.
V2. otherwise, do not carry out any operation, continue following steps VI.
VI. Video Decoder 30 reads ES stream, when read pointer equals the video frame header pointer, produces second calibrating signal and sends it to synchronization control module 60.
VII. synchronization control module 60 receives second calibrating signal, and second calibrating signal triggers and carries out following operation as trigger impulse:
VII1. if decode video data has video playback time tag PTS, then produce " having " sign, and write down this video playback time tag PTS, continue following steps VIII.
VII2. otherwise, produce " nothings " sign, continuation following steps VIII.
VIII. display module 50 sends end signal to synchronization control module 60 in field blanking the finish time, synchronization control module 60 compares the absolute value P0 and the second fixed threshold T2 of the difference of video playback time tag PTS and local program clock reference PCR, carries out following operation:
VIII1. read the address signal operation if absolute value P0, controls display module 50 greater than this threshold value T2, make display module 50 repeat to show or skip a two field picture.
VIII2. otherwise, do not carry out special operational, make display module 50 order display images.
By above-mentioned control flow, the present invention is extraction time, frame head information and data message from transport stream TS, according to the corresponding local program clock reference of time information generating wherein PCR, comparison by data message and frame head information, to local program clock reference PCR or separate audio speed adjustment, control audio and video data read.Specifically, the present invention is a bridge with local program clock reference PCR, can adopt three kinds of benchmark control models: be holotype with the audio frequency, be holotype with the video and be holotype with the timer reference of programs, the invention provides multiple Synchronization Control pattern, it is single to have overcome in the prior art control model, use the shortcoming of underaction, and, with local program clock reference PCR is bridge, the system that makes controls flexibly, improved the application extension performance, for example, can realize more easily adding that captions are synchronous etc.