CN104159142A - Video soft decoding method and device of equipment - Google Patents

Video soft decoding method and device of equipment Download PDF

Info

Publication number
CN104159142A
CN104159142A CN201410384909.1A CN201410384909A CN104159142A CN 104159142 A CN104159142 A CN 104159142A CN 201410384909 A CN201410384909 A CN 201410384909A CN 104159142 A CN104159142 A CN 104159142A
Authority
CN
China
Prior art keywords
video data
data buffer
queue
signal amount
buffer queue
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.)
Pending
Application number
CN201410384909.1A
Other languages
Chinese (zh)
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.)
LeTV Information Technology Beijing Co Ltd
Original Assignee
LeTV Information Technology Beijing 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 LeTV Information Technology Beijing Co Ltd filed Critical LeTV Information Technology Beijing Co Ltd
Priority to CN201410384909.1A priority Critical patent/CN104159142A/en
Publication of CN104159142A publication Critical patent/CN104159142A/en
Pending legal-status Critical Current

Links

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The invention provides a video soft decoding method and device of equipment. The method comprises the following steps: correspondingly separating, decoding and playing received audios and videos by a data transmission and audio-video data separation thread, a video data decoding thread and a decoded video data displaying and synchronous control thread; in the separating, decoding and playing processes, determining whether the data transmission and audio-video data separation thread is blocked or not according to first signal quantity of a non-decoded video data cache queue; determining whether the video data decoding thread is blocked or not according to second signal quantity of the non-decoded video data cache queue and/or first signal quantity of a decoded video data cache queue; determining whether the decoded video data displaying and synchronous control thread is blocked or not according to second signal quantity of the decoded video data cache queue. According to the video soft decoding method, the occupancy rate of a central processor and the power consumption of the equipment are reduced and the service life of the equipment is prolonged.

Description

