CN100525305C - Code handling method - Google Patents
Code handling method Download PDFInfo
- Publication number
- CN100525305C CN100525305C CNB2005100599254A CN200510059925A CN100525305C CN 100525305 C CN100525305 C CN 100525305C CN B2005100599254 A CNB2005100599254 A CN B2005100599254A CN 200510059925 A CN200510059925 A CN 200510059925A CN 100525305 C CN100525305 C CN 100525305C
- Authority
- CN
- China
- Prior art keywords
- length
- coding
- data
- experience
- open type
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Landscapes
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
The invention discloses an encoding process method which comprises: storing and arranging the length to the open type data unit in the encoding buffer area during the encoding course; encoding the open type data, storing it after the arranging length, capturing the open type data length at the same time; moving the encoding by the length of the open type data.
Description
Technical field
The present invention relates to a kind of network communications technology, relate in particular to a kind of processing method of coding.
Background technology
OPENTYPE (open type) is a kind of data type during ASN1 (abstract syntax title) describes, and implication is this data type and indefinite length.In coding, the code stream of this data type divides two parts, and elder generation encodes to the length of the encoding code stream of this data type, then the text of these data is encoded.Illustrate below:
As shown in the table, a piece of news has 3 IE (information unit), and IE1 and IE2 belong to the SEQUENCE type, and IE3 belongs to the OPENTYPE type,
IE1:SEQUENCE |
IE2:SEQUENCE |
IE3:OPENTYPE |
After the coding, if the encoding code stream of IE1 is called coding 1, the encoding code stream of IE2 is called coding 2, the encoding code stream of IE3 content is called coding 3, after this message coding, the content of code stream is successively: the length coding of coding 1, coding 2, coding 3, coding 3, and the deposit position of each coding is as shown in the table:
Coding 1 | Coding 2 | The coding of 3 length of encoding | Coding 3 |
If length is between 0-127 for the coding of IE3 content (coding 3), its length coding takies 1 byte so; If length is between 128-16383 byte for the coding of IE3 content (coding 3), then its length coding takies 2 bytes; If the coding of IE3 content (coding 3) length is at 16384 more than the byte, then its length coding takies a plurality of bytes.The byte number that takies of coding that is to say coding 3 length is not fixed, and by the length decision of coding 3.Need in coding earlier length coding again to content encoding, the numerical value of length is what, need compile content and yard just can know afterwards, that is to say that content encoding is finished after, know just how many bytes are length need take, content begins to deposit wherefrom.Here just need to seek a kind of method, improve the coding rate of OPENTYPE.
Since after need finishing the content encoding of IE3, just can know the value of length, thus need in another piece core position the content of IE3 to be encoded earlier, and also might have the OPENTYPE type among the IE3, so need to use an internal memory stack.When running into the OPENTYPE type in the cataloged procedure, with current encoding operation pop down, then the OPENTYPE type is encoded, if also comprise an OPENTYPE among the current OPENTYPE, carry out the pop down encoding operation again.After an OPENTYPE type coding is finished, it is ejected stack, in following one deck,, put into encoded code stream then its length coding.
Illustrate the processing method of prior art encoding code stream below:
The first step: IE1 and IE2 are encoded, and the deposit position in the coding internal memory is as follows:
Coding 1 | Coding 2 |
Second step: with current cataloged procedure pop down, the content to IE3 in the last layer internal memory is encoded.The deposit position of coding internal memory is as follows:
The 3rd step: after the content encoding of IE3 finished, 3 the length that obtains encoding, the stack of will encode ejects, and then to length coding, is put into and encodes after 2.The deposit position of coding internal memory is as scheming:
The 4th step: 3 the content of will encoding is put into the back of length coding, finishes the coding of message.
Coding 1 | Coding 2 | The coding of 3 length of encoding | Coding 3 |
If run into the OPENTYPE type again in to the cataloged procedure of IE3, the cataloged procedure pop down uses last layer internal memory again, repeats the 2-4 step.The OPENTYPE type of process continues the content encoding to IE3 after finishing again.
From top cataloged procedure as can be seen, when running into the OPENTYPE type, just need pop down, use a new internal memory,, just need the stack of N layer if be nested with N layer OPENTYPE, and each layer of stack all is identical size, and its size depends on code stream length maximum in the cataloged procedure.So this mode is very big to the consumption of internal memory.
After 3 the length coding of encoding is finished, need be with the code stream of coding 3 from a memory copying to another piece internal memory, if also there is OPENTYPE among the IE3, take place IE3 being carried out also have the code stream copy in the cataloged procedure so.If the OPENTYPE of N layer is arranged, so innermost OPENTYPE just needs copy N time, above one deck OPENTYPE need copy N-1 time, by that analogy.This memory copying has greatly expended running time, has reduced operational efficiency.
Summary of the invention
Above-mentioned defective at prior art the purpose of this invention is to provide a kind of processing method of coding, thereby has improved operational efficiency, has saved memory headroom.
The present invention is achieved through the following technical solutions, and the invention provides a kind of processing method of coding, comprising:
A, in cataloged procedure, for the data cell of open type, deposit its predetermined length at encoding buffer, described open type is a kind of data type during abstract syntax title ASN1 describes;
B, the data of open type are encoded, leave it in predetermined length back, obtain the length of the data of described open type simultaneously;
C, come mobile coding according to the data length and the described predetermined length of described open type.
Described predetermined length comprises: experience length.
Described predetermined length comprises: length-specific.
Described experience length is determined by following formula:
The experience length * (1-m) of experience length=originally+new length * m
Wherein m is a weight.
Described experience length leaves in the experience length array.
Described step C specifically comprises: if the required number of memory cells L1 of length of the data of open type is greater than the required number of memory cells L2 of experience length, and the mobile backward L1-L2 unit of then will encoding.
Described step C specifically comprises: if the required number of memory cells L1 of length of the data of open type is identical with the required number of memory cells L2 of experience length, and mobile coding not then.
Described step C specifically comprises: if the required number of memory cells L1 of length of the data of open type then moves forward coding the L2-L1 unit less than the required number of memory cells L2 of experience length.
Described memory cell unit is a byte.
According to code processing method of the present invention, can avoid the unnecessary memory copy, expeditiously the OPENTYPE type is encoded, and take the least possible memory headroom.
Description of drawings
Fig. 1 shows the structural representation of a piece of news.
Embodiment
Understand and realization the present invention the existing embodiments of the invention of describing in conjunction with the accompanying drawings for the ease of persons skilled in the art.
According to the present invention, apply for an internal memory, as the buffering area of depositing encoding code stream.According to the content that ASN1 describes, successively each IE is encoded, when running into the OPENTYPE type, handle according to following description:
The next byte that will deposit in the encoding buffer is referred to as current byte.When the OPENTYPE content was encoded, the coding of content still was kept in the current buffering area, and original position is that current byte is offset several bytes backward.Finish after the coding of content, obtain PER (compressed encoding rule) code stream length, judge length, if length between 0-127, length coding takies a byte; If length is between 128-16383, length coding takies two bytes; If length is greater than 16384, then length coding takies a plurality of bytes.Judge the situation that takies byte,, then do not need mobile content PER code stream if length coding just in time takies the byte space that is available in advance; If length coding is very short, put the discontented byte that is available in advance, the PER code stream of content need be moved to the left; If it is very long to encode, the byte that is available in advance fails to lay down length coding, the PER code stream of content need be moved right.Put into length coding then, the present encoding pointer is put into after the content encoding, this has just finished the coding of a protocol container.
Give one example below cataloged procedure to the OPENTYPE type be described:
Fig. 1 shows the layer of structure of a piece of news, and this message structure includes an OPENTYPE11, comprises an OPENTYPE21 among the OPENTYPE11 again.Its cataloged procedure is described below:
The first step: IE1 is encoded, and encoding buffer was as follows after coding was finished:
The IE11 coding |
Second step: reserve several bytes (for convenience of description, hypothesis is reserved a byte, how to calculate reserved byte and will be described later) here to length coding, begin the content of OPENTYPE11 is encoded.First member of OPENTYPE11 is IE21, finishes the coding to IE21.Encoding buffer is as follows:
The IE11 coding | 1byte | The IE21 coding |
The 3rd step: at this time run into an OPENTYPE21 again, need the coding method of nested use OPENTYPE to encode.Reserve some bytes (for convenience of description, hypothesis is reserved two bytes, how to calculate reserved byte and will be described later) here to length coding, begin the content of OPENTYPE21 is encoded.First member of OPENTYPE21 is IE31, finishes the coding to IE31.Encoding buffer is as shown below:
The IE11 coding | 1byte | The IE21 coding | 1byte | 1byte | The IE31 coding |
The 4th step: after the IE31 coding is finished, the length of OPENTYPE21 content encoding just can have been known, here suppose that the content encoding length of OPENTYPE21 is 100 bytes, the length coding of OPENTYPE21 only need take 1 byte so, and we have reserved two bytes before the coding, so before to length coding, content encoding need be moved to the left 1 byte, put into length coding then.Encoding buffer is as follows:
The IE11 coding | 1byte | The IE21 coding | Length coding | The IE31 coding |
The 5th step: at this time, the content of OPENTYPE11 has also been finished coding, the length of OPENTYPE11 content encoding just can have been known, here suppose that the content encoding length of OPENTYPE21 is 200 bytes, the length coding of OPENTYPE11 just need take 2 bytes so, and we have only reserved 1 byte before the coding, so before to length coding, 1 byte that content encoding need be moved right is put into length coding then.Encoding buffer is as shown below:
The IE11 coding | The 2byte length coding | The IE21 coding | Length coding | The IE31 coding |
The 6th step: IE12 is encoded, and after finishing, the coding of whole message has just been finished.Encoding buffer is as shown below:
The IE11 coding | The 2byte length coding | The IE21 coding | Length coding | The IE31 coding | The IE12 coding |
From top operation description, as can be seen, before beginning, need to judge that reserving how many bytes be used for length coding, judge whether accurately, will whether need determine the PER code stream of mobile content, directly the efficient of influence coding content encoding.In order to increase the correctness of judging reserved byte, in cataloged procedure, can note the code length of this PDU (protocol Data Unit) in the past, we are referred to as experience length, and rule of thumb length decides and reserves how many bytes, increases hit probability.Be the specific implementation method below:
Use an array, the number of array is the total number of OPENTYPE in the agreement, gives sequence number of each OPENTYPE again, uses sequence number as array index, each OPENTYPE writes down the experience length of this OPENTYPE with regard to a corresponding number group membership among each array member like this.In initial, be 127 to each member's assignment in the array, after each OPENTYPE coding is finished later on, obtain length, upgrade the experience length records of this OPENTYPE.In order to prevent ping-pong phenomenon, in the experience of renewal length, be not to use new length to substitute original length, but get weighted average with the original length.Suppose that new length weight is m, 0<m<1, then
The experience length * (1-m) of experience length=originally+new length * m.
The big I of the weight m of new length is represented the dependency relation between new data and the original data.Can adjust the weight m of new length, for example desirable m=0.8 according to the degree of correlation between new data and the original data.
Before OPENTYPE was encoded, how many bytes judge with the experience length that writes down in this array exactly needed to reserve as length coding at every turn.Because the IE that chooses in the message is not at every turn identical, so the code length of same OPENTYPE is not always constant, and we are concerned about is that length coding is 1 byte, 2 bytes or multibyte, use this weighted-average method, can making in most cases, the byte number estimation of length coding is correct.
According to the present invention, when OPENTYPE is encoded, also can adopt following proposal, the data length that can suppose OPENTYPE earlier is arbitrary particular value, then OPENTYPE is encoded, in cataloged procedure, can obtain the length of OPENTYPE data, determine whether mobile OPENTYPE coding according to the shared byte of OPENTYPE data length then.If the required number of memory cells L1 of length of the data of open type is greater than the required number of memory cells L2 of experience length, the mobile backward L1-L2 unit of then will encoding; If the required number of memory cells L1 of length of the data of open type is identical with the required number of memory cells L2 of experience length, mobile coding not then; If the required number of memory cells L1 of length of the data of open type then moves forward coding the L2-L1 unit less than the required number of memory cells L2 of experience length.At last, the physical length with the OPENTYPE data is placed on the position of reservation.
When the OPENTYPE data have multilayer nest, calculate the length of every layer of OPENTYPE data successively, then, come mobile OPENTYPE data according to the physical length of calculating, the physical length with the OPENTYPE data is placed on the position of reservation at last.
According to the present invention, all OPENTYPE finish in identical encoding buffer in the cataloged procedure, do not need to deposit the buffering area of OPENTYPE content encoding temporarily, thereby make the nested number of plies of OPENTYPE and needed buffering area relation not quite.Therefore, saved the memory headroom that uses in the cataloged procedure.
In addition, calculate experience length by using weighted-average method, can satisfying in most cases, the estimation of code length is correct.Therefore, in most cases, do not need the mobile content coding, thereby avoided expending the unnecessary time in the cataloged procedure, improve code efficiency, save the scramble time.
Though described the present invention by embodiment, those of ordinary skills know, without departing from the spirit and substance in the present invention, just can make the present invention that many distortion and variation are arranged, and scope of the present invention is limited to the appended claims.
Claims (9)
1. the processing method of a coding is characterized in that, comprising:
A, in cataloged procedure, for the data cell of open type, deposit its predetermined length at encoding buffer, described open type is a kind of data type during abstract syntax title ASN1 describes;
B, the data of open type are encoded, leave it in predetermined length back, obtain the length of the data of described open type simultaneously;
C, come mobile coding according to the data length and the described predetermined length of described open type.
2, the processing method of coding according to claim 1 is characterized in that, described predetermined length comprises: experience length.
3, the processing method of coding according to claim 1 is characterized in that, described predetermined length comprises: length-specific.
4, the processing method of coding according to claim 2 is characterized in that, described experience length is determined by following formula:
The experience length * (1-m) of experience length=originally+new length * m
Wherein m is a weight.
5, the processing method of coding according to claim 2 is characterized in that, described experience length leaves in the experience length array.
6. according to the processing method of claim 2,4 or 5 described codings, it is characterized in that, described step C specifically comprises: if the required number of memory cells L1 of length of the data of open type is greater than the required number of memory cells L2 of experience length, and the mobile backward L1-L2 unit of then will encoding.
7. according to the processing method of claim 2,4 or 5 described codings, it is characterized in that, described step C specifically comprises: if the required number of memory cells L1 of length of the data of open type is identical with the required number of memory cells L2 of experience length, and mobile coding not then.
8. according to the processing method of claim 2,4 or 5 described codings, it is characterized in that, described step C specifically comprises: if the required number of memory cells L1 of length of the data of open type then moves forward coding the L2-L1 unit less than the required number of memory cells L2 of experience length.
9. the processing method of coding according to claim 6 is characterized in that, described memory cell unit is a byte.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2005100599254A CN100525305C (en) | 2005-04-01 | 2005-04-01 | Code handling method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2005100599254A CN100525305C (en) | 2005-04-01 | 2005-04-01 | Code handling method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1842082A CN1842082A (en) | 2006-10-04 |
CN100525305C true CN100525305C (en) | 2009-08-05 |
Family
ID=37030925
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2005100599254A Expired - Fee Related CN100525305C (en) | 2005-04-01 | 2005-04-01 | Code handling method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100525305C (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101998510A (en) | 2009-08-21 | 2011-03-30 | 中兴通讯股份有限公司 | Base station and method for storing system information code stream |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2287814B (en) * | 1994-03-24 | 1998-03-11 | Fujitsu Ltd | Method and apparatus for converting data between abstract syntax format and transfer syntax format |
-
2005
- 2005-04-01 CN CNB2005100599254A patent/CN100525305C/en not_active Expired - Fee Related
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2287814B (en) * | 1994-03-24 | 1998-03-11 | Fujitsu Ltd | Method and apparatus for converting data between abstract syntax format and transfer syntax format |
Non-Patent Citations (2)
Title |
---|
Information tchnology-Abstract Syntax Notation One(ASN.1):Information object specification. ITU X.681. 1997 |
Information tchnology-Abstract Syntax Notation One(ASN.1):Information object specification. ITU X.681. 1997 * |
Also Published As
Publication number | Publication date |
---|---|
CN1842082A (en) | 2006-10-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1119068C (en) | Combined minicell alignment and header protection method and apparatus | |
CN111741495B (en) | Design method for high-energy-efficiency coding cache content placement scheme in heterogeneous network | |
CN1997011B (en) | Data partition method and data partition device | |
CN116346289B (en) | A data processing method for computer network center | |
CN109889205A (en) | Encoding method and system, decoding method and system, and encoding and decoding method and system | |
CN112256471A (en) | Erasure code repairing method based on separation of network data forwarding and control layer | |
CN102917441A (en) | Target network selection method on basis of particle swarm algorithm for multi-mode terminals | |
CN116301656A (en) | Data storage method, system and equipment based on log structure merging tree | |
CN105488108A (en) | High-speed parallel storage method and apparatus for multiple video files | |
CN103152288A (en) | Method and apparatus for transmitting data on a network | |
CN100525305C (en) | Code handling method | |
CN101252787B (en) | Method for terminal to read broadcast channel and terminal thereof | |
CN115167780A (en) | A data reconstruction method, device, electronic device and storage medium | |
CN104348571B (en) | Deblocking method and device | |
CN102055549B (en) | Rate matching device and method for long term evolution system | |
CN117097906B (en) | Method and system for efficiently utilizing regional medical resources | |
CN105336379B (en) | A kind of information processing method and solid-state memory | |
CN101163258A (en) | Method and system for processing high-capacity cell broadcasting service | |
CN113783933B (en) | Method, device and medium for double-layer network communication based on code cache | |
CN109194445A (en) | A kind of coding and decoding optimization method suitable for the long fountain codes of short code | |
CN101374150A (en) | Sensor network aggregation node and data storage and transmission method on the node | |
CN101741802B (en) | Data mapping method for OFDMA system base station | |
CN100495974C (en) | Flow shaping method in data transmission process | |
CN117880767B (en) | Short message data transmission method with low delay | |
CN112148682A (en) | Multi-heterogeneous file joint delay tail probability convex optimization algorithm based on cloud storage |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20090805 |
|
CF01 | Termination of patent right due to non-payment of annual fee |