Summary of the invention
In view of this, the objective of the invention is to, propose a kind of code stream analyzing method and device, can analyze the multimedia code stream that meets various coding standards commonly used.
A kind of code stream analysis device that the embodiment of the invention proposes comprises:
The decoder storehouse, by forming more than one decoder and unified interface unit, each decoder is used for a kind of coded format code stream is decoded, and extracts the data in the code stream; Said unified interface unit comprises recognition interface unit, parameter set information interface unit, main information interface unit and main node decoding interface unit at least, and the recognition interface unit is used for the form according to the attribute information identification code stream of code stream; The parameter set information interface unit is used for exporting the data of extracting from code stream; Main information interface unit is used for the main node of decoded bit stream and the upper layer node of main node, lists the grammatical levels structural information of code stream; Said main node is a preassigned n node layer in the bit stream syntax level, and n is a natural number; Main node decoding interface unit is used for the lower level node of current main node of choosing and the said current main node of choosing is decoded;
Assembly module; Call said recognition interface unit and select corresponding decoder; And according to operation indication from subscriber interface module; Call the unified interface unit in decoder storehouse, and receive data, export said data to subscriber interface module from the parameter set information interface unit output in decoder storehouse;
Subscriber interface module is used to provide the user visible human-computer interaction interface, receives the operation indication from the user, exports said operation indication to assembly module; And on said human-computer interaction interface, show data from assembly module.
Said assembly module further comprises: analytic unit is used for exporting analysis result to subscriber interface module to analyzing from the data in decoder storehouse.
Said assembly module can further include: statistic unit is used for calculating carry out ASSOCIATE STATISTICS from the data in decoder storehouse, and exporting result of calculation to subscriber interface module according to defining in advance or user-defined formula.
Said code stream is a video code flow, and said main node is the corresponding syntactic structure node of frame.
Said assembly module further comprises: editor module is used for according to user instruction, to making amendment from the header information in the data in decoder storehouse;
Said unified interface unit further comprises: preserve the file interface unit, be used for the modification according to said editor module enforcement, amended code stream is preserved.
Said unified interface unit also comprises: close the interface decoder unit, be used to discharge the software and hardware resources that decoder uses.
Said unified interface unit also comprises: the DECODER information interface unit is used for providing the relevant information of decoder decode process.
Said subscriber interface module further comprises:
The bitstream layers aggregated(particle) structure is represented the interface, representes the syntactic structure of code stream with tree; Or
The data list interface has provided the semanteme of each parameter of code stream with form; Or
Decoded result is represented the interface, uses the image shows decoded result.
A kind of code stream analyzing method that the embodiment of the invention proposes comprises the steps:
According to the attribute information of the code stream of importing, from the decoder that matees more than selection one the decoder and this attribute information;
With selected decoder said code stream is decoded, extract the data in the code stream; Comprising the main node in the decoded bit stream and the upper layer node of main node, list the grammatical levels structural information of code stream; Said main node is a preassigned n node layer in the bit stream syntax level, and n is a natural number;
On the visible human-computer interaction interface of user, show the data of said extraction in code stream.
The said step of the data of said extraction in code stream that on the visible human-computer interaction interface of user, shows comprises:
Said data are analyzed display analysis result on human-computer interaction interface.
The said step of the data of said extraction in code stream that on the visible human-computer interaction interface of user, shows comprises:
According to defining in advance or user-defined formula, said data are carried out ASSOCIATE STATISTICS calculate, on human-computer interaction interface, show result of calculation.
The said grammatical levels structural information of listing code stream further comprises afterwards:
The main node that the user is selected is decoded to the lower level node of current main node as current main node.
Saidly on the visible human-computer interaction interface of user, show after the data of said extraction in code stream, further comprise:
Header information in the said data is made amendment, and preserves amended code stream.
Can find out from above technical scheme; Multiple decoder is set in the code stream analysis device; Adopt uniform platform to move various decoders, automatically identify corresponding decoder for the code stream of importing and decode, thereby the multimedia code stream of multiple coding standard is supported in realization.Further, the present invention adopts the mode of decoding as required, can accurately respond user's analyze demands, and greatly promote the operational efficiency of instrument; The present invention program can carry out operations such as Information Statistics, code stream editor on the basis that bit stream data is analyzed, enriched the function of code stream analysis more.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, the present invention is done further to set forth in detail below in conjunction with accompanying drawing.
The structured flowchart of the code stream analysis device that the embodiment of the invention proposes is as shown in Figure 1, and this code stream analysis device mainly comprises decoder storehouse 101, assembly module 102 and subscriber interface module 103.
Decoder storehouse 101 comprises the decoder more than, and the code stream of the corresponding a kind of form of each decoder is used for the code stream of this form is decoded, and extracts the data in the code stream.Said data comprise the multimedia decoding data of from bit stream data bag payload, extracting, and the relevant information of from bit stream data packet header, extracting.H.264 said code stream form can include but not limited to, mpeg1, mpeg2, mpeg4, mp3, mp4, wmv etc.Each decoder provides unified interface unit; Said interface unit comprises recognition interface unit and parameter set information interface unit at least, and the recognition interface unit is used for the form according to the attribute information identification code stream of code stream; The parameter set information interface unit is used for the data that externally output is extracted from code stream.
Assembly module 102 is used to call decoder recognition interface unit and selects corresponding decoder; And according to operation indication from subscriber interface module 103; Call the interface unit of decoder storehouse 101 correspondences; And receive data from decoder storehouse 101, export said data to subscriber interface module 103.
Assembly module 102 provides following functional unit to realize analysis, statistics, edit operation:
Analytic unit is used for decoded data is analyzed, and shows the relevant parameter information of decoded data, for example, shows the size of current frame image, encoding compression efficient.
Statistic unit; Be used for according to defining in advance or user-defined formula; Carry out ASSOCIATE STATISTICS calculating according to decoded data and/or header information, and represent interface or data list interface display result of calculation, account for the ratio of whole frames such as the frame of particular type in the statistics code stream in the code stream result.Frame type comprises I type, P type and category-B type.
Edit cell is used for header information is made amendment, such as the timestamp (time_stamp) of change present frame.
Subscriber interface module 103 is used to provide the user visible human-computer interaction interface, and bit stream data is showed visually, receives the operation indication from the user, exports said operation indication to assembly module 102; And on said human-computer interaction interface, show data from assembly module 102.
The main interface that subscriber interface module 103 is shown is divided into three parts, is respectively that the bitstream layers aggregated(particle) structure representes that interface 201, data list interface 202 and decoded result represent interface 203, and is as shown in Figure 2.Wherein, the bitstream layers aggregated(particle) structure representes that interface 201 usefulness trees have represented the syntactic structure of the code stream that desire is analyzed, and data list interface 202 usefulness forms have provided the semanteme of each parameter of code stream, decoded result represented interface 203 usefulness image shows decoded result.
The multimedia coding data have the high characteristics of compression ratio, and decoding is a process that quite expends computational resource.Below be the design feature of example explanation multimedia code stream with common mpeg4 form.Fig. 3 has provided the grammatical levels structure of mpeg4 form code stream visually according to mpeg4 video code flow standard-ISO/IEC 14496-2.Among the figure; Mpeg4 ASP Bitstream has represented a code stream that meets mpeg4 ASP profile; VOSi has represented i the visual object sequence (Visual Object Sequence) of this code stream; VOi has represented i the visual object (Visual Object) among the VOSi, and VOLi has represented i visual object layer among the VOi (Video Object Layer), and VOPi has represented i visual object plane among the VOLi (Video Object Plane); MBi has represented i the macro block (Macro Block) among the VOPi, and SB1 has represented six sub-block (Sub-Block) among the MBi to SB6.Multi-medium data all has the similar bit stream syntax hierarchical structure with Fig. 3, and this is by various compression standard defineds.
The mode of available technology adopting is normally only analyzed a part of content in the code stream, for example analyzes content and is limited to file header and data packet head; Perhaps, only analyze the bitrate information of code stream.The data that from code stream, obtain like this have great limitation.The present invention program can analyze the full detail in the code stream, but adopts the mode of analyzing as required in order to practice thrift computational resource.The present invention is called " node " or " syntactic node " with each unit on all types of multi-medium data syntactic structures.The node that comprises many levels in the code stream, and wherein a certain node layer is defined as " backbone nodes " perhaps " main node ".For example in video code flow, the pairing node of frame is called " backbone nodes " perhaps " main node ", in Fig. 3, the pairing node of frame is VOP.
The decoder storehouse has comprised the decoder more than, and by the demand of calling of assembly module, these decoders will be decoded to code stream.The decoder storehouse of the embodiment of the invention has comprised H.264 decoder, mp3 decoder, mpeg1/2 decoder, jpeg decoder.A plurality of interface units have been designed in each decoder storehouse.For each decoder, all should have following interface unit:
Therefore the recognition interface unit: each code stream belongs to one type of coding standard, and every kind of code stream all has unique initial code to identify oneself to belong to which kind of coded format, and this initial code is the described attribute information of preamble.For example, hexadecimal number 0x000001B0 is the initial code of Visual Object Sequence, has identified the beginning of a VOS of mpeg4 code stream.Decoder will support according to self coded format judge whether this decoder supports the decoding of current code stream.
Main information interface unit: the main node in the decoded bit stream and the upper layer node of main node, list the grammatical levels structural information of code stream;
Main node decoding interface unit: the current main node of choosing of decoding; If also have the bit stream syntax level under this node; Decode node on these levels, such as main node---also have Macro Block and Sub-Block two-layer node under the frame;
The parameter set information interface unit: each node all has its different parameter set information, and voice data also has the tonepulse data message, and video also has image data information, and this interface of decoder will provide these information;
Preserve the file interface unit: decoder is operated the code stream of preserving after being modified according to the user;
DECODER information interface unit: be used for providing the relevant information of decoder decode process, so that realize wrong control, functions such as decoded state control.For example, decoder can be exported the error status value when makeing mistakes; Consuming time when longer in decoding, can the decoding progress be provided through this interface.
Close the interface decoder unit: when replacing decoder or closing analysis tool, discharge the software and hardware resources that decoder uses;
Can know that by above description the multi-medium data hierarchy is complicated, the decode procedure consumes resources.In view of this, the present invention is designed to the mode of carrying out as required with the operational process of code stream analysis device, and is as shown in Figure 4, comprises the steps:
Step 401: opening stage: according to the attribute information of the code stream of importing, from the decoder that matees more than selection one the decoder and this attribute information; With selected decoder said code stream is decoded, extract the data in the code stream;
Step 402: analysis phase: on the visible human-computer interaction interface of user, show the data of said extraction in code stream.
Step 403: dwell period: close ASCII stream file ASCII, close decoder, the resource that takies during the release procedure operation.If the user edits code stream, then the content of revising is preserved.
Below through a specific embodiment process of decode procedure is as required specified.The idiographic flow of the embodiment of the invention is as shown in Figure 5, comprises the steps:
Step 501:, select decoder with this attribute information coupling according to the attribute information of the code stream of importing.
The embodiment of the invention is when realizing each decoder, and each decoder all comprises a recognin module, is used to judge whether the attribute information of the code stream of input matees with this decoder.Assembly module selects to support the decoder of this code stream through calling the recognin module of each decoder.When find can support the decoder of current code stream after, assembly module will call this decoder code stream is analyzed, follow-up decoding action is all accomplished by this decoder; If the neither one decoder can be supported current code stream, then this code stream is not supported in expression, shows corresponding prompt information through subscriber interface module.
Step 502: the decoder by the current code stream of said support obtains the main information of code stream.
The main information of code stream can be defined separately by each decoder, generally can be defined as: the relevant information of the upper layer node of main node and main node.Such as for video code flow, the main information definition of code stream is at frame and the level more than the frame, especially, mpeg4 ASP Bitstream with the main information definition of code stream four layers of VOP, VOL, VO, VOS.Therefore decoding complex degree when this definition has determined to open code stream first is one of factor that influences instrument efficient.
Step 503: present node is confirmed in the selection according to the user, judges according to predefined main node whether present node is main node, if execution in step 504 then, otherwise go to step 505.
Embodiment is following: the user representes some nodes of showing in the interface with click bitstream layers aggregated(particle) structure; Subscriber interface module sends to assembly module with the information that the user clicks node; After assembly module is received the information of subscriber interface module; The node that the user is clicked calls and supports the decoder of current code stream to judge whether present node is its defined main node, and decoder returns judged result to assembly module as present node.
Step 504: assembly module calls decoder and obtains the child node information under the current main node.Present embodiment is as shown in Figure 3, and main node can comprise two-layer child node.
Step 505: assembly module calls decoder to decoding when front module, obtains the header information and the data of decoding and obtaining of syntactic node.Each syntactic node of code stream all has corresponding header information, just has frame type (picture_type), timestamp (time_stamp), width (width), header informations such as (height) highly like the VOL node of mpeg4 ASP Bitstream.The data that obtain of decoding, what decode out such as audio code stream is the pulse code modulation Wave data, what video code flow decoded out is the view data of a certain chrominance space.
Step 506: to header information and data analyze, statistics and/or edit operation.After head information and decoded data were obtained, header information can be with the presented of character string at the data list interface, and decoded data is represented the interface with the presented of waveform or image in the code stream result.
Step 507:, when the copy of revising the back ASCII stream file ASCII is preserved in request then, preserve amended ASCII stream file ASCII when the user has carried out the edit operation of code stream.This step is only carried out when the user has carried out the code stream edit operation, is optional step.
Step 508: the user continues to click the bit stream syntax node and analyzes, and flow process will forward step 503 to this moment, if the user does not click other bit stream syntax nodes, then execution in step 509.
Step 509: after the user selects to withdraw from, assembly module will discharge decoder resources, close decoder, resource when discharging operation, and quit a program.
The code stream analyzing method that the present invention proposes can be analyzed multiple audio file, video file and view data with device.Code stream information is showed the user intuitively, and for audio file, parameter such as sample rate that can Study document, code check is analyzed the value of each sampled point; For video file, can read parameters such as encoder, frame type, macro block (mb) type, can observe motion vector, macro block chrominance space data or the like the information of image, each macro block of every frame.
Among the present invention program, the framework of code stream analysis device comprises user's action pane, assembly and decoder storehouse, has solved multiple decoder, numerous types of data well in identical platform operation and shared problem.The solution of this problem can promote the compatibility and the function of code stream analysis device.On flow scheme design, adopt the mode of " decoding as required ", can accurately respond user's analyze demands, and greatly promote operational efficiency.The present invention for decoder design 7 interfaces, unified the decoder of different code streams form, code stream analysis, Information Statistics, code stream editor's function is provided.According to analysis, Information Statistics and the code stream editor of code stream analysis scheme support bit stream data of the present invention, feature richness, the compatible characteristics of getting well and being easy to expand are arranged.
Description through above execution mode; Those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential hardware platform; Can certainly all implement, but the former is better execution mode under a lot of situation through hardware.Based on such understanding; All or part of can the coming out that technical scheme of the present invention contributes to background technology with the embodied of software product; This computer software product can be stored in the storage medium, like ROM/RAM, magnetic disc, CD etc., comprises that some instructions are with so that a computer equipment (can be a personal computer; Server, the perhaps network equipment etc.) carry out the described method of some part of each embodiment of the present invention or embodiment.
The above is merely preferred embodiment of the present invention, not in order to restriction the present invention, all any modifications of within spirit of the present invention and principle, being done, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.