A kind of video soft decoding method and device of equipment
Technical field
The present invention relates to technical field of video processing, particularly relate to a kind of video soft decoding method and device of equipment.
Background technology
Video decode is that the video data after coding is decoded, so that the process that video data can show generally includes two kinds of modes of hard decoder and soft decoding.
Hard decoder, not by means of CPU, carrys out complete independently video decode task by special subcard equipment, as, VCD/DVD decompress(ion) card, video compression card etc. all belong to the category of hard decoder.Soft decoding by software by CPU to the video processing of decoding.Along with the development of video technique, the resolution of video data is more and more higher, and the compression ratio of video data encoding is also more and more higher, so the operand of decoding is increasing, thereby the hardware requirement required to hard decoder is also more and more higher, cause the cost of hard decoder considerably beyond the cost of soft decoding.At present, soft decoding has become the main flow of video decode.
In the equipment of present stage, the soft decode procedure of video generally adopts multi-threaded architecture to realize, and each thread needs real-time synchronization state separately, so that each thread can smooth and easyly move.In the time of thread state synchronized, common way be adopt dormancy, wake up, judgement state, continue dormancy or continue operation circulation pattern, if each thread is real-time synchronization state separately in above-mentioned circulation pattern, need to rely on central processing unit to carry out task scheduling to each thread.Central processing unit carries out task scheduling to each thread continually, causes the occupancy of central processing unit to raise, and the power consumption of equipment increases, and causes equipment short problem in cruising time.
Summary of the invention
The invention provides a kind of video soft decoding method and device of equipment, high to solve the occupancy of central processing unit of equipment, power consumption increases, the problem that cruising time is short.
In order to address the above problem, the invention discloses a kind of video soft decoding method of equipment, described equipment comprises not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored;
Described method comprises:
Usage data transmission and audio, video data separate thread, and the decoded video data demonstration and Synchronization Control thread of video data decoding thread separates accordingly, decodes and play the audio, video data receiving respectively;
In described separation, decoding and playing process, determine according to the first signal amount of described not decode video data buffer queue whether blocking data transmits and audio, video data separation thread;
According to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread;
According to the secondary signal amount of described decoded video data buffer storage queue, determine whether to block decoded video data and show and Synchronization Control thread.
The invention also discloses a kind of soft decoding device of video of equipment, described equipment comprises not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored;
Described device comprises:
Feature operation module, separates for usage data transmission and audio, video data that thread, video data decoding thread and decoded video data show and Synchronization Control thread separates accordingly, decodes and play the audio, video data receiving respectively;
The first decision module, for carrying out described separation, decoding and playing process in described feature operation module, determines according to the first signal amount of described not decode video data buffer queue whether blocking data transmits and audio, video data separation thread;
The second decision module, for according to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread;
The 3rd decision module, for according to the secondary signal amount of described decoded video data buffer storage queue, determines whether to block decoded video data and shows and Synchronization Control thread.
Compared with background technology, the present invention includes following advantage:
Equipment in the present invention comprises not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.The audio, video data receiving is separated accordingly, in decoding and playing process, can determine that whether blocking data transmission and audio, video data separate thread according to the first signal amount of described not decode video data buffer queue; According to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread; According to the secondary signal amount of described decoded video data buffer storage queue, determine whether to block decoded video data and show and Synchronization Control thread.
Carry out state synchronized between above-mentioned multiple threads time, the mode of do not re-use circulation dormancy, waking up is waited for the state needing, and adopts the design of semaphore.Semaphore can allow thread always in resting state, and in the time of resting state, thread does not participate in the task scheduling of central processing unit, does not also take central processing unit; When the state of thread waits is true time, semaphore can initiatively wake this thread up, again participate in the task scheduling of central processing unit, thereby this thread can continue to be performed, so just reduce the performance that central processing unit loses because of task scheduling unnecessary, occupancy and the equipment power dissipation of central processing unit are reduced, the cruising time of having improved equipment.
Brief description of the drawings
Fig. 1 is the video soft decoding method flow chart of a kind of equipment in the embodiment of the present invention one;
Fig. 2 is the video soft decoding method flow chart of a kind of equipment in the embodiment of the present invention two;
Fig. 3 is the video soft decoding method flow chart of a kind of equipment in the embodiment of the present invention three;
Fig. 4 is the soft decoding device structure chart of the video of a kind of equipment in the embodiment of the present invention four;
Fig. 5 is the soft decoding device structure chart of the video of a kind of equipment in the embodiment of the present invention five.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, below in conjunction with the drawings and specific embodiments, the present invention is further detailed explanation.
Below by video soft decoding method and the device of enumerating several specific embodiments and introduce in detail a kind of equipment provided by the invention.
Equipment in the embodiment of the present invention can be a kind of desktop computer, also can be a kind of mobile terminal, this equipment can have the soft decoding function of video, for example, a kind of desktop computer, a kind of smart mobile phone or a kind of video player etc. do not limit type and the model etc. of equipment herein.
Embodiment mono-
Introduce in detail the video soft decoding method of a kind of equipment that the embodiment of the present invention provides.
With reference to Fig. 1, show the video soft decoding method flow chart of a kind of equipment in the embodiment of the present invention.
Equipment in the embodiment of the present invention can comprise not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.
Step 100, usage data transmission and audio, video data separate thread, and the decoded video data demonstration and Synchronization Control thread of video data decoding thread separates accordingly, decodes and play the audio, video data receiving respectively.
The audio, video data that uses transfer of data and audio, video data to separate thread docking receipts separates accordingly; Use video data decoding thread to decode accordingly to the video data after separating; Use the demonstration of decoded video data and Synchronization Control thread to play accordingly decoded video data.
In the implementation of above-mentioned steps 100, can carry out the following step.
Step 102, determines according to the first signal amount of described not decode video data buffer queue whether blocking data transmits and audio, video data separation thread.
Described in being used to indicate, the first signal amount of described not decode video data buffer queue in decode video data buffer queue, whether not there is not free space.In the implementation of above-mentioned steps 100, can be according to the concrete condition of the first signal amount of described not decode video data buffer queue, determine whether blocking data transmits and audio, video data separation thread.
Step 104, according to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread.
Described in being used to indicate, the secondary signal amount of described not decode video data buffer queue in decode video data buffer queue, whether not there is not the resource of having stored.The first signal amount of described decoded video data buffer storage queue is used to indicate in the queue of described decoded video data buffer storage whether have free space.
Described step 104 can be:
According to the secondary signal amount of described not decode video data buffer queue, and whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread.
In the implementation of above-mentioned steps 100, can be according to the concrete condition of the secondary signal amount of described not decode video data buffer queue, with, the concrete condition of the first signal amount of described decoded video data buffer storage queue, whether determine blocked video data decode thread.
Described step 104 can also be:
According to the secondary signal amount of described not decode video data buffer queue, or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread.
In the implementation of above-mentioned steps 100, can be according to the concrete condition of the secondary signal amount of described not decode video data buffer queue, or whether the concrete condition of the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread.
Step 106, according to the secondary signal amount of described decoded video data buffer storage queue, determines whether to block decoded video data and shows and Synchronization Control thread.
The secondary signal amount of described decoded video data buffer storage queue is used to indicate in the queue of described decoded video data buffer storage whether have the resource of having stored.In the implementation of above-mentioned steps 100, according to the concrete condition of the secondary signal amount of described decoded video data buffer storage queue, determine whether to block decoded video data and show and Synchronization Control thread.
In sum, equipment in the present invention comprises not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.The audio, video data receiving is separated accordingly, in decoding and playing process, can determine that whether blocking data transmission and audio, video data separate thread according to the first signal amount of described not decode video data buffer queue; According to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread; According to the secondary signal amount of described decoded video data buffer storage queue, determine whether to block decoded video data and show and Synchronization Control thread.
Carry out state synchronized between above-mentioned multiple threads time, the mode of do not re-use circulation dormancy, waking up is waited for the state needing, and adopts the design of semaphore.Semaphore can allow thread always in resting state, and in the time of resting state, thread does not participate in the task scheduling of central processing unit, does not also take central processing unit; When the state of thread waits is true time, semaphore can initiatively wake this thread up, again participate in the task scheduling of central processing unit, thereby this thread can continue to be performed, so just reduce the performance that central processing unit loses because of task scheduling unnecessary, occupancy and the equipment power dissipation of central processing unit are reduced, the cruising time of having improved equipment.
Embodiment bis-
Introduce in detail the video soft decoding method of a kind of equipment that the embodiment of the present invention provides.
With reference to Fig. 2, show the video soft decoding method flow chart of a kind of equipment in the embodiment of the present invention.
In the present embodiment, for realizing the soft decoding of efficient video, whole process can be resolved into transfer of data and audio, video data separation, voice data decoding and broadcasting, video data decoding, the demonstration of decoded video data and four main tasks of Synchronization Control, each task is realized by independent thread, four thread concurrent runnings.Build not decoding audio data buffer queue, not decode video data buffer queue, three queues of decoded video data buffer storage queue simultaneously, be that equipment in the embodiment of the present invention can comprise not decode video data buffer queue, the queue of decoded video data buffer storage and decoding audio data buffer queue not, continue in four threads to realize audio, video data, smooth transmission.
For realizing the wait without circulation dormancy, wake-up mode between four threads, each queue is used respectively two resource signal amounts to control, not decode video data buffer queue, the queue of decoded video data buffer storage and do not include first signal amount and secondary signal amount separately in decoding audio data buffer queue described in, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.Described first signal amount can also be used to indicate the quantity of remaining free space in this queue; Described secondary signal amount can also be used to indicate the quantity of the data resource of having stored in this queue.When initialization, the quantity of the free space of each queue is exactly the maximum resource amount that this queue can be stored, and the quantity that has deposited resource in is all 0, and two semaphores in each queue carry out initialization by these two values respectively.
It should be noted that, it should be understood by those skilled in the art that in actual applications, the decoding of voice data can adopt existing any appropriate ways to realize, be not limited to the mode in the present embodiment, in the case, the corresponding buffer queue of audio decoder and semaphore can be set.In addition, use the quantitaes first signal amount of remaining free space, use the quantitaes secondary signal amount of the data resource of having stored, make the Design and implementation cost of semaphore lower.But it will be appreciated by those skilled in the art that in actual use, be not limited to usage quantity and represent semaphore, while being also not limited to initialization, the quantity of the free space of the each queue maximum resource amount that queue can be stored for this reason, the quantity that has deposited resource in is all 0.The effect that those skilled in the art can realize according to semaphore adopts other any appropriate ways to realize, and the present invention is not restricted this.
Step 200, usage data transmission and audio, video data separate thread, voice data decoding and broadcasting thread, and the decoded video data demonstration and Synchronization Control thread of video data decoding thread separates accordingly, decodes and play the audio, video data receiving respectively.
The audio, video data that uses transfer of data and audio, video data to separate thread docking receipts separates accordingly; Use voice data decoding and play thread and decode and play separating rear voice data; Use video data decoding thread to decode accordingly to the video data after separating, use the demonstration of decoded video data and Synchronization Control thread to play accordingly decoded video data.
In the implementation of above-mentioned steps 200, can carry out the following step.
Step 202, according to the first signal amount of described not decode video data buffer queue, determines whether blocking data transmits and audio, video data separation thread.
Described in being used to indicate, the first signal amount of described not decode video data buffer queue in decode video data buffer queue, whether not there is not free space.In the implementation of above-mentioned steps 200, can be according to the concrete condition of the first signal amount of described not decode video data buffer queue, determine whether blocking data transmits and audio, video data separation thread.
Preferably, described step 202 can be:
According to the first signal amount of described not decode video data buffer queue, whether decode video data buffer queue not there is free space described in judgement.
In the time that decode video data buffer queue does not exist free space described in the first signal amount instruction of described not decode video data buffer queue, block described transfer of data and audio, video data and separate thread.
In the time that described in the first signal amount instruction of described not decode video data buffer queue, there is not free space in decode video data buffer queue, usage data transmission and audio, video data separate thread and receive and isolate after video data, decode video data buffer queue not described in isolated video data is deposited in, and not first signal amount and the secondary signal amount of decode video data buffer queue described in upgrading.
For example, it is 4 o'clock in the first signal amount of described not decode video data buffer queue, now not described in the first signal amount of decode video data buffer queue instruction not decode video data buffer queue there are 4 free spaces, usage data transmission and audio, video data separation thread receive and separate after audio, video data, obtain 1 video data, decode video data buffer queue not described in isolated 1 video data is deposited in, and not first signal amount and the secondary signal amount of decode video data buffer queue described in upgrading, be specifically as follows the first signal amount of described not decode video data buffer queue is subtracted to 1, first signal amount is 3, the secondary signal amount of described not decode video data buffer queue is added to 1.
According to the first signal amount of the described not decode video data buffer queue after upgrading, described in continuing to judge, whether decoded video buffer queue not there is free space.
For example, when the first signal amount of the described not decode video data buffer queue after upgrading is 0, continue to judge known, now not described in the first signal amount of decode video data buffer queue instruction not decode video data buffer queue there is not free space, can block described transfer of data and audio, video data and separate thread.
Step 204, according to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread.
Described in being used to indicate, the secondary signal amount of described not decode video data buffer queue in decode video data buffer queue, whether not there is not the resource of having stored.The first signal amount of described decoded video data buffer storage queue is used to indicate in the queue of described decoded video data buffer storage whether have free space.
Preferably, described step 204 can be:
According to the secondary signal amount of described not decode video data buffer queue, whether decode video data buffer queue not there is the resource of having stored described in judgement; And/or, according to the first signal of described decoded video data buffer storage queue, judge whether the queue of described decoded video data buffer storage exists free space.
In the time that described in the secondary signal amount instruction of described not decode video data buffer queue, there is not the resource of having stored in decode video data buffer queue, and/or, in the time that the first signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage not have free space, block described video data decoding thread.
In the time that described in the secondary signal amount instruction of described not decode video data buffer queue, there is not the resource of having stored in decode video data buffer queue, and/or, in the time that the first signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage to have free space, use described video data decoding thread to carry out video decode to the video data resource of storing in described not decode video data buffer queue, and deposit decoded video data the queue of in described decoded video data buffer storage, and the secondary signal amount of decode video data buffer queue not described in upgrading, and, the first signal amount of described decoded video data buffer storage queue and secondary signal amount.
For example, when the secondary signal amount of described not decode video data buffer queue is 1, now not described in the secondary signal amount of decode video data buffer queue instruction not decode video data buffer queue there is 1 resource of having stored, when the first signal amount of described decoded video data buffer storage queue is 1, when the first signal amount of now decoded video data buffer storage queue indicates described decoded video data buffer storage queue to have 1 free space, use described video data decoding thread to carry out video decode to 1 video data resource of storing in described not decode video data buffer queue, and deposit decoded 1 video data the queue of in described decoded video data buffer storage, and the secondary signal amount of decode video data buffer queue not described in upgrading, secondary signal amount by described not decode video data buffer queue subtracts 1, secondary signal amount is 0, and, the first signal amount of described decoded video data buffer storage queue is subtracted to 1, the secondary signal amount of described decoded video data buffer storage queue is added to 1.
According to the secondary signal amount of the described not decode video data buffer queue after upgrading, described in continuing to judge, whether decode video data buffer queue not there is the resource of having stored; And/or, according to the first signal amount of the described decoded video data buffer storage queue after upgrading, continue to judge whether the queue of described decoded video data buffer storage exists free space.
For example, when the secondary signal amount of the described not decode video data buffer queue after upgrading is 0, continue to judge known, now in decode video data buffer queue, not there is not the resource of having stored described in the secondary signal amount of decode video data buffer queue instruction, and/or, in the time that the first signal amount of described decoded video data buffer storage queue is 0, continue to judge known, when the first signal amount of now decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage not have free space, can block described video data decoding thread.
Described step 204 can be:
According to the secondary signal amount of described not decode video data buffer queue, and whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread.
In the implementation of above-mentioned steps 200, can be according to the concrete condition of the secondary signal amount of described not decode video data buffer queue, with, the concrete condition of the first signal amount of described decoded video data buffer storage queue, whether determine blocked video data decode thread.
Described step 204 can also be:
According to the secondary signal amount of described not decode video data buffer queue, or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread.
In the implementation of above-mentioned steps 200, can be according to the concrete condition of the secondary signal amount of described not decode video data buffer queue, or whether the concrete condition of the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread.
Step 206, according to the secondary signal amount of described decoded video data buffer storage queue, determines whether to block decoded video data and shows and Synchronization Control thread.
The secondary signal amount of described decoded video data buffer storage queue is used to indicate in the queue of described decoded video data buffer storage whether have the resource of having stored.In the implementation of above-mentioned steps 200, according to the concrete condition of the secondary signal amount of described decoded video data buffer storage queue, determine whether to block decoded video data and show and Synchronization Control thread.
Preferably, described step 206 can be:
According to the secondary signal amount of described decoded video data buffer storage queue, judge whether the queue of described decoded video data buffer storage exists the resource of having stored.
In the time that the secondary signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage not have the resource of having stored, block described decoded video data and show and Synchronization Control thread.
In the time that the secondary signal amount of described decoded video data buffer storage queue indicates described decoded video data buffer storage queue to have the resource of having stored, use described decoded video data demonstration and Synchronization Control thread to show the decoded video data of storing in the queue of described decoded video data buffer storage, and control the described decoded video data of demonstration and the broadcasting of synchronizeing of decoded voice data, and upgrade the secondary signal amount of described decoded video data buffer storage queue.
According to the secondary signal amount of the described decoded video data buffer storage queue after upgrading, continue to judge whether the queue of described decoded video data buffer storage exists the resource of having stored.
For example, upgrade the secondary signal amount of described decoded video data buffer storage queue, the secondary signal amount of described decoded video data buffer storage queue is subtracted to 1, secondary signal amount is 0, continue to judge known, now, the secondary signal amount of described decoded video data buffer storage queue is indicated in the queue of described decoded video data buffer storage and is not had the resource of having stored, and can block decoded video data and show and Synchronization Control thread.
It should be noted that, between above-mentioned video data decoding thread and the demonstration of above-mentioned decoded video data and Synchronization Control thread, be provided with mutual exclusion lock, can be according to the current state of the mutual exclusion lock between described video data decoding thread and the demonstration of described decoded video data and Synchronization Control thread, described video data decoding thread is dispatched in mutual exclusion and described decoded video data show and Synchronization Control thread.Object is to avoid above-mentioned video data decoding thread and the demonstration of above-mentioned decoded video data and Synchronization Control thread to be dispatched by central processing unit simultaneously, thereby avoids reducing because of the cache hit rate of central processing unit the low problem of soft decoding performance causing.
If isolate voice data from the audio, video data receiving,, in the implementation of above-mentioned steps 200, can also comprise the following steps.
Step 208, according to the first signal amount of described not decoding audio data buffer queue, determines whether blocking data transmits and audio, video data separation thread.
Preferably, described step 208 can be:
According to the first signal amount of described not decoding audio data buffer queue, whether decoding audio data buffer queue not there is free space described in judgement.
In the time that decoding audio data buffer queue does not exist free space described in the first signal amount instruction of described not decoding audio data buffer queue, block described transfer of data and audio, video data and separate thread.
In the time that described in the first signal amount instruction of described not decoding audio data buffer queue, there is not free space in decoding audio data buffer queue, using described transfer of data and audio, video data to separate thread receives and separates after audio, video data, decoding audio data buffer queue not described in isolated voice data is deposited in, and not first signal amount and the secondary signal amount of decoding audio data buffer queue described in upgrading.
For example, it is 4 o'clock in the first signal amount of described not decoding audio data buffer queue, now not described in the first signal amount of decoding audio data buffer queue instruction not decoding audio data buffer queue there are 4 free spaces, usage data transmission and audio, video data separation thread receive and separate after audio, video data, obtain 1 voice data, decoding audio data buffer queue not described in isolated 1 voice data is deposited in, and not first signal amount and the secondary signal amount of decoding audio data buffer queue described in upgrading, be specifically as follows the first signal amount of described not decoding audio data buffer queue is subtracted to 1, first signal amount is 3, the secondary signal amount of described not decoding audio data buffer queue is added to 1.
According to the first signal amount of the described not decoding audio data buffer queue after upgrading, described in continuing to judge, whether decoding audio data buffer queue not there is free space.
For example, when the first signal amount of the described not decoding audio data buffer queue after upgrading is 0, continue to judge known, now not described in the first signal amount of decoding audio data buffer queue instruction not decoding audio data buffer queue there is not free space, can block described transfer of data and audio, video data and separate thread.
Step 210, according to the secondary signal amount of described not decoding audio data buffer queue, determines whether oscillator audio data is decoded and plays thread.
Preferably, described step 210 can be:
According to the secondary signal amount of described not decoding audio data buffer queue, whether decoding audio data buffer queue not there is the resource of having stored described in judgement.
In the time that decoding audio data buffer queue does not exist the resource of having stored described in the secondary signal amount instruction of described not decoding audio data buffer queue, block described voice data decoding and play thread.
In the time that described in the secondary signal amount instruction of described not decoding audio data buffer queue, there is not the resource of having stored in decoding audio data buffer queue, use the decoding of described voice data and play thread the voice data resource of storing in described not decoding audio data buffer queue is carried out to audio decoder and broadcasting, and the secondary signal amount of decoding audio data buffer queue not described in upgrading.
According to the secondary signal amount of described not decoding audio data buffer queue after upgrading, whether decoding audio data buffer queue not there is the resource of having stored described in judgement.
For example, the secondary signal amount of decoding audio data buffer queue not described in renewal, the secondary signal amount of described not decoding audio data buffer queue is subtracted to 1, secondary signal amount is 0, known according to judging, now, in decoding audio data buffer queue, not there is not the resource of having stored described in the instruction of the secondary signal amount of described not decoding audio data buffer queue, can the decoding of oscillator audio data and play thread.
It should be noted that, above-mentioned steps 202 to step 210 is in the implementation of above-mentioned steps 200 and moves, and above-mentioned steps 202 is to can concurrent running between step 210.Also, the renewal of each buffer queue semaphore, and the judgement of whether each thread being blocked according to semaphore all can concurrently be carried out.
In sum, equipment in the present invention comprises not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.The audio, video data receiving is separated accordingly, in decoding and playing process, can determine that whether blocking data transmission and audio, video data separate thread according to the first signal amount of described not decode video data buffer queue; According to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread; According to the secondary signal amount of described decoded video data buffer storage queue, determine whether to block decoded video data and show and Synchronization Control thread.
Carry out state synchronized between above-mentioned multiple threads time, the mode of do not re-use circulation dormancy, waking up is waited for the state needing, and adopts the design of semaphore.Semaphore can allow thread always in resting state, and in the time of resting state, thread does not participate in the task scheduling of central processing unit, does not also take central processing unit; When the state of thread waits is true time, semaphore can initiatively wake this thread up, again participate in the task scheduling of central processing unit, thereby this thread can continue to be performed, so just reduce the performance that central processing unit loses because of task scheduling unnecessary, occupancy and the equipment power dissipation of central processing unit are reduced, the cruising time of having improved equipment.
In addition, in video data decoding thread and the demonstration of decoded video data and Synchronization Control thread, can between video decode code segment and decoded video data reveal codes section, add mutual exclusion lock respectively, avoid these two sections of codes to be dispatched by central processing unit simultaneously, thereby avoid because CPU cache hit rate reduces the not high problem of the soft decoding performance of video causing.
Adopt technical scheme in the present embodiment, the performance of the soft decoding of video can promote more than 20%, and in the time suspending the soft decoding of video, the occupancy of central processing unit is almost reduced to 0, avoid the idle running phenomenon of central processing unit, thus the stand-by time that has extended device battery.
Under the equipment of same hardware configuration, when the identical video of soft decoding, the occupancy of central processing unit obviously reduces, thereby reduces equipment power dissipation, the stand-by time of extension device battery; In addition, configure poor equipment for some, the video code rate of the smooth and easy soft decoding of energy obviously improves, and has improved user's experience.
Embodiment tri-
Introduce in detail the video soft decoding method of a kind of equipment that the embodiment of the present invention provides.
With reference to Fig. 3, show the video soft decoding method flow chart of a kind of equipment in the embodiment of the present invention.
In the present embodiment, for realizing the soft decoding of efficient video, whole process can be resolved into transfer of data and audio, video data separation, voice data decoding and broadcasting, video data decoding, the demonstration of decoded video data and four main tasks of Synchronization Control, each task is realized by independent thread, four thread concurrent runnings.Build not decoding audio data buffer queue, not decode video data buffer queue, three queues of decoded video data buffer storage queue simultaneously, be that equipment in the embodiment of the present invention can comprise not decode video data buffer queue, the queue of decoded video data buffer storage and decoding audio data buffer queue not, continue in four threads to realize audio, video data, smooth transmission.
For realizing the wait without circulation dormancy, wake-up mode between four threads, each queue is used respectively two resource signal amounts to control, not decode video data buffer queue, the queue of decoded video data buffer storage and do not include first signal amount and secondary signal amount separately in decoding audio data buffer queue described in, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.Described first signal amount can be the quantity of remaining free space in our team's row; Described secondary signal amount can be the quantity of the data resource stored in our team row.When initialization, the quantity of the free space of each queue is exactly the maximum resource amount that this queue can be stored, and the quantity that has deposited resource in is all 0, and two semaphores in each queue carry out initialization by these two values respectively.
Step 300, the audio, video data bag that judgement gets is packets of audio data or video packets of data.In the time being packets of audio data, execution step 302; In the time being video packets of data, execution step 306.
Can usage data transmission and audio, video data separate thread and obtain audio, video data bag from network or this locality, and further judge that audio, video data bag is packets of audio data or video packets of data.
Step 302, deposits packets of audio data in not decoding audio data buffer queue.
If the first signal amount in decoding audio data buffer queue is not indicated the not available free space of decoding audio data buffer queue, packets of audio data is deposited in to not decoding audio data buffer queue, the secondary signal amount in decoding audio data buffer queue is not added to 1.Now, the sleep if voice data decoding and broadcasting thread get clogged, wakes voice data decoding up and plays thread, execution step 304.
If the first signal amount in decoding audio data buffer queue does not indicate not decoding audio data buffer queue there is no free space, blocking data transmission and audio, video data separate thread.
Step 304, decodes and plays packets of audio data.
Voice data decoding and broadcasting thread never read out packets of audio data in decoding audio data buffer queue, the secondary signal amount of decoding audio data buffer queue is not subtracted to 1, the first signal amount of decoding audio data buffer queue is not added to 1, if now transfer of data and audio, video data separate the thread sleep that gets clogged, wake transfer of data and audio, video data separation thread up.Use voice data decoding and play thread the packets of audio data reading out is decoded and play.Wherein, synchronously being shown and Synchronization Control Thread control by decoded video data of audio, video data.
If the secondary signal amount of decoding audio data buffer queue is not 0, does not indicate and there is no packets of audio data in decoding audio data buffer queue, the decoding of oscillator audio data and broadcasting thread.
Step 306, deposits video packets of data in not decode video data buffer queue.
If the first signal amount of decode video data buffer queue is not indicated the not available free space of decode video data buffer queue, video packets of data is deposited in to not decode video data buffer queue, the secondary signal amount of decode video data buffer queue is not added to 1, the first signal amount of decode video data buffer queue is not subtracted to 1.If the now video data decoding thread sleep that gets clogged, wakes video data decoding thread up, execution step 308.
If the first signal amount of decode video data buffer queue does not indicate not decode video data buffer queue there is no free space, blocking data transmission and audio, video data separate thread.
Step 308, decodes to video packets of data.
Video data decoding thread never reads out video packets of data in decode video data buffer queue, the secondary signal amount of decode video data buffer queue is not subtracted to 1, the first signal amount of decode video data buffer queue is not added to 1, if now transfer of data and audio, video data separate the thread sleep that gets clogged, wake transfer of data and audio, video data separation thread up.Use video data decoding thread to decode to the video packets of data reading out, execution step 310.
If the secondary signal amount of decode video data buffer queue is not 0, does not indicate and there is no video packets of data in decode video data buffer queue, blocked video data decode thread.
Step 310, deposits decoded video packets of data the queue of in decoded video data buffer storage.
If the first signal amount of the decoded video data buffer storage queue instruction available free space of decoded video data buffer storage queue, decoded video packets of data is deposited in to the queue of decoded video data buffer storage, the secondary signal amount that deposits the queue of decoded video data buffer storage in is added to 1, the first signal amount that deposits the queue of decoded video data buffer storage in is subtracted to 1.The sleep if now decoded video data demonstration and Synchronization Control thread get clogged, wakes decoded video data up and shows and Synchronization Control thread, execution step 312.
If the queue of the first signal amount of decoded video data buffer storage queue instruction decoded video data buffer storage does not have free space, blocked video data decode thread.
Step 312, shows and Synchronization Control decoded video packets of data.
Decoded video data show and Synchronization Control thread reads out decoded video packets of data from the queue of decoded video data buffer storage, the secondary signal amount of decoded video data buffer storage queue is subtracted to 1, the first signal amount of decoded video data buffer storage queue is added to 1, if now video data decoding thread gets clogged, wake video data decoding thread up.Use the demonstration of decoded video data and Synchronization Control thread to show and Synchronization Control the decoded video packets of data reading out.
If the secondary signal amount of decoded video data buffer storage queue is 0, in the queue of instruction decoded video data buffer storage, there is no decoded video packets of data, block decoded video data and show and Synchronization Control thread.
Above the single treatment process of voice data and video data is described, those skilled in the art should understand, in actual use, the above-mentioned processing to audio, video data all loops, until this all pending audio, video data is all decoded and finished playing.
Preferably, between above-mentioned video data decoding thread and the demonstration of above-mentioned decoded video data and Synchronization Control thread, be provided with mutual exclusion lock, can be according to the current state of the mutual exclusion lock between described video data decoding thread and the demonstration of described decoded video data and Synchronization Control thread, described video data decoding thread is dispatched in mutual exclusion and described decoded video data show and Synchronization Control thread.Object is to avoid above-mentioned video data decoding thread and the demonstration of above-mentioned decoded video data and Synchronization Control thread to be dispatched by central processing unit simultaneously, thereby avoids reducing because of the cache hit rate of central processing unit the low problem of soft decoding performance causing.But in actual use, dispatch described video data decoding thread and the demonstration of described decoded video data and Synchronization Control thread even if do not use mutual exclusion lock mutual exclusion, wake or block the mode of the thread relating in said process up with semaphore, still be better than traditional approach, improved the soft decoding performance of video.
In sum, equipment in the present invention comprises not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.The audio, video data receiving is separated accordingly, in decoding and playing process, can determine that whether blocking data transmission and audio, video data separate thread according to the first signal amount of described not decode video data buffer queue; According to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread; According to the secondary signal amount of described decoded video data buffer storage queue, determine whether to block decoded video data and show and Synchronization Control thread.
Carry out state synchronized between above-mentioned multiple threads time, the mode of do not re-use circulation dormancy, waking up is waited for the state needing, and adopts the design of semaphore.Semaphore can allow thread always in resting state, and in the time of resting state, thread does not participate in the task scheduling of central processing unit, does not also take central processing unit; When the state of thread waits is true time, semaphore can initiatively wake this thread up, again participate in the task scheduling of central processing unit, thereby this thread can continue to be performed, so just reduce the performance that central processing unit loses because of task scheduling unnecessary, occupancy and the equipment power dissipation of central processing unit are reduced, the cruising time of having improved equipment.
In addition, in video data decoding thread and the demonstration of decoded video data and Synchronization Control thread, can between video decode code segment and decoded video data reveal codes section, add mutual exclusion lock respectively, avoid these two sections of codes to be dispatched by central processing unit simultaneously, thereby avoid because CPU cache hit rate reduces the not high problem of the soft decoding performance of video causing.
Adopt technical scheme in the present embodiment, the performance of the soft decoding of video can promote more than 20%, and in the time suspending the soft decoding of video, the occupancy of central processing unit is almost reduced to 0, avoid the idle running phenomenon of central processing unit, thus the stand-by time that has extended device battery.
Under the equipment of same hardware configuration, when the identical video of soft decoding, the occupancy of central processing unit obviously reduces, thereby reduces equipment power dissipation, the stand-by time of extension device battery; In addition, configure poor equipment for some, the video code rate of the smooth and easy soft decoding of energy obviously improves, and has improved user's experience.
Embodiment tetra-
Introduce in detail the soft decoding device of video of a kind of equipment that the embodiment of the present invention provides.
With reference to Fig. 4, show the soft decoding device structure chart of a kind of video of equipment in the embodiment of the present invention.
Described equipment can comprise not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, all can comprise first signal amount and secondary signal amount separately, whether described first signal amount can be used to indicate and in this queue, exist free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.
Described device can comprise: feature operation module 400, the first decision module 402, the second decision module 404, the three decision module 406.
Introduce in detail respectively the relation between function and each module of each module below.
Feature operation module 400, separates for usage data transmission and audio, video data that thread, video data decoding thread and decoded video data show and Synchronization Control thread separates accordingly, decodes and play the audio, video data receiving respectively.
The first decision module 402, for carrying out described separation, decoding and playing process in described feature operation module, determines according to the first signal amount of described not decode video data buffer queue whether blocking data transmits and audio, video data separation thread.
The second decision module 404, for according to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread.
The 3rd decision module 406, for according to the secondary signal amount of described decoded video data buffer storage queue, determines whether to block decoded video data and shows and Synchronization Control thread.
In sum, equipment in the present invention comprises not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.The audio, video data receiving is separated accordingly, in decoding and playing process, can determine that whether blocking data transmission and audio, video data separate thread according to the first signal amount of described not decode video data buffer queue; According to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread; According to the secondary signal amount of described decoded video data buffer storage queue, determine whether to block decoded video data and show and Synchronization Control thread.
Carry out state synchronized between above-mentioned multiple threads time, the mode of do not re-use circulation dormancy, waking up is waited for the state needing, and adopts the design of semaphore.Semaphore can allow thread always in resting state, and in the time of resting state, thread does not participate in the task scheduling of central processing unit, does not also take central processing unit; When the state of thread waits is true time, semaphore can initiatively wake this thread up, again participate in the task scheduling of central processing unit, thereby this thread can continue to be performed, so just reduce the performance that central processing unit loses because of task scheduling unnecessary, occupancy and the equipment power dissipation of central processing unit are reduced, the cruising time of having improved equipment.
Embodiment five
Introduce in detail the soft decoding device of video of a kind of equipment that the embodiment of the present invention provides.
With reference to Fig. 5, show the soft decoding device structure chart of a kind of video of equipment in the embodiment of the present invention.
In the present embodiment, for realizing the soft decoding of efficient video, whole process can be resolved into transfer of data and audio, video data separation, voice data decoding and broadcasting, video data decoding, the demonstration of decoded video data and four main tasks of Synchronization Control, each task is realized by independent thread, four thread concurrent runnings.Build not decoding audio data buffer queue, not decode video data buffer queue, three queues of decoded video data buffer storage queue simultaneously, be that equipment in the embodiment of the present invention can comprise not decode video data buffer queue, the queue of decoded video data buffer storage and decoding audio data buffer queue not, continue in four threads to realize audio, video data, smooth transmission.
For realizing the wait without circulation dormancy, wake-up mode between four threads, each queue is used respectively two resource signal amounts to control, not decode video data buffer queue, the queue of decoded video data buffer storage and do not include first signal amount and secondary signal amount separately in decoding audio data buffer queue described in, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.Described first signal amount can also be used to indicate the quantity of remaining free space in this queue; Described secondary signal amount can also be used to indicate the quantity of the data resource of having stored in this queue.When initialization, the quantity of the free space of each queue is exactly the maximum resource amount that this queue can be stored, and the quantity that has deposited resource in is all 0, and two semaphores in each queue carry out initialization by these two values respectively.
Described device can comprise: feature operation module 500, the first decision module 502, the second decision module 504, the three decision module 506, the four decision module 508, the five decision module 510, mutual exclusion scheduler module 512.
Introduce in detail respectively the relation between function and each module of each module below.
Feature operation module 500, separates for usage data transmission and audio, video data that thread, video data decoding thread and decoded video data show and Synchronization Control thread separates accordingly, decodes and play the audio, video data receiving respectively.
The first decision module 502, for carrying out described separation, decoding and playing process in described feature operation module, determines according to the first signal amount of described not decode video data buffer queue whether blocking data transmits and audio, video data separation thread.
Preferably, described the first decision module 502 can be for carrying out in described separation, decoding and playing process in described feature operation module, according to the first signal amount of described not decode video data buffer queue, whether decode video data buffer queue not there is free space described in judgement; In the time that decode video data buffer queue does not exist free space described in the first signal amount instruction of described not decode video data buffer queue, block described transfer of data and audio, video data and separate thread; In the time that described in the first signal amount instruction of described not decode video data buffer queue, there is not free space in decode video data buffer queue, usage data transmission and audio, video data separate thread and receive and separate after audio, video data, decode video data buffer queue not described in isolated video data is deposited in, and not first signal amount and the secondary signal amount of decode video data buffer queue described in upgrading; And according to the first signal amount of the described not decode video data buffer queue after upgrading, described in continuing to judge, whether decoded video buffer queue not there is free space.
The second decision module 504, for carrying out described separation, decoding and playing process in described feature operation module, according to the secondary signal amount of described not decode video data buffer queue, and/or, whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread.
Preferably, described the second decision module 504 can be for according to the secondary signal amount of described not decode video data buffer queue, and whether decode video data buffer queue does not exist the resource of having stored described in judgement, and/or, according to the first signal of described decoded video data buffer storage queue, judge whether the queue of described decoded video data buffer storage exists free space, in the time that described in the secondary signal amount instruction of described not decode video data buffer queue, there is not the resource of having stored in decode video data buffer queue, and/or, in the time that the first signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage not have free space, block described video data decoding thread, in the time that described in the secondary signal amount instruction of described not decode video data buffer queue, there is not the resource of having stored in decode video data buffer queue, and/or, in the time that the first signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage to have free space, use described video data decoding thread to carry out video decode to the video data resource of storing in described not decode video data buffer queue, and deposit decoded video data the queue of in described decoded video data buffer storage, and the secondary signal amount of decode video data buffer queue not described in upgrading, and, the first signal amount of described decoded video data buffer storage queue and secondary signal amount, and according to the secondary signal amount of the described not decode video data buffer queue after upgrading, described in continuing to judge, whether decode video data buffer queue not there is the resource of having stored, and/or, according to the first signal amount of the described decoded video data buffer storage queue after upgrading, continue to judge whether the queue of described decoded video data buffer storage exists free space.
The 3rd decision module 506, for carrying out described separation, decoding and playing process in described feature operation module, according to the secondary signal amount of described decoded video data buffer storage queue, determines whether to block decoded video data and shows and Synchronization Control thread.
Preferably, described the 3rd decision module 506 can, for according to the secondary signal amount of described decoded video data buffer storage queue, judge whether the queue of described decoded video data buffer storage exists the resource of having stored; In the time that the secondary signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage not have the resource of having stored, block described decoded video data and show and Synchronization Control thread; In the time that the secondary signal amount of described decoded video data buffer storage queue indicates described decoded video data buffer storage queue to have the resource of having stored, use described decoded video data demonstration and Synchronization Control thread to show the decoded video data of storing in the queue of described decoded video data buffer storage, and control the described decoded video data of demonstration and the broadcasting of synchronizeing of decoded voice data, and upgrade the secondary signal amount of described decoded video data buffer storage queue; And, according to the secondary signal amount of the described decoded video data buffer storage queue after upgrading, continue to judge whether the queue of described decoded video data buffer storage exists the resource of having stored.
The 4th decision module 508, for carrying out described separation, decoding and playing process in described feature operation module, according to the first signal amount of described not decoding audio data buffer queue, determines whether blocking data transmits and audio, video data separation thread.
Preferably, described the 4th decision module 508 can be for according to the first signal amount of described not decoding audio data buffer queue, and whether decoding audio data buffer queue does not exist free space described in judgement; In the time that decoding audio data buffer queue does not exist free space described in the first signal amount instruction of described not decoding audio data buffer queue, block described transfer of data and audio, video data and separate thread; In the time that described in the first signal amount instruction of described not decoding audio data buffer queue, there is not free space in decoding audio data buffer queue, using described transfer of data and audio, video data to separate thread receives and separates after audio, video data, decoding audio data buffer queue not described in isolated voice data is deposited in, and not first signal amount and the secondary signal amount of decoding audio data buffer queue described in upgrading; And according to the first signal amount of the described not decoding audio data buffer queue after upgrading, described in continuing to judge, whether decoding audio data buffer queue not there is free space.
The 5th decision module 510, for carrying out described separation, decoding and playing process in described feature operation module, according to the secondary signal amount of described not decoding audio data buffer queue, determines whether oscillator audio data is decoded and plays thread.
Preferably, described the 5th decision module 510 can be for according to the secondary signal amount of described not decoding audio data buffer queue, and whether decoding audio data buffer queue does not exist the resource of having stored described in judgement; In the time that decoding audio data buffer queue does not exist the resource of having stored described in the secondary signal amount instruction of described not decoding audio data buffer queue, block described voice data decoding and play thread; In the time that described in the secondary signal amount instruction of described not decoding audio data buffer queue, there is not the resource of having stored in decoding audio data buffer queue, use the decoding of described voice data and play thread the voice data resource of storing in described not decoding audio data buffer queue is carried out to audio decoder and broadcasting, and the secondary signal amount of decoding audio data buffer queue not described in upgrading; And according to the secondary signal amount of described not decoding audio data buffer queue after upgrading, whether decoding audio data buffer queue not there is the resource of having stored described in judgement.
Mutual exclusion scheduler module 512, be used for according to the current state of the mutual exclusion lock between described video data decoding thread and the demonstration of described decoded video data and Synchronization Control thread, described video data decoding thread is dispatched in mutual exclusion and described decoded video data show and Synchronization Control thread.
In sum, equipment in the present invention comprises not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored.The audio, video data receiving is separated accordingly, in decoding and playing process, can determine that whether blocking data transmission and audio, video data separate thread according to the first signal amount of described not decode video data buffer queue; According to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread; According to the secondary signal amount of described decoded video data buffer storage queue, determine whether to block decoded video data and show and Synchronization Control thread.
Carry out state synchronized between above-mentioned multiple threads time, the mode of do not re-use circulation dormancy, waking up is waited for the state needing, and adopts the design of semaphore.Semaphore can allow thread always in resting state, and in the time of resting state, thread does not participate in the task scheduling of central processing unit, does not also take central processing unit; When the state of thread waits is true time, semaphore can initiatively wake this thread up, again participate in the task scheduling of central processing unit, thereby this thread can continue to be performed, so just reduce the performance that central processing unit loses because of task scheduling unnecessary, occupancy and the equipment power dissipation of central processing unit are reduced, the cruising time of having improved equipment.
In addition, in video data decoding thread and the demonstration of decoded video data and Synchronization Control thread, can between video decode code segment and decoded video data reveal codes section, add mutual exclusion lock respectively, avoid these two sections of codes to be dispatched by central processing unit simultaneously, thereby avoid because CPU cache hit rate reduces the not high problem of the soft decoding performance of video causing.
Adopt technical scheme in the present embodiment, the performance of the soft decoding of video can promote more than 20%, and in the time suspending the soft decoding of video, the occupancy of central processing unit is almost reduced to 0, avoid the idle running phenomenon of central processing unit, thus the stand-by time that has extended device battery.
Under the equipment of same hardware configuration, when the identical video of soft decoding, the occupancy of central processing unit obviously reduces, thereby reduces equipment power dissipation, the stand-by time of extension device battery; In addition, configure poor equipment for some, the video code rate of the smooth and easy soft decoding of energy obviously improves, and has improved user's experience.
For device embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, relevant part is referring to the part explanation of embodiment of the method.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed is and the difference of other embodiment, between each embodiment identical similar part mutually referring to.
Video soft decoding method and the device of a kind of the equipment above embodiment of the present invention being provided, be described in detail, applied specific case herein principle of the present invention and execution mode are set forth, the explanation of above embodiment is just for helping to understand method of the present invention and core concept thereof; , for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention meanwhile.

