Background technology
MPEG (Moving Pictures Experts Group, Motion Picture Experts Group; The Active-Movie compression standard) compressed format of a kind of system that is formulated for International Standards Organization (ISO), video, sound generally can be divided into three kinds of specification: MPEG-1, MPEG-2, and MPEG-4.Wherein, be most widely used with MPEG-1 and MPEG-2.
MPEG-1 be 1988 by ISO/IEC for dynamic video and compression criterion that voice compression proposed, and be widely used on CD-ROM promptly usually said video disc (VCD).MPEG-2 then is based on MPEG-1, and has increased the Video Applications scope, so MPEG-1 is the different of message transmission rate and application with the difference of the maximum of MPEG-2.
With MPEG-1 is example, and its defined resolution is 352 * 240, be equivalent to the image quality of general VHS, and its message transmission rate is 1.5Mb/s.MPEG-2 possesses 720 * 480 resolution is arranged, and can have the transmission rate of 10Mb/s, so MPEG-2 is better than the image quality of MPEG-1, but data volume also significantly increases.In recent years, owing to possess the appearance of the DVD (digital video disk) of high storage capacity, make MPEG-2 except the application category of hd-tv (HDTV), more general popular institute generally accepts and uses.
Be presented in face of the user via the data after the MPEG compression in order to make, so often need use to possess the software or the hardware of decoding function.Particularly support to play on the information household appliances platform of VCD, DVD general, for the consideration on the manufacturing cost, usually the processor of adopting lower-order, then needs to realize with other hardware decoding circuit as for the bigger video decode part of operand as handling core.
No matter consult Fig. 1, be MPEG-1 or the video data of MPEG-2, and its decoding step is all: and length-changeable decoding (Variable Length Decoding, VLD) → inverse quantization computing (InverseQuantization, Q
-1) → reverse discrete cosine transform coding (Inverse, IDCT) → (Motion Compensation MC) waits four steps to dynamic compensation.In order to possess MPEG-1 and MPEG-2 decoding function simultaneously, so corresponding above-mentioned each step is provided with two groups of different circuit box in decoding circuit, one group of decoding (circuit box 11~14) of being responsible for MPEG-1 data flow (datastream), another group then is responsible for the decoding (circuit box 21~24) of MPEG-2 data flow.
Zui Jia method for designing is the circuit that makes MPEG-1 identical with the data sharing of MPEG-2 ideally, to reach cost-effective purpose.Yet, though conceptive MPEG-2 is the superset (super set) of MPEG-1, but because MPEG-1 and the definition of MPEG-2 on implementation detail and incomplete same, therefore corresponding to the decoding circuit of each step among Figure 11, except higher can the migrating mutually of similarity of reverse discrete cosine change-over circuit (IDCT) part, remaining circuit also can't fully directly be shared, and therefore at present in order to possess the decoding function of MPEG-1 and MPEG-2 simultaneously, all adopts separate design shown in Figure 11.
On the other hand, for the burden of saving the part hardware cost and avoiding increasing processor, also there is the variable-length that the front end operand is lower (VLD) decoding to transfer to that software carries out, yet, nonetheless, also need decoding circuit separate design, therefore only can solve subproblem but not best solution MPEG-1 and MPEG-2.
Summary of the invention
The technical problem to be solved in the present invention is that providing a kind of is the conversion method of MPEG-2 data format with the MPEG-1 Data Format Transform.Above-mentioned technical problem solves by a kind of mpeg data format conversion method, and the method comprising the steps of: A) receive a MPEG-1 data flow; Step B) change sequence gauge outfit, image sets (GOP) gauge outfit of this MPEG-1 data flow, and image (PIC) gauge outfit is corresponding MPEG-2 gauge outfit; And step C) shines upon the view data that view data in this MPEG-1 data flow becomes the MPEG-2 form.
In a kind of expansion design of the present invention, above-mentioned steps B) also comprise following substep: B1) the sequence gauge outfit of this MPEG-1 data flow is inserted the sequence gauge outfit that a sequence extension field data makes it to become a MPEG-2 form; B2) delete the image sets gauge outfit of this MPEG-1 data flow; And B3) the image gauge outfit of this MPEG-1 data flow is inserted the image gauge outfit that an image spreading field data makes it to become a MPEG-2 form.
In another kind of expansion design of the present invention, above-mentioned steps C) also comprise following substep: C1), view data is carried out length-changeable decoding and made it to become a sequence signal corresponding to a MPEG-1 variable length code table; And C2) corresponding to a MPEG-2 variable length code table, this sequence signal is carried out variable length code and becomes the MPEG-2 view data.
In the method for the invention, described view data has a plurality of picture bars, and wherein each has a plurality of grand picture pieces as bar, and its each grand picture piece has a plurality of picture pieces.
Another technical problem that the present invention will solve is, a kind of decode system that utilizes above-mentioned mpeg data format conversion method is provided, and it only needs one group of MPEG-2 decoding circuit promptly can decode to MPEG-1 data flow and MPEG-2 data flow.
This technical problem is to solve by a kind of decode system of above-mentioned mpeg data form method that utilizes, and this decode system comprises a conversion equipment and a decoding device.
This conversion equipment is used for a MPEG-1 data flow is converted to a MPEG-2 data flow, and has a converting unit and a map unit that couples mutually.This converting unit can receive this MPEG-1 data flow, and with sequence layer gauge outfit, image sets layer gauge outfit in this MPEG-1 data flow, and the gauge outfit of image layer is converted to corresponding MPEG-2 gauge outfit form.Map unit then is the MPEG-1 data flow that receives after this converting unit conversion, and the view data of the MPEG-1 data flow after will changing carries out variable-length (VLD) and decode, and makes it to become the MPEG-2 view data.Described decoding device receives this MPEG-2 data flow and it is decoded as initial data.
In decode system of the present invention, described map unit has a MPEG-1 variable length code table, and a MPEG-2 variable length code table.
In decode system of the present invention, described map unit is according to this MPEG-1 variable length code table, this view data is carried out length-changeable decoding and made it to become a sequence signal, and according to this MPEG-2 variable length code table this sequence signal is encoded to the view data of MPEG-2 form again.
In decode system of the present invention, described decoder module is a MPEG-2 decoding circuit.
Technical problem of the present invention also solves by a kind of electronic installation with video playback capability, and it comprises: a read module, in order to read a MPEG-1 or a MPEG-2 data flow; One modular converter, in order to a MPEG-1 data flow is converted to a MPEG-2 data flow, this modular converter has: a converting unit, receive this MPEG-1 data flow, and with the gauge outfit of sequence layer in this MPEG-1 data flow, the gauge outfit of image sets layer, and the gauge outfit of image layer is converted to corresponding MPEG-2 gauge outfit form; One map unit receives the MPEG-1 data flow after this converting unit conversion, and the view data of the MPEG-1 data flow after this conversion is carried out variable-length (VLD) decode and make it to become the MPEG-2 view data; This device also comprises a decoder module, receives from the MPEG-2 data flow one of in this read module and this map unit and decoded to make it to become an initial data; With a display, in order to show this initial data.
In addition, in described electronic installation, described converting unit is inserted the sequence gauge outfit that a sequence extension field data makes it to become a MPEG-2 form, the image sets gauge outfit of deleting this MPEG-1 data flow with the sequence gauge outfit of this MPEG-1 data flow, and the image gauge outfit of this MPEG-1 data flow is inserted the image gauge outfit that an image spreading field data makes it to become a MPEG-2 form.This map unit has a MPEG-1 variable length code table, and a MPEG-2 variable length code table.In addition, this map unit is according to this MPEG-1 variable length code table, this view data is carried out length-changeable decoding and made it to become a sequence signal, and according to this MPEG-2 variable length code table this sequence signal is encoded to the view data of MPEG-2 form again.Wherein, described decoder module is a MPEG-2 decoding circuit.
Embodiment
Consult Fig. 2, in the data flow (datastream/bitstream) of MPEG (MPEG-1/MPEG-2), its data structure is all by being made of one or more sequence (sequence), among each sequence, then comprised a plurality of image sets (picture of group, GOP).So-called image sets refers to by many images (picture) and (or claims picture, the frame) group that is constituted, and picture can be divided into three kinds according to its function: interactive picture (I frame), predictive picture (P frame), and bi-directional picture (B frame) image.Because the continuous broadcast of picture, in face of the user be dynamic image so be presented on.
Each picture can be subdivided into a plurality of picture bars (slice) again, as can be further divided into again in the bar several grand picture pieces (MacroBlock, MB).And grand picture piece can be made up of as piece as piece and several chromas (Chrominance) four brightness (Luminance), and last, each has 8 * 8 pixels as piece (block), and is defined as the minimum code unit in the mpeg data structure.
In the MPEG compression standard, each picture is a main coding unit, particularly for interactive picture, because predictive picture is to carry out action prediction with interactive picture as the reference picture, and bi-directional picture is that the two is used as reference picture with interactive picture and predictive picture, so all with the cutting point of interactive picture as initial video compression.
Therefore, when one original video data is compressed with MPEG-1 or MPEG-2 form, be earlier in the interactive picture each to be defined out as piece, then each pixel data as piece is carried out discrete cosine transform (DCT), promptly pixel data is converted to frequency domain from time domain, and gets rid of the more insensitive HFS of human eye.Then quantized (quantization) again, made that many DCT coefficient quantizations through discrete cosine transform are zero.Then rearrange with staggered DCT coefficient after scanning (zig-zag scan) and will quantizing again, be arranged in low frequency coefficient preceding and after high frequency coefficient is arranged in.At last in the staggered DCT coefficient that scanned, the DCT coefficient is carried out modulating differential signals coding (DPCM), and the AC coefficient carried out run length encoding (run length encoding, RLE), again the two is carried out variable length code (variable length c oding at last, VLC), promptly finish the compression of MPEG-1/MPEG-2 form.
Consult Fig. 3, therefore, in the mpeg standard framework, data can be divided in regular turn sequence layer (sequence layer), image sets layer, image layer, as bar layer, grand picture piece layer and picture piece layer.In each layer data, all comprise gauge outfit (header) and data content.For example in sequence layer, each sequence comprises a sequence gauge outfit and a sequence data, wherein, the sequence gauge outfit has been put down in writing relevant mpeg information, for example initial code (start code), stream identification code (stream ID), video parameter (video parameter), bit stream parameter (bitstream parameter) or the like, the sequence data of following after the sequence gauge outfit has then comprised a plurality of image sets (GOP0, GOP1, GOP2......).Certainly, as shown in the figure, each image sets layer can be divided into image sets gauge outfit and image sets data again, and each image sets data has comprised several images (PIC1, PIC2, PIC3......), so segmentation is gone down, and arrives as the piece layer least unit of just encoding at last.Certainly, in the gauge outfit of each layer, all put down in writing the different relevant information of each layer, for the purpose of simplified illustration, do not add to describe in detail at this, but it will be apparent to those skilled in the art that above-mentioned data is all clear as to be documented in ISO/IEC 11172 specifications of MPEG-1, and in ISO/IEC 18838 specifications of MPEG-2.
Therefore,, consult Fig. 4, in first preferred implementation, the invention provides a kind of mpeg data format conversion method, the data flow of MPEG-1 can be converted to the data flow of MPEG-2, and carry out according to following step following under the prerequisite of this standard architecture:
At first, shown in step 31, accept a MPEG-1 data flow, this data flow can obtain from a storage medium (for example hard disk, discs), or obtains by the transmission of internet or other related communication devices.
Then,, change sequence gauge outfit, the image sets gauge outfit of this MPEG-1 data flow, and the image gauge outfit makes it to become corresponding MPEG-2 gauge outfit form, be described in detail as follows at this as step 32.
As previously mentioned, because MPEG-2 is the superset of MPEG-1, so when the definition MPEG-2 of International Standards Organization (ISO) form, promptly made MPEG-2 except the form that possesses MPEG-1, the data format that has also increased many expansions (extension) is to increase its range of application.
So in this step 32, cooperate shown in Fig. 5 (A), after receiving the MPEG-1 data flow, owing to be the sequence gauge outfit of reading in MPEG-1 earlier, and we know, the difference of MPEG-2 and MPEG-1 sequence gauge outfit is: increased sequence extension (sequenceextension) in the sequence gauge outfit of MPEG-2 and shown expansion (display extension) field, but owing to show that extended field is one optional (optional) field, so for simplicity, only insert the sequence gauge outfit that sequence gauge outfit that extended field makes MPEG-1 is converted to MPEG-2 at this.
It more is described in detail in detail, comprised in the sequence extension field " expansion initial code " (extension start code), " describe and layer " (profile and level), " asymptotic expression sequence " (progressive sequence), " chroma format " (chroma format), " vertical size " (vertical size), " horizontal size " (horizontalsize) ... etc. son field.So in this preferred implementation, be that " expansion initial code " 4 positions are inserted 0001 to meet the MPEG-2 form.And because the MPEG-1 format compatible in the Main@Main of MPEG-2, is appointed as main profile and main level so will " describe and layer ".And be meant aspect " asymptotic expression sequence " that MPEG-2 can specify two kinds of output formats (asymptotic expression and non-asymptotic expression) selective, but,, just be appointed as asymptotic expression output so " asymptotic expression sequence " is set at 1 because MPEG-1 only supports asymptotic expression.
" chroma format " is meant the expression mode of picture color, and available color representation pattern has three kinds of 4:2:0,4:2:2 and 4:4:4 in MPEG-2.But in the MPEG-1 form, owing to only can use the expression mode of 4:2:0, so " chroma format " is set at 4:2:0.And aspect " vertical size " and " horizontal size ", because in the MPEG-1 form, the size of picture is only represented with 12, the MPEG-2 form then further is extended for 14 and represents, and these extra two put in " vertical size " and " horizontal size " field, get final product so at this " vertical size " and " horizontal size " are inserted 0.
Then, after the sequence gauge outfit of MPEG-1 has been converted to the sequence gauge outfit of MPEG-2, again because the sequence data that is positioned at after the sequence gauge outfit includes a plurality of image sets, and each image sets comprises an image sets gauge outfit and an above view data, so shown in Fig. 5 (B), again the image sets data of MPEG-1 image sets layer are handled, and because in the image sets layer of MPEG-2, the image sets gauge outfit has been non-essential (optional), so in this layer, be that the image sets gauge outfit of MPEG-1 is left out to be converted to the image sets layer data of MPEG-2.
Further, shown in Fig. 5 (C), in image layer, be similar to the notion of above-mentioned sequence layer, in this image gauge outfit, insert image encoding expansion (PIC coding extension) field to be converted to the image gauge outfit of MPEG-2 with MPEG-1.Certainly, this image encoding extended field include " forward level code " (f_hor_cod), " forward vertically coding " (f_ver_code), " reverse level code " (b_hor_code), " reverse vertical coding " (b_ver_code) ... etc. son field.Owing to only have one group forward encode (f_code) to do the vector calculation of dynamic compensation in the MPEG-1 form, then be extended for two groups of vertical vector and horizontal vectors among the MPEG-2, so only need the forward encoded content in the MPEG-1 image gauge outfit is copied in this image encoding field at this, the image gauge outfit of MPEG-1 can be converted to the image gauge outfit of MPEG-2.
Therefore as shown in table 1, it is the sequence layer at MPEG-1, image layer that expression gets via arrangement, and in the image layer, the field that increase newly or leave out:
Yet what need indicate is, in the extended field of above-mentioned sequence, also have such as " horizontal size expansion " (hor_size ext.), " vertical size expansion " (ver_size ext.), " bit rate expansion " (bitrate ext.) ... etc. son field; And still have in the image spreading field " inner dc prediction " (intra_dc_prec.), " picture structure " (picture structure) ... etc. son field.Because these can be understood easily by those skilled in the art, for the purpose of simplified illustration, in this explanation no longer one by one, but can utilize notion same as described above that each son field of sequence extension field and image spreading field is inserted corresponding data, can be with sequence gauge outfit, the image sets gauge outfit of MPEG-1, and the image gauge outfit is converted to and the corresponding gauge outfit of each layer of MPEG-2.
Moreover because identical with the MPEG-2 data format as the MPEG-1 data format below the bar layer, in other words, the view data that promptly includes a plurality of picture bars is identical, its difference only is the difference of last variable length code (VLC).When reason is to carry out variable length code, MPEG-1 system adopts in ISO/IEC 11172 specifications a specified MPEG-1 variable length code table (VLC table) to encode and get, MPEG-2 then in its ISO/IEC 18838 specifications introducing one brand-new MPEG-2 variable length code table (intra VLC table) carry out variable length code.
So in this step 33, consult Fig. 6, be that (1) is (run, level) sequence signal of pattern corresponding to MPEG-1 variable length code table with the data decode below the MPEG-1 view data with mapping mode earlier.Then, encode sequence signal corresponding to MPEG-2 variable length code table (2) again in the mode of reference coding schedule, so the view data of MPEG-1 is converted to the view data of MPEG-2 form.
Therefore, comprehensive above-mentioned steps 31~33, step 32 is changed sequence gauge outfit, image sets gauge outfit and image gauge outfit, adds step 33 view data is changed, one MPEG-1 data flow can be converted to the MPEG-2 data flow, thereby realize purpose of the present invention.
In addition, consult Fig. 7, in second preferred implementation, the present invention also provides a kind of decode system 5 that uses above-mentioned mpeg data format conversion method, and (system on a chip is SOC) in system or the information household appliances (IA) to can be applicable to a single-chip.This decode system comprises a modular converter 51, and a decoder module 52.
Modular converter 51 has a converting unit 511 and a map unit 512 that couples mutually, wherein, converting unit 511 is to be used to receive a MPEG-1 data flow, and with sequence gauge outfit (Sequence header), image sets (GOP) gauge outfit of this MPEG-1 data flow, and image (PIC) gauge outfit is converted to corresponding MPEG-2 gauge outfit form, in other words, converting unit 511 can be implemented abovementioned steps 32.
Map unit 512 then has a MPEG-1 variable length code table and a MPEG-2 variable length code table, and can accept to come from MPEG-1 data flow after converting unit 511 conversions, and with the variable length code table of the elder generation of the view data in this data flow corresponding to MPEG-1, be decoded as (run, level) sequence signal of pattern, corresponding to the variable length code table of MPEG-2, (run, level) sequence signal of pattern is encoded to the view data of MPEG-2 form to the general more again.
Decoder module 52 in the present embodiment, is meant a MPEG-2 decoding circuit, can receive a MPEG-2 data flow and it is decoded as original video data.Certainly, this decoder module 52 has a length-changeable decoding (VLD) unit 521, an inverse quantization computing (Q
-1) unit 522, reverse discrete cosine transform coding (IDCT) unit 523, and a dynamic compensation (MC) unit 524, because this is a known circuits, so repeat no more.
Preferably, in the present embodiment, modular converter 51 is written as many instructions with software mode, and be stored in the recording medium of an embodied on computer readable after can being compiled as computer program code, for example in read-only memory, flash memory, hard disk or other the similar optics or magnetic-based storage media, and when being carried out, can carry out above-mentioned functions when being loaded by the processor (not shown).
Therefore when mpeg data stream enters this decode system 5, at first read in a preface gauge outfit, and judge it is MPEG-1 or MPEG-2 data flow with the data (stream ID) that comprised in the sequence gauge outfit.If the MPEG-1 data flow after then giving modular converter 51 and being converted into the MPEG-2 data flow, sends decoder module 52 again to and is decoded and become video data.Certainly, if the MPEG-2 data flow, then directly being decoded by decoder module 52 makes it to become original video data.
Mandatory declaration be, in the present embodiment, though be the conversion of carrying out the MPEG-1 data flow with software, but owing to the MPEG-1 data flow is being converted in the process of MPEG-2 data flow, only need carry out the conversion of gauge outfit and the decoding of variable length code, and " the inverse quantization computing " that need not expend processor (not shown) resource most, " reverse discrete cosine conversion ", and steps such as " dynamic compensations ", in other words, though this three has accounted for more than 90% of the total operand of mpeg decode, but do not carried out, the mapping action of only implementing the conversion of gauge outfit and variable length code mapping merely can be finished the conversion of MPEG-1 data format herein.Therefore cross under the prerequisite of multi-load not increasing processor, only can reach the decoding function of MPEG-1 and MPEG-2 data flow simultaneously with the one group of MPEG-2 decoding circuit and the above-mentioned mpeg data format conversion method of arranging in pairs or groups, so for known technology, can constitute system-on-a-chip or information household appliances with lower hardware cost.
In addition, consult Fig. 8, in the 3rd preferred implementation, disclosed the electronic installation 6 of the above-mentioned concept attainment of a kind of usefulness, this electronic installation 6 has an operating system 61, a processor 62, a read module 63, a decoder module 64, one displays 65, and a modular converter 66.Being provided with a plurality of application programs 67 simultaneously in this electronic installation 6 uses for the user.In fact, operating system 61 is stored in the storage medium with application program 67, for example internal memory, hard disk, discs, or on other similar magnetic or optical storage medium.Decoder module 64 also refers to a MPEG-2 decoding circuit at this.
Modular converter 66 can adopt application programming interfaces (API) to come writing of accelerated procedure, and become application program one of them.Because the technology about modular converter 66 is disclosed in above-mentioned first, second preferred implementation, so repeat no more in detail.Therefore, when the user is read in mpeg data stream by means of a read module 63 (for example CD-ROM drive) in a storage medium 7, if the MPEG-1 data flow is then changed (being carried out by processor 62) for after the MPEG-2 data flow by modular converter 66, be resent to after decoder module 64 is decoded as original video data, be presented in face of the user by display 65 at last; If the MPEG-2 data flow then directly give decoder module 64 (by operating system 61 distribute, management) decoded, electronic installation 6 is possessed simultaneously the video playback capability of MPEG-1 and MPEG-2 data flow is arranged so only need possess one group of decoder module 64.
In sum, the invention provides a kind of mpeg data format conversion method that can under the prerequisite that increases processor load not significantly, realize, be better, utilize the method, only need one group of MPEG-2 decoding circuit can possess the decoding function that MPEG-1 and MPEG-2 data flow are arranged, reach the purpose of saving hardware cost really.
The above only is a preferred implementation of the present invention, does not limit practical range of the present invention, and all simple equivalent of being done in the present patent application claim scope and description of the invention scope change and modify, and must belong within the scope of the invention.