A kind of video encoding/decoding method, device, equipment and storage mediumTechnical field
The present embodiments relate to data processing field more particularly to a kind of video encoding/decoding method, device, equipment and storagesMedium.
Background technique
Video coding technique is from directions such as time redundancy, spatial redundancy, visual redundancy, statistical redundancies, to original videoThe problems such as data are compressed, and storage, the transmission of massive video are efficiently solved, is widely used in Network Video Transmission, numberAll kinds of related fieldss such as word video on demand.
In network direct broadcasting system, since video data has generally gone through compressed encoding, needed before playing display to itCorresponding decoding operate is executed, and decoding is an extremely complex calculating operation.Existing video decoding process has hardwareDecoding, software decode and the decoding of software and hardware combining.It is soft in the weaker mobile device of certain performances relative to PCPart decoding is more demanding to the processing capacity of central processing unit (Central Processing Unit, CPU), can there is movementEquipment heating or the defect of a large amount of power consumptions;The hardware decoder of low side mobile device compatibility decoded to video is simultaneously bad, hasSome normal videos possibly can not decode, or to decode the video image come more bigger than raw frames, and be accompanied by green side/flowerThe abnormal conditions such as side;The decoding of existing software and hardware combining is usually will be to be decoded according to software decoding and the decoded ability of hardwareCode stream carries out layered shaping, to obtain final decoded video data.
The existing decoding using software and hardware layering needs to want at this time by the corresponding decoding of the corresponding hardware realization of software controlThe hardware decoder is asked to be capable of providing corresponding software interface, to meet software control of which power, it is fixed that there are higher hardwareInhibition and generation requirement.
Summary of the invention
The embodiment of the invention provides a kind of video encoding/decoding method, device, equipment and storage mediums, solve the prior artMiddle hardware decoder is incompatible to video code flow and software and hardware decoding in have the problem of higher customization requires to hardware device,Realize that the video decoding of complete code stream improves video solution bit rate on the basis of guaranteeing low-power consumption.
In a first aspect, the embodiment of the invention provides a kind of video encoding/decoding methods, this method comprises:
Obtain video code flow;
The incompatible code stream in the video code flow is modified according to the coding type of the machine, obtains code stream to be decoded and modificationInformation, the incompatible code stream are code stream feature and the unmatched code stream of the coding type;
Hardware decoding is carried out to the code stream to be decoded, obtains decoded video frame;
The decoded video frame is adjusted according to the modification information, obtains target video frame.
Further, the incompatible code stream in the video code flow is modified according to the coding type of the machine, comprising:
Determine the code stream feature of the video code flow;
Determine the machine to the compatibility of the video code flow according to the coding type of the code stream feature and the machine;
The compatibility is that part is compatible, then the incompatible code in the video code flow is modified according to the coding typeStream.
Further, the incompatible code stream in the video code flow is modified according to the coding type, comprising:
Determine the machine to any compatible features value of the video code flow according to the coding type of the machine;
The code stream feature of incompatible code stream in the video code flow is determined according to any compatible features value;
It is to be worth matched target code stream feature with any compatible features by the code stream feature modification of the incompatible code stream.
Further, the code stream feature of the video code flow passes through the sequence header information to the video code flow, image groupAt least one in head information, picture header information and slice header information carries out parsing determination.
Further, it before the coding type according to the machine modifies the incompatible code stream in the video code flow, also wrapsIt includes:
According to the type of coding of the video code flow, matched coding type is searched in the compatibility list prestored.
Second aspect, the embodiment of the invention provides a kind of video decoder, which includes:
Code stream obtains module, for obtaining video code flow;
Code stream modified module is modified the incompatible code stream in the video code flow for the coding type according to the machine, is obtainedTo code stream to be decoded and modification information, the incompatible code stream is code stream feature and the unmatched code stream of the coding type;
Hardware decoder module obtains decoded video frame for carrying out hardware decoding to the code stream to be decoded;
Video framing control module obtains target view for adjusting the decoded video frame according to the modification informationFrequency frame.
Further, the code stream modified module, is specifically used for:
Determine the code stream feature of the video code flow;The machine pair is determined according to the coding type of the code stream feature and the machineThe compatibility of the video code flow;The compatibility is that part is compatible, then modifies the video code flow according to the coding typeIn incompatible code stream.
Further, the code stream modified module, is specifically used for:
Determine the machine to any compatible features value of the video code flow according to the coding type of the machine;According to any compatible featuresValue determines the code stream feature of incompatible code stream in the video code flow;By the code stream feature modification of the incompatible code stream for instituteState the matched target code stream feature of any compatible features value.
Further, the code stream feature of the video code flow passes through the sequence header information to the video code flow, image groupAt least one in head information, picture header information and slice header information carries out parsing determination.
Further, the video decoder, further includes:
Coding type determining module, for modifying the incompatible code in the video code flow in the coding type according to the machineBefore stream, according to the type of coding of the video code flow, matched coding type is searched in the compatibility list prestored.
The third aspect, the embodiment of the invention provides a kind of equipment, which includes:
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processingDevice realizes video encoding/decoding method described in any embodiment of that present invention.
Fourth aspect, the embodiment of the invention provides a kind of computer readable storage mediums, are stored thereon with computer journeySequence realizes video encoding/decoding method described in any embodiment of that present invention when the program is executed by processor.
A kind of video encoding/decoding method, device, equipment and storage medium provided in an embodiment of the present invention, according to the decoding of the machineThe unmatched incompatible code stream of the coding type of code stream feature and the machine in the corresponding modification video code flow of type, make it is modified toDecoded bit stream meets the coding type of the machine, thus carry out complete code stream hardware decoding, it is subsequent further according to modification information to hardThe decoded video frame of part is adjusted, and realizes the decoding of corresponding video, solve in the prior art hardware decoder to videoCode stream is incompatible and software and hardware decoding in have the problem of higher customization requires to hardware device, on the basis for guaranteeing low-power consumptionOn, video solution bit rate is improved, decoding performance is optimized.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, of the invention otherFeature, objects and advantages will become more apparent upon:
Figure 1A is a kind of flow chart for video encoding/decoding method that the embodiment of the present invention one provides;
The schematic diagram of the code flow structure of video code flow in the method that Figure 1B provides for the embodiment of the present invention one;
Fig. 2 is a kind of flow chart of video encoding/decoding method provided by Embodiment 2 of the present invention;
Fig. 3 is the scene framework figure of the application scenarios for the video encoding/decoding method that the embodiment of the present invention three provides;
Fig. 4 is a kind of structural schematic diagram for video decoder that the embodiment of the present invention four provides;
Fig. 5 is a kind of structural schematic diagram for equipment that the embodiment of the present invention five provides.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouchedThe specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to justOnly the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Since to decode requirement for the CPU processing capacity of decoding device lower for hardware, and can be the low-power consumption the case whereLower faster completion decoding, therefore the embodiment of the present invention is mainly for the video incompatible with the hardware decoder in mobile deviceCode stream is modified, and to meet the hardware coding type of the machine, the compatibility of code stream is improved, thus by modified complete videoCode stream carries out hardware decoding, and carries out reduction treatment to the decoded video frame of hardware according to modification information, is not influencing at this timeUnder the premise of decoded video pictures normal presentation, main time-consuming operation is executed yet by hardware decoder, reaches abundant benefitThe purpose for reducing fever and high power consumption that mobile device occurs is decoded with hardware.
Embodiment one
Figure 1A is a kind of flow chart for video encoding/decoding method that the embodiment of the present invention one provides, and the present embodiment can be applied to appointOn a kind of terminal device configured with hardware decoder.The technical solution of the embodiment of the present invention is suitable for how decoding by hardwareIn the video decoding process that the device pair video code flow incompatible with the coding type of the machine is decoded.Provided in this embodiment oneKind video encoding/decoding method can be executed by video decoder provided in an embodiment of the present invention, which can pass through softwareAnd/or the mode of hardware is realized, and is integrated in the equipment for executing this method, which can be configured with hardware decoderThe terminal devices such as smart phone, tablet computer, handheld device.
Specifically, this method may include steps of with reference to Figure 1A:
S110 obtains video code flow.
Wherein, before being played due to the video in network, certain compressed encoding has been generally gone through, it can will be originalVideo file is converted into another video format, guarantees the effective transmission of video file in a network.Video code flow is will be originalThe correspondence coded format that is obtained after compressed encoding of video file under video data, video file can be indicated in unitVideo data stream in time.
Specifically, user, when playing a certain video in equipment, which first has to obtain view process to be played into phase excessivelyThe video code flow generated after compressed encoding is answered, corresponding decoding operate is carried out to the video code flow so as to subsequent, it could be in equipmentUpper broadcasting display.Optionally, equipment receives the play instruction that user is directed to a certain video, can be rear according to the play instructionPlatform server or local corresponding position search the video code flow that the pre-stored video is generated into excessively corresponding compressed encoding, fromAnd the video code flow is obtained, corresponding decoding operate is carried out subsequent.
S120 modifies the incompatible code stream in video code flow according to the coding type of the machine, obtains code stream to be decoded and repairConvert to breath.
Wherein, incompatible code stream is code stream feature and the unmatched code stream of coding type.Specifically, code stream is characterized in videoFor file after compressed encoding, include in video code flow can indicate the coding lattice of corresponding used specific compressed encodingThe series of features information of formula;By taking H264 code stream as an example, code stream feature can have: include in the video code flow after compressed encodingJudge whether there is the corresponding entropy coding type used, video frame resolution, video frame when signature identification, the coding of bi-directionally referenced frameCaching frame number etc. needed for being reordered when dimension information and coding.The coding type of the machine is the hardware solution on local equipmentCode device is directed to all kinds of compression coding technologies, and the compatibility code stream that the hardware decoder can be supported when carrying out corresponding decoding is specialSign;If the code stream feature of current video code stream meets the character pair in the compatibility code stream feature, the hardware decoder of the machineCorresponding hardware decoding operate is carried out to current video code stream, it is ensured that corresponding decoding effect.
In addition, the coding type for various equipment can make designer pass through all kinds of models in the present embodimentHardware decoder in equipment is decoded test, Huo Zhetong to the video code flow generated using different compression coding technologies respectivelyThe hardware decoder in the equipment that automatic test software is all kinds of models is crossed to the view generated using different compression coding technologiesFrequency code stream carries out automatic decoding test respectively, so that the hardware decoder analyzed in the equipment of all kinds of models is directed to different compressionsThe compatibility code stream feature that coding techniques is supported, and corresponding compatibility list is generated, as may include in the compatibility listThe equipment of all kinds of models is directed to different coding type, the various compatible code stream features supported in corresponding decoding, that is, simultaneousIt may include the equipment of all kinds of models in capacitive list in the coding type supported when hardware decoding.
Optionally, the present embodiment can carry out software to the video code flow first when getting corresponding video code flowParsing obtains the code stream feature of the video code flow, while finding out the corresponding solution of the machine in the compatibility list of backstage storageCode type;To judge whether the code stream feature of the video code flow meets the compatibility that the machine is supported according to the coding type of the machineCode stream feature, and determine the code stream feature unmatched code stream of code stream feature compatible with coding type in the video code flow,As the incompatible code stream in the video code flow.
Further, the requirement due to hardware decoding for the CPU processing capacity of equipment is lower, and can be under low-power consumptionIt is very fast to complete decoding, therefore in order on the basis of guaranteeing that video pictures normally shows, still be able to use the machine in the present embodimentOn hardware decoder video code flow is decoded, the compatibility that can be supported at this time according to the hardware decoder in the machineCode stream feature modifies to the code stream feature of incompatible code stream in the video code flow, it is made to meet the coding type of the machine;TogetherWhen by after code stream feature modification incompatible code stream and the unmodified code stream of code stream feature reformulate a new complete viewFrequency code stream, that is, code stream to be decoded, so that the subsequent hardware decoder using in the machine is decoded the code stream to be decoded,Improve solution bit rate;Simultaneously when modifying to incompatible code stream, it is also necessary to corresponding modification information is saved, so as to subsequent energyIt is enough that reduction post-processing is carried out to code stream to be decoded is corresponded to decoded video frame according to the modification information, it obtains and original viewThe corresponding decoding video frame for meeting picture display and needing of frequency code stream.
Optionally, the compression coding mode as used by video is different, may include not in the coding type of the machineWith each compatible code stream feature under type of coding, therefore in the present embodiment, video codes are being modified according to the coding type of the machineBefore incompatible code stream in stream, it can also include: the type of coding according to video code flow, be looked into the compatibility list prestoredLook for matched coding type.
Specifically, in order to carry out corresponding modification to the incompatible code stream in the video code flow, making when getting video code flowIts coding type for meeting the machine, the present embodiment also need to carry out corresponding parsing to video code flow, judge the video code flow instituteThe compression coding mode of use, that is, corresponding type of coding are looked into the compatibility list prestored according to the type of codingFind out with the matched coding type of the type of coding, that is, under the type of coding hardware decoder of the machine supported it is eachCompatible code stream feature judges code in video code flow so as to subsequent directly according to each compatible code stream feature under the type of codingFlow feature and each compatible unmatched incompatible code stream of code stream feature under the type of coding.
Optionally, by this present embodiment mainly for make full use of hardware decoding come reduce equipment appearance fever and heightThe problem of power consumption, that is, the biggish decoding operate of power consumption in this decoding process is executed by using hardware decoder,To still be able to comparatively fast realize decoding, therefore to view in the present embodiment in the case where guaranteeing the low fever of equipment and low-power consumptionWhen incompatible code stream in frequency code stream is modified, need to consider whether the workload of modification will lead to larger power consumption or longer consumptionWhen the problem of.Specifically, modifying the incompatible code stream in video code flow according to the coding type of the machine in the present embodiment, can wrapIt includes:
S121, determines the code stream feature of video code flow, determines the machine to view according to the coding type of code stream feature and the machineThe compatibility of frequency code stream.
Specifically, after getting video code flow software parsing can be carried out to the video code flow first, obtain indicating to be somebody's turn to doThe code stream feature of specific compressed encoding information used by the corresponding video file of video code flow.Optionally, by accordingly compressingThe code flow structure of video code flow after coding is as shown in Figure 1B, and corresponding encoded hierarchy may include: sequence in the video code flowLayer, image group layer, image layer, slice layer, macroblock layer and block layer, pass through the code flow structure correspondence analysis of the level video code flowCode stream feature, the code stream feature of video code flow can pass through the sequence header information to video code flow, image group in the present embodimentAt least one in head information, picture header information and slice header information carries out parsing determination, can also be by macro block information pointAnalysis obtains.
Optionally, when parsing to obtain the code stream feature of the video code flow to video code flow progress software, this can be passed throughMachine mark inquires the corresponding each coding type of the machine in pre-stored compatibility list, and according to the coding of video code flowType obtains in each coding type of the machine inquired in advance corresponding with the video code flow in this decoding againCoding type, at the same code stream feature to the video code flow and native query to coding type in each compatible code for being supportedStream feature is compared, and determines the unmatched incompatible code stream of code stream feature in video code flow.
By needing to consider whether the workload of incompatible code stream modification will lead to larger power consumption or longer in this present embodimentTime-consuming problem, therefore when the equipment to all kinds of models is tested, in addition to needing to judge the machine for various compressed encodingsThe compatibility code stream feature that technology is supported, it is also necessary to judge the hardware decoder of the machine when incompatible to a certain code stream feature,When if necessary by the incompatible code stream feature modification for the characteristic value for the compatible code stream characteristic matching supported, need to expendEnergy and time-consuming it is excessive, when this modification the case where also bringing along equipment heating or high power consumption, then in compatibility listCorrespondence markings do not support the modification to the code stream feature out at the incompatible code stream feature, belong to video code flow and the machine completely notCompatible situation such as if it is determined that the machine is incompatible to the entropy coding type in video code flow, and modifies entropy coding type needs pairOriginal video is recompiled, and spent workload is excessive, therefore does not support to belong to the modification of entropy coding type at this timeVideo code flow and the complete incompatible situation of the machine;And if being compatible with being supported by the incompatible code stream feature modificationWhen the characteristic value of code stream characteristic matching, the calculation amount and time-consuming for needing to expend are smaller, can satisfy the low fever of equipment and low-power consumptionThe case where, correspondence markings go out to support to repair the code stream feature at the incompatible code stream feature of this in compatibility list at this timeChange, belongs to the video code flow situation compatible with the machine part;If the code stream feature of video code flow is all satisfied the machine and decodes correspondingEach compatible code stream feature under type, belongs to video code flow and the completely compatible situation of the machine at this time.Therefore in the present embodimentThe machine may include three kinds of situations completely compatible, that part is compatible and completely incompatible to the compatibility of video code flow.
It optionally, can be by the code stream feature and this in the present embodiment after obtaining the code stream feature of video code flowEach compatible code stream feature under the corresponding coding type of machine is compared, it is determined whether there are incompatible code streams, to judgeCompatibility of the machine to the video code flow;It is completely compatible complete hardware directly to be carried out by the hardware decoder in the machineDecoding, without modifying to the video code flow;Incompatible can be decoded by software is realized completely, without to the videoCode stream is modified;Therefore it does not perform an analysis in the present embodiment to completely compatible and completely incompatible situation, it is only compatible to partUnder video code flow handled, corresponding hardware solution is carried out to modified video code flow using hardware decoder so as to subsequentCode improves decoding efficiency.
S122, compatibility are that part is compatible, then the incompatible code stream in video code flow is modified according to coding type.
Specifically, special according to the code stream feature of video code flow and each compatible code stream of the machine under corresponding coding typeSign is determined in video code flow there are when incompatible code stream, according to the mark information of the incompatible code stream in compatibility listJudge whether to support the modification to the incompatible code stream, so that it is determined that compatibility of the machine to the video code flow;If compatibility isPart is compatible, then each compatible code stream feature directly according to the machine under corresponding coding type, to not simultaneous in video code flowHold code stream to modify, it is made to meet the coding type of the machine, that is, meets hardware decoder in the machine to corresponding encodedThe decoding request of mode, while modified code stream to be decoded and corresponding modification information are obtained, so that subsequent execution is correspondingHardware decoding and the display picture restoring operation to decoded video frame.
S130 treats decoded bit stream and carries out hardware decoding, obtains decoded video frame.
Optionally, after modifying to the incompatible code stream in video code flow, obtained code stream to be decoded meets the machineOn hardware decoder decoding request set when being decoded to the code stream using corresponding coding mode, that is, meet thisEach compatible code stream feature that machine is supported under corresponding coding type;It, can in the present embodiment at this time in order to improve solution bit rateHardware decoding is carried out to directly adopt the hardware decoder in the machine to the code stream to be decoded, to obtain decoded videoFrame.At this time due to the video frame be by code stream to be decoded carry out hardware decode, in the video frame at this time there may beThe place that is not consistent in the video frame carried out before compressed encoding corresponding with original video code flow, therefore subsequent also need pairThe video frame carries out corresponding adjustment, then is exported to show the corresponding normal pictures of original video code flow.
S140 adjusts decoded video frame according to modification information, obtains target video frame.
Specifically, after obtaining decoded video frame, in order to not influence compression solution corresponding to original video code flowThe normal display of video pictures before code, can also be when modifying to the incompatible code stream in video code flow in the present embodimentCorresponding modification information is saved, to determine that this modifies the influence specifically generated for the picture in decoded video frame, andDecoded video frame is adjusted by corresponding, this is eliminated and modifies the influence generated in the video frame, to obtain target videoFrame, which is correspond to original video code flow decoded video information, while by the target video frameIt is exported to be shown to user, the video pictures shown at this time are normal video pictures, can eliminate hardware decoder and existWhen compatibility is not high, the video pictures exported may be more bigger than raw frames, or there are the abnormal conditions of green side/lace etc..
Technical solution provided in this embodiment, according to code stream feature in the corresponding modification video code flow of the coding type of the machine withThe unmatched incompatible code stream of the coding type of the machine, makes modified code stream to be decoded meet the coding type of the machine, thusCarry out the hardware decoding of complete code stream, subsequent to be adjusted further according to modification information to the decoded video frame of hardware, realization pairThe video decoding answered, solve that hardware decoder in the prior art is incompatible to video code flow and software and hardware decoding in hardwareEquipment has the problem of higher customization requires, and on the basis of guaranteeing low-power consumption, improves video solution bit rate, optimizes decodingPerformance.
Embodiment two
Fig. 2 is a kind of flow chart of video encoding/decoding method provided by Embodiment 2 of the present invention.The present embodiment is in above-mentioned realityIt applies and optimizes on the basis of example.Specifically, for being modified in video code flow according to the coding type of the machine in the present embodimentThe concrete modification process of incompatible code stream carries out detailed explanation.Optionally, as shown in Fig. 2, can wrap in the present embodimentInclude following steps:
S210 obtains video code flow, and determines the code stream feature of video code flow.
S220 determines the machine to the compatibility of video code flow according to the coding type of code stream feature and the machine.
S230, compatibility are that part is compatible, determine the machine to the compatibility of the video code flow according to the coding type of the machineCharacteristic value.
Wherein, any compatible features value is that all kinds of video code flows by compressed encoding are carried out in the equipment to all kinds of modelsWhen compatibility test, the specific features size of each code stream feature supported under pre-set each coding type.
Specifically, if each compatible code stream according to the code stream feature of the video code flow with the machine under corresponding coding typeFeature determines that there are incompatible code streams in video code flow, and when the video code flow and the machine situation that belong to part compatible, isIt modifies to the incompatible code stream in the video code flow, it is necessary first to according to include in the coding type of the machine each simultaneousHold code stream feature, for each code stream feature in the video code flow, determines what the machine was supported under corresponding coding typeAny compatible features value of each code stream feature, so as to it is subsequent according to any compatible features value it is corresponding modify it is not simultaneous in the video code flowHold code stream.
S240 determines the code stream feature of incompatible code stream in video code flow according to any compatible features value.
Specifically, needing to be sentenced according to any compatible features value after obtaining the machine for any compatible features value of the video code flowThe specific code stream feature broken in this decoding process with the unmatched incompatible code stream of the coding type of the machine, so as to subsequent rightThe code stream feature of the incompatible code stream is modified.
The code stream feature modification of incompatible code stream is to be worth matched target code stream feature with any compatible features, obtained by S250Code stream to be decoded and modification information.
Specifically, when modifying the incompatible code stream in video code flow, in order to can satisfy modified video code flowEach compatible code stream feature of the machine under corresponding coding type, can be in the machine to each code stream feature pair of the video code flowIn the whole any compatible features values answered, any compatible features value corresponding with the code stream feature of incompatible code stream is found out, and this is not simultaneousThe code stream feature modification for holding code stream is to be worth matched target code stream feature with corresponding any compatible features, and by the target code stream featureIt updates in the video code flow, obtains can satisfy the code stream to be decoded of the decoding request of hardware decoder in the machine, and willThe code stream feature modification of incompatible code stream is the modification information for being worth matched target code stream feature with any compatible features, is adopted so as to subsequentDecoded bit stream is treated with the hardware decoder of the machine and carries out corresponding hardware decoding, and according to modification information to decoded videoFrame, which carries out corresponding adjustment, is not influencing video pictures just to obtain finally capable of normally showing the target video frame of video picturesOften in the case where display, solution bit rate is improved.
S260 treats decoded bit stream and carries out hardware decoding, obtains decoded video frame.
S270 adjusts decoded video frame according to modification information, obtains target video frame.
Technical solution provided in this embodiment, by being and this by the code stream feature modification of code stream incompatible in video code flowMatched target code stream feature is worth to any compatible features of the video code flow in the coding type of machine, makes modified code stream to be decodedMeet the coding type of the machine, thus carry out complete code stream hardware decoding, it is subsequent further according to modification information to hardware decoding afterVideo frame be adjusted, realize the decoding of corresponding video, it is not simultaneous to video code flow to solve hardware decoder in the prior artThere is the problem of higher customization requires, on the basis of guaranteeing low-power consumption, improve hardware device in appearance and software and hardware decodingVideo solution bit rate, optimizes decoding performance.
Embodiment three
Fig. 3 is the scene framework figure of the application scenarios for the video encoding/decoding method that the embodiment of the present invention three provides.The present embodimentIt is to optimize on the basis of the above embodiments.Specifically, as shown in figure 3, if compatibility list is deposited in advance in the present embodimentIn server-side A, a certain video code flow is stored in advance in server-side B for storage, and user needs on the smart phone of a certain modelThe corresponding video of the video code flow is played, and the video code flow carries out corresponding compressed encoding using H.264 compression and coding standard.The smart phone of the model obtains video code flow of the video after compressed encoding from server-side B first at this time, and is takingCorresponding compatibility list is inquired on business end A.The smart phone saved in the compatibility list in the present embodiment simultaneously is directed toH.264 in the coding type of code stream, the hardware decoder of the smart phone does not support corresponding deblocking filtering to operate.
Specifically, may include when modifying the incompatible code stream in video code flow according to coding type in the present embodimentFollowing steps:
S310 determines that the machine is incompatible to the deblocking filtering operation of video code flow, then obtains according to the coding type of the machineDeblocking filtering in the slice header information of video code flow closes mark.
Specifically, being analyzed by the code stream feature to H.264 code stream, it can be seen that intelligent hand in compatibility listMachine does not support the deblocking filtering in H.264 code stream to operate, other code stream features can be compatible with;Needing at this time should by analysisH.264 the slice header information in code stream, obtaining this, H.264 the deblocking filtering in the code stream feature of code stream closes mark, and judgesThe deblocking filtering closing identify whether to execute mark, the execution mark expression use smart phone on hardware decoder intoWhen row hardware decodes, need to execute video code flow corresponding deblocking filtering operation.
S320, deblocking filtering closing, which is identified as, executes mark, then deblocking filtering is closed mark and be revised as stopping executing markKnow, to cancel the deblocking filtering operation for treating decoded bit stream in hardware decoding process.
Specifically, after obtaining corresponding deblocking filtering and closing mark, it is necessary first to judge that the deblocking filtering closes markIt whether is to execute mark, if illustrating to execute mark when H.264 being encoded in advance in current H.264 code stream, it is desirable thatIt is needed when corresponding decoding to the H.264 corresponding deblocking filtering operation of code stream execution, and the hardware decoder of the smart phone is simultaneouslyIt does not support to execute deblocking filtering operation when H.264 decoding, therefore is needing to identify deblocking filtering closing in the present embodimentIt modifies, to meet the coding type of the hardware decoder on the smart phone;At this time by the H.264 code stream in the present embodimentIn deblocking filtering close mark mark is corresponding to be revised as stopping executing mark from executing, if execution is identified as " 0 ", stop holdingLine identifier is " 1 ", and the deblocking filtering in H.264 code stream is closed mark at this time and is revised as " 1 " from " 0 ", so as in subsequent useWhen hardware decoder on the smart phone carries out hardware decoding to the modified H.264 code stream, it can be filtered according to the deblockingWave closes the deblocking filtering operation that mark cancels modified H.264 code stream;This modification information is protected simultaneouslyIt deposits, to be adjusted according to the modification information to the decoded video frame of hardware subsequent, obtains final target video frame.
Correspondingly, adjusting decoded video frame according to modification information in the present embodiment, can specifically include: according to modificationInformation, which determines, is not carried out deblocking filtering operation in hardware decoding process, then executes deblocking filtering operation to decoded video frame.
Specifically, corresponding to the progress of modified H.264 code stream hard by the hardware decoder on the smart phonePart decoding, when obtaining decoded video frame, first analyzes the modification information pre-saved, detects in the present embodimentH.264 the deblocking filtering in code stream closes mark mark is corresponding to be revised as stopping executing mark from executing for this, that is, deblocking is filteredWave closes mark and is revised as " 1 " from " 0 ", it is determined that is not carried out deblocking filtering operation in hardware decoding process, therefore is obtainingWhen video frame decoded to hardware, corresponding deblocking filtering can be executed to the video frame and operated, passed through with meeting videoThe decoding request set when H.264 encoding, obtains corresponding target video frame at this time, which is normally to showVideo pictures.
In addition, in the present embodiment video encoding/decoding method can be applicable in other application scenarios, illustratively, rootIt can also include: 1) not propped up in the hardware decoder of equipment component according to the incompatible code stream in coding type modification video code flowThe sequential parameter for holding H.264 code stream is concentrated with video frame size (crop) information, can directly be concentrated at this time in sequential parameterDelete the crop information;Modified video code flow shows the right side of picture compared with original video code flow code stream in video frameSide and downside may be more some green sides, when being adjusted at this time to the decoded video frame of hardware, according to deletion shouldCrop information, which directly cuts right side and downside in corresponding video frame, can obtain corresponding target video frame, carry out video pictureThe normal display in face.2) when the code stream of caching frame number needed for the hardware decoder of equipment component reorders to missing is incompatible, byThe missing of caching frame number needed for reordering can postpone the time of output significantly and influence real-time, can be joined at this time by sequenceOther information in manifold calculates and caches frame number needed for reasonably reordering, and is inserted into the suitable position of sequence parameter setSet, at this time subsequent without being adjusted to the decoded video frame of hardware, which is target video frame, can directly intoRow video pictures are shown.3) equipment component hardware decoder possibly can not the bi-directionally referenced frame of compatible processing the problem that reorders,The only information that reorders of the bi-directionally referenced frame of corresponding record at this time, without changing code stream, when obtaining the decoded video frame of hardware,Need first to cache the output picture of a part of hardware decoder, and according to the image sequence number in the slice header information analyzed before(Picture Order Count, POC) value exports corresponding target after resequencing to the picture of caching output again and regardsFrequency frame, avoids video pictures from shaking.
Video encoding/decoding method in the present embodiment can be applicable in various other application scenarios, herein not one by one intoRow explanation.
Technical solution provided in this embodiment, according to code stream feature in the corresponding modification video code flow of the coding type of the machine withThe unmatched incompatible code stream of the coding type of the machine, makes modified code stream to be decoded meet the coding type of the machine, thusCarry out the hardware decoding of complete code stream, subsequent to be adjusted further according to modification information to the decoded video frame of hardware, realization pairThe video decoding answered, solve that hardware decoder in the prior art is incompatible to video code flow and software and hardware decoding in hardwareEquipment has the problem of higher customization requires, and on the basis of guaranteeing low-power consumption, improves video solution bit rate, optimizes decodingPerformance.
Example IV
Fig. 4 is a kind of structural schematic diagram for video decoder that the embodiment of the present invention four provides, specifically, such as Fig. 4 instituteShow, the apparatus may include:
Code stream obtains module 410, for obtaining video code flow;
Code stream modified module 420 is obtained for modifying the incompatible code stream in video code flow according to the coding type of the machineCode stream to be decoded and modification information, the incompatible code stream are code stream feature and the unmatched code stream of coding type;
Hardware decoder module 430 carries out hardware decoding for treating decoded bit stream, obtains decoded video frame;
Video framing control module 440 obtains target video frame for adjusting decoded video frame according to modification information.
Technical solution provided in this embodiment, according to code stream feature in the corresponding modification video code flow of the coding type of the machine withThe unmatched incompatible code stream of the coding type of the machine, makes modified code stream to be decoded meet the coding type of the machine, thusCarry out the hardware decoding of complete code stream, subsequent to be adjusted further according to modification information to the decoded video frame of hardware, realization pairThe video decoding answered, solve that hardware decoder in the prior art is incompatible to video code flow and software and hardware decoding in hardwareEquipment has the problem of higher customization requires, and on the basis of guaranteeing low-power consumption, improves video solution bit rate, optimizes decodingPerformance.
Further, above-mentioned code stream modified module, can be specifically used for:
Determine the code stream feature of video code flow;Determine the machine to video code flow according to the coding type of code stream feature and the machineCompatibility;Compatibility is that part is compatible, then the incompatible code stream in video code flow is modified according to coding type.
Further, above-mentioned code stream modified module, can also be specifically used for:
Determine the machine to any compatible features value of video code flow according to the coding type of the machine;It is determined and is regarded according to any compatible features valueThe code stream feature of incompatible code stream in frequency code stream;It is to be worth matched mesh with any compatible features by the code stream feature modification of incompatible code streamCoding stream feature.
Further, above-mentioned code stream modified module, can also be specifically used for:
Determine that the machine is incompatible to the deblocking filtering operation of video code flow, then obtains video codes according to the coding type of the machineDeblocking filtering in the slice header information of stream closes mark;Deblocking filtering closing, which is identified as, executes mark, then closes deblocking filteringIt closes mark to be revised as stopping executing mark, to cancel the deblocking filtering operation for treating decoded bit stream in hardware decoding process;
Correspondingly, upper video framing control module, can be specifically used for:
It is determined according to modification information and is not carried out deblocking filtering operation in hardware decoding process, then decoded video frame heldThe operation of row deblocking filtering.
Further, the code stream feature of above-mentioned video code flow can pass through the sequence header information to video code flow, image groupAt least one in head information, picture header information and slice header information carries out parsing determination.
Further, above-mentioned video decoder can also include:
Coding type determining module, for according to the coding type of the machine modify video code flow in incompatible code stream itBefore, according to the type of coding of video code flow, matched coding type is searched in the compatibility list prestored.
Video decoder provided in this embodiment is applicable to the video encoding/decoding method that above-mentioned any embodiment provides, toolStandby corresponding function and beneficial effect.
Embodiment five
Fig. 5 is a kind of structural schematic diagram for equipment that the embodiment of the present invention five provides, as shown in figure 5, the equipment includes placeManage device 50, storage device 51, communication device 52, input unit 53 and output device 54;The quantity of processor 50 can be in equipmentBe it is one or more, in Fig. 5 by taking a processor 50 as an example;Processor 50, storage device 51, communication device 52 in equipment,Input unit 53 can be connected with output device 54 by bus or other modes, in Fig. 5 for being connected by bus.
Storage device 51 is used as a kind of computer readable storage medium, and it is executable to can be used for storing software program, computerProgram and module, the corresponding program instruction/module of video encoding/decoding method as described in any embodiment of that present invention.Processor 50By running the software program, instruction and the module that are stored in storage device 51, thereby executing the various function application of equipmentAnd data processing, that is, realize above-mentioned video encoding/decoding method.
Storage device 51 can mainly include storing program area and storage data area, wherein storing program area can store operationApplication program needed for system, at least one function;Storage data area, which can be stored, uses created data etc. according to terminal.It can also include nonvolatile memory in addition, storage device 51 may include high-speed random access memory, for example, at least oneA disk memory, flush memory device or other non-volatile solid state memory parts.In some instances, storage device 51 canIt further comprise the memory remotely located relative to processor 50, these remote memories can be by network connection to settingIt is standby.The example of above-mentioned network includes but is not limited to internet, intranet, local area network, mobile radio communication and combinations thereof.
Communication device 52 can be used for realizing the network connection or mobile data cube computation of equipment room.
Input unit 53 can be used for receiving the number or character information of input, and generate with the user setting of equipment andThe related key signals input of function control.
Output device 54 may include that display screen etc. shows equipment.
A kind of equipment provided in this embodiment can be used for executing the video encoding/decoding method that above-mentioned any embodiment provides, and haveCorresponding function and beneficial effect.
Embodiment six
The embodiment of the present invention six additionally provides a kind of computer readable storage medium, is stored thereon with computer program, shouldProgram can realize the video encoding/decoding method in above-mentioned any embodiment when being executed by processor.This method can specifically include:
Obtain video code flow;
The incompatible code stream in the video code flow is modified according to the coding type of the machine, obtains code stream to be decoded and modificationInformation, the incompatible code stream are code stream feature and the unmatched code stream of the coding type;
Hardware decoding is carried out to the code stream to be decoded, obtains decoded video frame;
The decoded video frame is adjusted according to the modification information, obtains target video frame.
Certainly, a kind of storage medium comprising computer executable instructions, computer provided by the embodiment of the present inventionVideo decoding provided by any embodiment of the invention can also be performed in the method operation that executable instruction is not limited to the described aboveRelevant operation in method.
By the description above with respect to embodiment, it is apparent to those skilled in the art that, the present inventionIt can be realized by software and required common hardware, naturally it is also possible to which by hardware realization, but in many cases, the former is moreGood embodiment.Based on this understanding, technical solution of the present invention substantially in other words contributes to the prior artPart can be embodied in the form of software products, which can store in computer readable storage mediumIn, floppy disk, read-only memory (Read-Only Memory, ROM), random access memory (Random such as computerAccess Memory, RAM), flash memory (FLASH), hard disk or CD etc., including some instructions are with so that a computer is setStandby (can be personal computer, server or the network equipment etc.) executes method described in each embodiment of the present invention.
It is worth noting that, included each unit and module are only pressed in the embodiment of above-mentioned video decoderIt is divided, but is not limited to the above division according to function logic, as long as corresponding functions can be realized;In addition,The specific name of each functional unit is also only for convenience of distinguishing each other, the protection scope being not intended to restrict the invention.
The above description is only a preferred embodiment of the present invention, is not intended to restrict the invention, for those skilled in the artFor, the invention can have various changes and changes.All any modifications made within the spirit and principles of the present invention are equalReplacement, improvement etc., should all be included in the protection scope of the present invention.