Claims (16)

1. the video soft decoding method of an equipment, it is characterized in that, described equipment comprises not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored;
Described method comprises:
Usage data transmission and audio, video data separate thread, and the decoded video data demonstration and Synchronization Control thread of video data decoding thread separates accordingly, decodes and play the audio, video data receiving respectively;
In described separation, decoding and playing process, determine according to the first signal amount of described not decode video data buffer queue whether blocking data transmits and audio, video data separation thread;
According to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread;
According to the secondary signal amount of described decoded video data buffer storage queue, determine whether to block decoded video data and show and Synchronization Control thread.
2. method according to claim 1, is characterized in that, the first signal amount of decode video data buffer queue does not determine that the step that whether blocking data transmission and audio, video data separate thread comprises described in described basis:
According to the first signal amount of described not decode video data buffer queue, whether decode video data buffer queue not there is free space described in judgement;
In the time that decode video data buffer queue does not exist free space described in the first signal amount instruction of described not decode video data buffer queue, block described transfer of data and audio, video data and separate thread;
In the time that described in the first signal amount instruction of described not decode video data buffer queue, there is not free space in decode video data buffer queue, usage data transmission and audio, video data separate thread and receive and separate after audio, video data, decode video data buffer queue not described in isolated video data is deposited in, and not first signal amount and the secondary signal amount of decode video data buffer queue described in upgrading; And according to the first signal amount of the described not decode video data buffer queue after upgrading, described in continuing to judge, whether decoded video buffer queue not there is free space.
3. method according to claim 2, it is characterized in that, according to the secondary signal amount of described not decode video data buffer queue, and/or, the first signal amount of described decoded video data buffer storage queue, determines that whether the step of blocked video data decode thread comprises:
According to the secondary signal amount of described not decode video data buffer queue, whether decode video data buffer queue not there is the resource of having stored described in judgement; And/or,
According to the first signal of described decoded video data buffer storage queue, judge whether the queue of described decoded video data buffer storage exists free space;
In the time that described in the secondary signal amount instruction of described not decode video data buffer queue, there is not the resource of having stored in decode video data buffer queue, and/or, in the time that the first signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage not have free space, block described video data decoding thread;
In the time that described in the secondary signal amount instruction of described not decode video data buffer queue, there is not the resource of having stored in decode video data buffer queue, and/or, in the time that the first signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage to have free space, use described video data decoding thread to carry out video decode to the video data resource of storing in described not decode video data buffer queue, and deposit decoded video data the queue of in described decoded video data buffer storage, and the secondary signal amount of decode video data buffer queue not described in upgrading, and, the first signal amount of described decoded video data buffer storage queue and secondary signal amount, and according to the secondary signal amount of the described not decode video data buffer queue after upgrading, described in continuing to judge, whether decode video data buffer queue not there is the resource of having stored, and/or, according to the first signal amount of the described decoded video data buffer storage queue after upgrading, continue to judge whether the queue of described decoded video data buffer storage exists free space.
4. method according to claim 3, is characterized in that, described according to the secondary signal amount of described decoded video data buffer storage queue, determines that the step of whether blocking the demonstration of decoded video data and Synchronization Control thread comprises:
According to the secondary signal amount of described decoded video data buffer storage queue, judge whether the queue of described decoded video data buffer storage exists the resource of having stored;
In the time that the secondary signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage not have the resource of having stored, block described decoded video data and show and Synchronization Control thread;
In the time that the secondary signal amount of described decoded video data buffer storage queue indicates described decoded video data buffer storage queue to have the resource of having stored, use described decoded video data demonstration and Synchronization Control thread to show the decoded video data of storing in the queue of described decoded video data buffer storage, and control the described decoded video data of demonstration and the broadcasting of synchronizeing of decoded voice data, and upgrade the secondary signal amount of described decoded video data buffer storage queue; And, according to the secondary signal amount of the described decoded video data buffer storage queue after upgrading, continue to judge whether the queue of described decoded video data buffer storage exists the resource of having stored.
5. method according to claim 1, is characterized in that, described method also comprises:
According to the current state of the mutual exclusion lock between described video data decoding thread and the demonstration of described decoded video data and Synchronization Control thread, described video data decoding thread is dispatched in mutual exclusion and described decoded video data show and Synchronization Control thread.
6. method according to claim 1, is characterized in that, described equipment also comprises not decoding audio data buffer queue, and described not decoding audio data buffer queue also has first signal amount and secondary signal amount;
In described separation, decoding and playing process, described method also comprises:
According to the first signal amount of described not decoding audio data buffer queue, determine whether blocking data transmits and audio, video data separation thread; And,
According to the secondary signal amount of described not decoding audio data buffer queue, determine whether oscillator audio data is decoded and plays thread.
7. method according to claim 6, is characterized in that,
According to the first signal amount of described not decoding audio data buffer queue, determine that the step that whether blocking data transmission and audio, video data separate thread comprises:
According to the first signal amount of described not decoding audio data buffer queue, whether decoding audio data buffer queue not there is free space described in judgement;
In the time that decoding audio data buffer queue does not exist free space described in the first signal amount instruction of described not decoding audio data buffer queue, block described transfer of data and audio, video data and separate thread;
In the time that described in the first signal amount instruction of described not decoding audio data buffer queue, there is not free space in decoding audio data buffer queue, using described transfer of data and audio, video data to separate thread receives and separates after audio, video data, decoding audio data buffer queue not described in isolated voice data is deposited in, and not first signal amount and the secondary signal amount of decoding audio data buffer queue described in upgrading; And according to the first signal amount of the described not decoding audio data buffer queue after upgrading, described in continuing to judge, whether decoding audio data buffer queue not there is free space;
According to the secondary signal amount of described not decoding audio data buffer queue, the step that determines whether oscillator audio data decoding and play thread comprises:
According to the secondary signal amount of described not decoding audio data buffer queue, whether decoding audio data buffer queue not there is the resource of having stored described in judgement;
In the time that decoding audio data buffer queue does not exist the resource of having stored described in the secondary signal amount instruction of described not decoding audio data buffer queue, block described voice data decoding and play thread;
In the time that described in the secondary signal amount instruction of described not decoding audio data buffer queue, there is not the resource of having stored in decoding audio data buffer queue, use the decoding of described voice data and play thread the voice data resource of storing in described not decoding audio data buffer queue is carried out to audio decoder and broadcasting, and the secondary signal amount of decoding audio data buffer queue not described in upgrading; And according to the secondary signal amount of described not decoding audio data buffer queue after upgrading, whether decoding audio data buffer queue not there is the resource of having stored described in judgement.
8. method according to claim 1, is characterized in that, described first signal amount is also used to indicate the quantity of remaining free space in this queue; Described secondary signal amount is also used to indicate the quantity of the data resource of having stored in this queue.
9. the soft decoding device of the video of an equipment, it is characterized in that, described equipment comprises not decode video data buffer queue and the queue of decoded video data buffer storage, in described not decode video data buffer queue and the queue of decoded video data buffer storage, include first signal amount and secondary signal amount separately, whether described first signal amount is used to indicate and in this queue, exists free space, described secondary signal amount to be used to indicate in this queue, whether to have the resource of having stored;
Described device comprises:
Feature operation module, separates for usage data transmission and audio, video data that thread, video data decoding thread and decoded video data show and Synchronization Control thread separates accordingly, decodes and play the audio, video data receiving respectively;
The first decision module, for carrying out described separation, decoding and playing process in described feature operation module, determines according to the first signal amount of described not decode video data buffer queue whether blocking data transmits and audio, video data separation thread;
The second decision module, for according to the secondary signal amount of described not decode video data buffer queue, and/or whether the first signal amount of described decoded video data buffer storage queue, determine blocked video data decode thread;
The 3rd decision module, for according to the secondary signal amount of described decoded video data buffer storage queue, determines whether to block decoded video data and shows and Synchronization Control thread.
10. device according to claim 9, is characterized in that,
Described the first decision module, for carrying out described separation, decoding and playing process in described feature operation module, according to the first signal amount of described not decode video data buffer queue, whether decode video data buffer queue not there is free space described in judgement; In the time that decode video data buffer queue does not exist free space described in the first signal amount instruction of described not decode video data buffer queue, block described transfer of data and audio, video data and separate thread; In the time that described in the first signal amount instruction of described not decode video data buffer queue, there is not free space in decode video data buffer queue, usage data transmission and audio, video data separate thread and receive and separate after audio, video data, decode video data buffer queue not described in isolated video data is deposited in, and not first signal amount and the secondary signal amount of decode video data buffer queue described in upgrading; And according to the first signal amount of the described not decode video data buffer queue after upgrading, described in continuing to judge, whether decoded video buffer queue not there is free space.
11. devices according to claim 10, is characterized in that, described the second decision module, and for according to the secondary signal amount of described not decode video data buffer queue, whether decode video data buffer queue not there is the resource of having stored described in judgement, and/or, according to the first signal of described decoded video data buffer storage queue, judge whether the queue of described decoded video data buffer storage exists free space, in the time that described in the secondary signal amount instruction of described not decode video data buffer queue, there is not the resource of having stored in decode video data buffer queue, and/or, in the time that the first signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage not have free space, block described video data decoding thread, in the time that described in the secondary signal amount instruction of described not decode video data buffer queue, there is not the resource of having stored in decode video data buffer queue, and/or, in the time that the first signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage to have free space, use described video data decoding thread to carry out video decode to the video data resource of storing in described not decode video data buffer queue, and deposit decoded video data the queue of in described decoded video data buffer storage, and the secondary signal amount of decode video data buffer queue not described in upgrading, and, the first signal amount of described decoded video data buffer storage queue and secondary signal amount, and according to the secondary signal amount of the described not decode video data buffer queue after upgrading, described in continuing to judge, whether decode video data buffer queue not there is the resource of having stored, and/or, according to the first signal amount of the described decoded video data buffer storage queue after upgrading, continue to judge whether the queue of described decoded video data buffer storage exists free space.
12. devices according to claim 11, is characterized in that, described the 3rd decision module, for according to the secondary signal amount of described decoded video data buffer storage queue, judges whether the queue of described decoded video data buffer storage exists the resource of having stored; In the time that the secondary signal amount of described decoded video data buffer storage queue indicates the queue of described decoded video data buffer storage not have the resource of having stored, block described decoded video data and show and Synchronization Control thread; In the time that the secondary signal amount of described decoded video data buffer storage queue indicates described decoded video data buffer storage queue to have the resource of having stored, use described decoded video data demonstration and Synchronization Control thread to show the decoded video data of storing in the queue of described decoded video data buffer storage, and control the described decoded video data of demonstration and the broadcasting of synchronizeing of decoded voice data, and upgrade the secondary signal amount of described decoded video data buffer storage queue; And, according to the secondary signal amount of the described decoded video data buffer storage queue after upgrading, continue to judge whether the queue of described decoded video data buffer storage exists the resource of having stored.
13. devices according to claim 9, is characterized in that, described device also comprises:
Mutual exclusion scheduler module, be used for according to the current state of the mutual exclusion lock between described video data decoding thread and the demonstration of described decoded video data and Synchronization Control thread, described video data decoding thread is dispatched in mutual exclusion and described decoded video data show and Synchronization Control thread.
14. devices according to claim 9, is characterized in that, described equipment also comprises not decoding audio data buffer queue, and described not decoding audio data buffer queue also has first signal amount and secondary signal amount;
Described device also comprises:
The 4th decision module, for according to the first signal amount of described not decoding audio data buffer queue, determines whether blocking data transmits and audio, video data separation thread; And,
The 5th decision module, for according to the secondary signal amount of described not decoding audio data buffer queue, determines whether oscillator audio data is decoded and plays thread.
15. devices according to claim 14, is characterized in that,
Described the 4th decision module, for according to the first signal amount of described not decoding audio data buffer queue, whether decoding audio data buffer queue not there is free space described in judgement; In the time that decoding audio data buffer queue does not exist free space described in the first signal amount instruction of described not decoding audio data buffer queue, block described transfer of data and audio, video data and separate thread; In the time that described in the first signal amount instruction of described not decoding audio data buffer queue, there is not free space in decoding audio data buffer queue, using described transfer of data and audio, video data to separate thread receives and separates after audio, video data, decoding audio data buffer queue not described in isolated voice data is deposited in, and not first signal amount and the secondary signal amount of decoding audio data buffer queue described in upgrading; And according to the first signal amount of the described not decoding audio data buffer queue after upgrading, described in continuing to judge, whether decoding audio data buffer queue not there is free space;
Described the 5th decision module, for according to the secondary signal amount of described not decoding audio data buffer queue, whether decoding audio data buffer queue not there is the resource of having stored described in judgement; In the time that decoding audio data buffer queue does not exist the resource of having stored described in the secondary signal amount instruction of described not decoding audio data buffer queue, block described voice data decoding and play thread; In the time that described in the secondary signal amount instruction of described not decoding audio data buffer queue, there is not the resource of having stored in decoding audio data buffer queue, use the decoding of described voice data and play thread the voice data resource of storing in described not decoding audio data buffer queue is carried out to audio decoder and broadcasting, and the secondary signal amount of decoding audio data buffer queue not described in upgrading; And according to the secondary signal amount of described not decoding audio data buffer queue after upgrading, whether decoding audio data buffer queue not there is the resource of having stored described in judgement.
16. devices according to claim 9, is characterized in that, described first signal amount is also used to indicate the quantity of remaining free space in this queue; Described secondary signal amount is also used to indicate the quantity of the data resource of having stored in this queue.
CN201410384909.1A 2014-08-06 2014-08-06 Video soft decoding method and device of equipment Pending CN104159142A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410384909.1A CN104159142A (en) 2014-08-06 2014-08-06 Video soft decoding method and device of equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410384909.1A CN104159142A (en) 2014-08-06 2014-08-06 Video soft decoding method and device of equipment

Publications (1)

Publication Number Publication Date
CN104159142A true CN104159142A (en) 2014-11-19

Family

ID=51884532

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410384909.1A Pending CN104159142A (en) 2014-08-06 2014-08-06 Video soft decoding method and device of equipment

Country Status (1)

Country Link
CN (1) CN104159142A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260242A (en) * 2015-10-29 2016-01-20 无锡天脉聚源传媒科技有限公司 Task processing method and device
CN108419125A (en) * 2018-03-08 2018-08-17 弘成科技发展有限公司 The long-range control method of multimedia classroom mobile terminal
CN114697705A (en) * 2020-12-29 2022-07-01 深圳云天励飞技术股份有限公司 Video stream object processing method and device, video stream processing system and electronic equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1531342A (en) * 2003-03-14 2004-09-22 ������������ʽ���� Mutimedium stream system for wireless manual apparatus
CN101146032A (en) * 2007-09-21 2008-03-19 广州市聚晖电子科技有限公司 A media streaming transmission bandwidth self-adapted method
CN101316193A (en) * 2007-05-28 2008-12-03 北京师范大学珠海分校 Multi-task scheduling method of measuring probe
CN101742218A (en) * 2010-01-19 2010-06-16 南京邮电大学 Implementation method of videophone system among IPTV set top boxes
CN101895743A (en) * 2010-03-11 2010-11-24 宇龙计算机通信科技(深圳)有限公司 Method and system for transmitting encoded and decoded data among processors, and visual telephone
CN102025728A (en) * 2010-11-26 2011-04-20 中兴通讯股份有限公司 Scheduling method under client-side/server-side architecture and server
CN103177744A (en) * 2011-12-21 2013-06-26 深圳市快播科技有限公司 Low-power-consumption playing method and device for mobile equipment
CN103237255A (en) * 2013-04-24 2013-08-07 南京龙渊微电子科技有限公司 Multi-thread audio and video synchronization control method and system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1531342A (en) * 2003-03-14 2004-09-22 ������������ʽ���� Mutimedium stream system for wireless manual apparatus
CN101316193A (en) * 2007-05-28 2008-12-03 北京师范大学珠海分校 Multi-task scheduling method of measuring probe
CN101146032A (en) * 2007-09-21 2008-03-19 广州市聚晖电子科技有限公司 A media streaming transmission bandwidth self-adapted method
CN101742218A (en) * 2010-01-19 2010-06-16 南京邮电大学 Implementation method of videophone system among IPTV set top boxes
CN101895743A (en) * 2010-03-11 2010-11-24 宇龙计算机通信科技(深圳)有限公司 Method and system for transmitting encoded and decoded data among processors, and visual telephone
CN102025728A (en) * 2010-11-26 2011-04-20 中兴通讯股份有限公司 Scheduling method under client-side/server-side architecture and server
CN103177744A (en) * 2011-12-21 2013-06-26 深圳市快播科技有限公司 Low-power-consumption playing method and device for mobile equipment
CN103237255A (en) * 2013-04-24 2013-08-07 南京龙渊微电子科技有限公司 Multi-thread audio and video synchronization control method and system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105260242A (en) * 2015-10-29 2016-01-20 无锡天脉聚源传媒科技有限公司 Task processing method and device
CN108419125A (en) * 2018-03-08 2018-08-17 弘成科技发展有限公司 The long-range control method of multimedia classroom mobile terminal
CN114697705A (en) * 2020-12-29 2022-07-01 深圳云天励飞技术股份有限公司 Video stream object processing method and device, video stream processing system and electronic equipment
CN114697705B (en) * 2020-12-29 2024-03-22 深圳云天励飞技术股份有限公司 Video stream object processing method and device, video stream processing system and electronic equipment

Similar Documents

Publication Publication Date Title
TWI720047B (en) Controlling telemetry data communication in a processor
KR100733943B1 (en) Processor system, dma control circuit, dma control method, control method for dma controller, graphic processing method, and graphic processing circuit
CN101615067B (en) Coordinated link power management
EP3155521B1 (en) Systems and methods of managing processor device power consumption
CN104159150B (en) Cloud terminal, Cloud Server, media data flow play system and method
CN103339959A (en) Dynamic video switching
CN1940858B (en) Method of Multi-task realization of media player
CN104050040B (en) Media-playback workload scheduler
US20110161965A1 (en) Job allocation method and apparatus for a multi-core processor
JP2016503911A (en) System and method for allocating memory to different memory devices using quality of service
CN106575220B (en) Multiple clustered VLIW processing cores
CN106030559A (en) Syncronization of interrupt processing to reduce power consumption
CN106104490A (en) For providing the system and method communicated between dynamic clock with voltage scaling (DCVS) aware processor
CN101600011A (en) The concurrent playing method and device of mobile multimedia terminal
CN103218329A (en) Digital signal processing data transfer
CN104159142A (en) Video soft decoding method and device of equipment
WO2013044258A1 (en) Firmware-based multi-threaded video decoding
US20150301573A1 (en) Latency-based power mode units for controlling power modes of processor cores, and related methods and systems
US20140325183A1 (en) Integrated circuit device, asymmetric multi-core processing module, electronic device and method of managing execution of computer program code therefor
TWI632816B (en) Continuous data delivery with energy conservation
CN112506828A (en) Transmission configuration method and device for direct memory access
CN102447965A (en) Method and device supporting access of video plug-in for quickly and smoothly displaying video
US10860083B2 (en) System, apparatus and method for collective power control of multiple intellectual property agents and a shared power rail
EP3948553A1 (en) System, apparatus and method for adaptive interconnect routing
US11561792B2 (en) System, apparatus, and method for a transient load instruction within a VLIW operation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20141119

RJ01 Rejection of invention patent application after publication