Detailed Description
The embodiment of the invention provides a coding method, which sequences and codes the pulses to be coded according to the distribution of the positions of the pulses on a track. The embodiment of the invention also provides a corresponding decoding method and a coder/decoder. The method and apparatus of the embodiments of the present invention are described in detail below.
In an embodiment, an encoding method, as shown in fig. 1, includes:
and A1, counting the pulse to be coded on the track according to the position, and obtaining the distribution information of the position of each pulse on the track.
The total number of pulses to be coded on the same track is generally determined according to the code rate, and it is obvious that the more the number of pulses to be coded is, the more the number of bits required for coding an index is, and the higher the code rate is. In the present context, it is intended that,
the total number of pulses to be encoded in the same track is denoted by pulse _ num, assuming that
By distributing vectors in pulses
Representing the distribution of the positions of the individual pulses on the track; wherein q (h) represents the position number of the h +1 th pulse on the track,
m herein denotes the total number of positions on the track, and in general M may be 8, 16, etc.
Furthermore, the pulses to be encoded may also have a sign, i.e. have a positive or negative characteristic, when the pulses to be encoded on the track are counted by position, and the information of the sign of the pulses of the respective pulses is obtained. In the present context, it is intended that,
by pulse symbol vectorPulse symbol information representing each pulse; wherein ss (h) represents the pulse symbol of the h +1 th pulse, which is called the symbol index of q (h) pulse, and based on whether the pulse symbol represented by ss (h) has positive or negative binary property, the following simple coding method can be generally adopted: positive pulses are denoted by ss (h) ═ 0, and negative pulses are denoted by ss (h) ═ 1. Of course, the pulse symbol is not necessarily the characteristic for the pulse to be encoded, and the pulse may have only the position and number characteristics according to the actual requirement, and in this case, the pulse symbol information does not need to be counted.
It is clear that,have a one-to-one correspondence.
In statistics obtainObtaining parameters of the pulse to be encoded

Then, each parameter needs to be encoded into an index, and a corresponding relationship between the parameters and the index is established, so that the decoding party can recover the corresponding parameter according to the index. The corresponding relation can adopt two expression modes, one is a calculation relation expressed by an algebraic mode, under the condition, the encoding side carries out forward calculation on the parameter to obtain an index, and the decoding side carries out backward calculation on the index to obtain the parameter; the first is a query relationship expressed in a mapping manner, in this case, both the encoding and decoding sides need to store a mapping table of associated parameters and indexes. The two corresponding relations can be selected according to the specific characteristics of the parameters, generally speaking, under the condition of large data volume, the corresponding relation expressed by the calculation relation is designed as much as possible, so that the storage capacity of both encoding and decoding parties can be saved, and the method is more favorable. The encoding of each parameter will be described below.
A2, determining a distribution index I4, I4, and calculating according to the following method: according to the set sequence, counting the current pulse number
Next, the positions of the respective pulses are arranged in all possible distribution situations on the track, and the arranged sequence numbers are used as distribution indexes I4 indicating the corresponding distribution situations.
The term "set order" means that the both encoding and decoding sides determine the order according to the same order calculation rule
The order of all possible cases.
Vector of pulse distribution
Is total possible number of
Wherein,
"C" indicates the number of combinations to be determined. Each I4 corresponds to an indication
A pulse distribution condition of
In general terms, the term "water-soluble" is used to describe a mixture of water-soluble polymers and water-soluble polymers
The data amount is large, so the correspondence with the distribution index I4 is suitable for the calculation relationship, and of course, the query relationship is also feasible. It is obvious that
I.e. the total possible number of values of I4, if the value of I4 is counted from 0, then there is
A3, generating coding index
Coding index
Including the information of the distribution index I4.
The I4 may be placed into the code index in any manner that can be identified by the decoder, for example, in the simplest case, from a location in the code index that is set.
Of course, in the case where the encoded pulses are signed pulses,
it is also necessary to include information on the symbol index ss (h) of each pulse, and to simply vector the pulse symbol
As a length of
Is placed at a fixed location, e.g., the end, of the coded index.
In summary, the index is encoded
Can be expressed as:
it is to be understood that the above-mentioned exemplary code index configuration is only an optional manner of the present embodiment, and those skilled in the art can easily derive other configuration manners of the code index structure by using the basic information constituting the code index, for example, interchanging or recombining the index positions, etc., and the specific configuration manner of the code index does not limit the present invention.
To better understand the structure of the coding index in the first embodiment, some practical examples are given below for explanation. Assuming that the total number of positions M on the track is 16:
example one, encoding
The structure of the coded index with the signed pulse is shown in fig. 2.
The code Index Index (5) has 19 bits in total, i.e., Index (5) is ∈ [0, 2 ]19-1]The range of code values for Index (5) in FIG. 2 is represented in hexadecimal form. Herein, before a value, the value is represented by "0 x" as a hexadecimal representation; other numerical values are not specifically stated and are all expressed in decimal notation.
The five symbol indices ss (0) to ss (4) occupy the last 5 bits.
In FIG. 2, 14 bits are used to place I4, so the coding space provided to I4 is 2 bits in length1416384, because Obviously sufficient for use.
Example two, encoding
The coded index structure with the signed pulse is shown in fig. 3.
The code Index Index (4) has 16 bits in total, i.e., Index (4) is ∈ [0, 2 ]16-1]。
The four symbol indices ss (0) to ss (3) occupy the last 4 bits.
In FIG. 3, 12 bits are used to place I4, so the coding space provided to I4 is 2 bits in length124096 because Obviously sufficient for use.
Example three, encoding
The structure of the coded index with the signed pulse is shown in fig. 4.
The code Index Index (3) has 13 bits in total, i.e., Index (3) is from [0, 2 ]13-1]。
The three symbol indices ss (0) to ss (2) occupy the last 3 bits.
In FIG. 4, 10 bits are used to place I4, so the length of the coding space provided to I4 is 2101024 because Obviously sufficient for use.
The second embodiment is an encoding method, which uses the same encoding logic as the first embodiment, and this embodiment mainly provides a method for calculating distribution index I4, so that it is convenient to determine the distribution of pulses on a track through algebraic calculation:
correspondence to I4.
The following are provided in the present example
The order calculation rule of (1):
due to the fact that
The different cases are embodied by different numerical combinations contained in the same table, and therefore do not correspond to the same table
The position numbers included in (1) are arranged so that:
Wherein the equal sign indicates that the position of the pulse can be repeated; assuming the former is adopted, there are: q (0) belongs to [0, M ]],q(h)∈[q(h-1),M]And M is the total number of positions on the track. Then to
Comparing the sizes of all dimensions in sequence under different conditions, and sequentially comparing all possible dimensions according to the sequence from small to large or from large to small
And (6) sorting.
Suppose that a sorting mode from small to large is adopted and the sorted data is sorted from 0
Numbering, then:
wherein "C" represents the number of combinations; and Σ denotes summation. The meaning of the above formula can be interpreted as:
indicating that the 1 st pulse precedes q (0)
Total number of cases;
when the 1 st pulse is located at q (0), the 2 nd pulse is located before q (1)
Total number of cases;
the meanings of (A) can be analogized. It should be noted that the above formulas are only I4 and
one expression form of the inter-calculation relationship can equally describe the calculation relationship in other mathematical forms according to the same sequencing rule; if different ordering rules are adopted, similar calculation relationships can be correspondingly designed, and the expression mode of the specific calculation relationship does not limit the embodiment of the invention.
To better understand the above calculation method of I4, a pulse relative position vector can be assumed
And
there is a one-to-one correspondence as follows:
xx(1)=q(0);
xx(i)=q(i-1)-q(i-2);
xx (i) denotes a relative positional relationship between the position of the ith pulse and the position of the (i-1) th pulse,
by using
Can be combined with
All possible cases being constructed in one
In the tree structure of the layer, the depth of the tree is
The child nodes at the ith level of the tree represent the relative position values xx (i) of the ith pulse. Placing the values of xx (i) from left to right in a descending order, and then coding each tail node in the bottom layer of the tree, namely the tail node from left to right in sequence. Each end node to root node path corresponds
So that the code of each end node indicates the corresponding
The distribution index of the case I4.
As an actual example, assuming that the total number M of positions on the track is 16,the tree structure is shown in fig. 5, and the corresponding distribution index calculation formula is:
others
In the case of values, the corresponding tree structures are similar, and the calculation formula of I4 can be analogized and will not be described again.
The embodiment provides a method for obtaining the distribution index I4 in a calculation relationship, and since the data size of I4 in the coding index is large, the storage capacity of both the coding and decoding can be reduced as much as possible by using the calculation method of the embodiment. At the same time, since I4 is continuously encoded and compared with
And the coding bits are strictly in one-to-one correspondence, so that the coding bits can be utilized to the maximum extent, and waste is avoided.
The third embodiment is a coding method, and the difference between the first embodiment and the second embodiment is that the coding process described in the first embodiment is regarded as the first coding mode, and the coding process is firstly selected from the selectable coding modes including the first coding mode, and then the coding process is performed according to the selected coding mode. The flow of the encoding method of this embodiment is shown in fig. 6, and includes:
b1, determining the total number of pulses to be encoded on the same track
The total number of pulses to be coded can be determined according to the coding rate
B2, according to
Selecting a coding mode, wherein the coding mode comprises a first coding mode; and executing the step B3 or the step B4 according to the selection result.
The encoding scheme described in the first embodiment is referred to as a first encoding scheme herein. The alternative coding scheme may include other coding schemes, such as the conventional AMR _ WB +, in addition to the first coding scheme. In this embodiment, an optional second encoding manner is specifically provided.
The coding mode is determined according to
The values are selected, e.g. some of them may be preset
In the case of values, the first coding mode is used for coding, while in the other cases
Under the condition of valueAnd coding by adopting a second coding mode. The research shows that
And in equivalence, the effect is better by adopting the first coding mode.
And B3, according to the result of the coding mode selection, after determining to select the first coding mode, coding according to the first coding mode.
The specific encoding process can be performed as described in the first embodiment.
B4, according to the result of the coding mode selection, after determining to select the second coding mode, coding according to the second coding mode, including the following steps:
and B41, counting the pulse to be coded on the track according to the position, and obtaining the number of the positions with the pulse, the distribution of the positions with the pulse on the track and the number of the pulses at each position with the pulse.
In the present context, it is intended that,
the number of positions with pulses is represented by pos _ num, since
The distribution of the pulses on the track may have a position overlap, assuming pos _ num is N, obviously
The distribution of pulsed positions on the track is denoted by a pulse position vector p (N) = { p (0), p (1) }; wherein p (N) represents the position number of the position with pulse on the track, N belongs to [0, N-1], p (N) belongs to [0, M-1], M represents the total number of positions on the track in this document, and M can be 8, 16, etc.;
the pulse number at each position having a pulse is represented by a pulse number vector su (N) { su (0), su (1) }; wherein su (n) represents the number of pulses at the p (n) positionTo the eye, obviously have
In addition, the pulses to be encoded may have signs, i.e. have positive or negative characteristics, and when the pulses to be encoded on the track are counted according to positions, it is also necessary to obtain the sign information of each pulse at the position (generally, the pulse signs of the pulses at the same position are the same, so that the sign information of the pulse at the position can be represented by the pulse sign information of the pulse position). In the present context, it is intended that,
expressing pulse symbol information of each pulse position by a position symbol vector s (N) { s (0), s (1) }; wherein, s (n) represents the pulse symbol of p (n) position, called as the symbol index of p (n) position, based on whether the pulse symbol represented by s (n) has positive or negative binary property, the following simple coding method can be adopted: a positive pulse is denoted by s (n) ═ 0, and a negative pulse is denoted by s (n) ═ 1. Of course, the pulse symbol is not necessarily the characteristic for the pulse to be encoded, and the pulse may have only the position and number characteristics according to the actual requirement, and in this case, the pulse symbol information does not need to be counted.
Obviously, the values in p (n), su (n), s (n) have a one-to-one correspondence.
After obtaining the parameters N, P (N), su (N), s (N) of the pulse to be encoded by statistics, the parameters need to be encoded into indexes, and the corresponding relationship between the parameters and the indexes is established, so that the decoding party can recover the corresponding parameters according to the indexes. The corresponding relation can adopt two expression modes, one is a calculation relation expressed by an algebraic mode, under the condition, the encoding side carries out forward calculation on the parameter to obtain an index, and the decoding side carries out backward calculation on the index to obtain the parameter; the first is a query relationship expressed in a mapping manner, in this case, both the encoding and decoding sides need to store a mapping table of associated parameters and indexes. The two corresponding relations can be selected according to the specific characteristics of the parameters, generally speaking, under the condition of large data volume, the corresponding relation expressed by the calculation relation is designed as much as possible, so that the storage capacity of both encoding and decoding parties can be saved, and the method is more favorable. The encoding of each parameter will be described below.
B42, determining a first index I1 according to the number of pulse positions pos _ num ═ N, where the first index I1 corresponds to the distribution of all possible pulse positions on the track for the same pos _ num.
The value N of pos _ num does not vary widely, so that it is feasible to use a calculation relationship or a query relationship corresponding to the first index I1. When the pos _ num is corresponding to the I1, the pos _ num and the I1 can generally have a one-to-one correspondence; of course, if the index of other parameters requires less bits for some pos _ num values, the pos _ num values can be combined with an I1 and distinguished by additional flag bits.
The value N of pos _ num determines the total number W (N) of all possible cases of P (N),"C" represents the number of combinations; thus one I1 corresponds to w (n) possible p (n).
B43, determining a second index I2 according to the distribution P (N) of the positions with pulses on the track, wherein the second index I2 indicates the distribution corresponding to the distribution of the positions with pulses at present from all possible distribution cases corresponding to the first index I1.
Total possible number of P (N) is The data volume is large, so the corresponding comparison with the second index I2 is suitable for adopting the calculation relationship, of course, the inquiry is adoptedRelationships are also possible. Obviously, W (N) is the total possible value number of I2, if the value of I2 is counted from 0, I2 is equal to [0, W (N) -1]。
B44, determining a third index I3 according to the number of pulses su (n) at each position having pulses.
SU (N) is a vector of the same dimension as P (N), but is limited to
And is
The number of (c) is usually not large, and is generally 1 to 6, so that the total possible number of su (n) is not large, and it is feasible to adopt a calculation relationship or a query relationship with the third index I3. In addition, in view of the vector form, the query relationship is suitable under the condition of high dimension; the design of calculating the relationship under the low-dimensional condition is easier, and both modes can be adopted. It should be noted that in some extreme cases, for example, N ═ 1 or
Su (n) at this time is only one possible case, not necessarily indicated by a specific I3, I3 can be considered as an arbitrary value that does not affect the final code index generation.
B45, generating coding index
Coding index
Including the information of the first, second and third indexes I1, I2 and I3.
I1, I2, I3 may be placed in the code index in any way that can be identified by the decoder, e.g., in the simplest case, each may be individually deposited in a fixed field. Considering that the total number of pulses pulse _ num required to be encoded on the same track is constant, the value N of pos _ num indicated by I1 determines the variation range of I2 and I3, that is, the number of encoding bits required by I2 and I3, so the encoding index can be constructed as follows:
overlapping information of other indexes by taking a first index I1 as a starting value; a value of I1 corresponds to an independent range of values of the code index; thus, the decoding party can directly determine the value N of pos _ num according to the value range of the coding index;
further, in the range defined by I1 (usually corresponding to a certain field length), I2 and I3 may be placed in any way that can be identified by the decoding party, for example, in the simplest case, they may be stored separately. Since I2 and I3 cannot be expressed as an integer power of 2 in general, in order to save coding bits as much as possible, I2 and I3 can be combined into the following form and placed in a value range defined by I1:
<math><mrow>
<mi>I</mi>
<mn>23</mn>
<mo>=</mo>
<mi>I</mi>
<mn>3</mn>
<mo>×</mo>
<mi>W</mi>
<mrow>
<mo>(</mo>
<mi>N</mi>
<mo>)</mo>
</mrow>
<mo>+</mo>
<mi>I</mi>
<mn>2</mn>
<mo>=</mo>
<mi>I</mi>
<mn>3</mn>
<mo>×</mo>
<msubsup>
<mi>C</mi>
<mi>M</mi>
<mi>N</mi>
</msubsup>
<mo>+</mo>
<mi>I</mi>
<mn>2</mn>
</mrow></math>
i2 and I3 both start encoding from 0, <math><mrow>
<mi>I</mi>
<mn>2</mn>
<mo>∈</mo>
<mo>[</mo>
<mn>0</mn>
<mo>,</mo>
<msubsup>
<mi>C</mi>
<mi>M</mi>
<mi>N</mi>
</msubsup>
<mo>-</mo>
<mn>1</mn>
<mo>]</mo>
<mo>,</mo>
</mrow></math> I3∈[0,Class(N)-1]and class (N) is the total possible number of SU (N). Obviously, this wayThe value range defined by I1 is divided into (N) parts with length W (N) of class, and each part corresponds to a distribution condition of SU (N).
③ of course, in the case where the coded pulses are signed pulses,it is also desirable to include information for each pulse symbol index s (N) that the position symbol vector s (N) can simply be placed as a field of length N at a fixed location, e.g., the end, of the code index.
In summary, the index is encoded
Can be expressed as:
it is to be understood that the above-mentioned exemplary code index configuration is only an optional manner of the present embodiment, and those skilled in the art can easily derive other configuration manners of the code index structure by using the basic information constituting the code index, for example, interchanging or recombining the index positions, etc., and the specific configuration manner of the code index does not limit the present invention.
The coding logic provided by the second coding mode can be uniformly adopted for different coding pulse numbers, so that the accumulation of coding index redundancy in a recursive mode adopted by AMR _ WB + is avoided, and the coding bits are fully utilized from the general logic concept. Meanwhile, as the multiple pulses at the same position are prevented from being coded respectively, the method for coding after position combination in the embodiment of the invention has the advantage of saving coding bits, and the probability of overlapping of pulse positions is increased along with the increase of the number of coding pulses on the track, so that the method in the embodiment of the invention has more obvious advantages.
In order to better understand the structure of the coding index in the second coding scheme, some practical examples will be described below. Assuming that the total number M of positions on the track is 16, and the number of pulse positions pos _ num corresponds to the first index I1:
example one, encoding
The signed pulse, code index structure is shown in fig. 7.
The code Index Index (6) has 21 bits in total, i.e., Index (6) is from [0, 2 ]21-1]Fig. 7 shows the number of bits occupied by each part Index included in Index (6) in the case of different values of pos _ num. For clarity, the index with N at a particular value is denoted below by I1(N), I2(N), I3(N), and I23(N), respectively. The determination of I1(N) is performed in a mapping manner, respectively,
I1(1)=0x1F0000,I1(2)=0x1E0000,I1(3)=0x1D0000,
I1(4)=0x180000,I1(5)=0x000000,I1(6)=0x100000。
fig. 7 is explained in detail below.
When 6 pulses are at 1 position, N is 1, and possible combinations of SU (1) are shown in fig. 8;
W(1)=1 6,I2(1)∈[0,15],
SU(1)={6},Class(1)=1,I3(1)=0,
therefore, I23(1) ═ I2(1) ∈ [0, 15 ];
one symbol index s (0) occupies the last 1 bit,
i1(1) provides I23(1) with a coded space length of [2 ]21-I1(1)]/2132768, apparently sufficient.
When 6 pulses are in 2 positions, N is 2, and possible combinations of SU (2) are shown in fig. 9;
W(2)=120,I2(2)∈[0,119],
SU(2)={5,1},{4,2},{3,3},{2,4},{1,5};Class(2)=5,I3(2)∈[0,4],
thus I23(2) ═ I3(2) × 120+ I2(2) ∈ [0, 599 ];
the two symbol indices s (0), s (1) occupy the last 2 bits,
i2(2) provides I23(2) with a code space length of [ I1(1) -I1(2)]/2216384, obviously suffice.
③ 6 pulses at 3 positions, N equals 3, and SU (3) is shown in fig. 10;
W(3)=560,I2(3)∈[0,559],
SU(3)={4,1,1},{1,4,1},{1,1,4},{3,2,1},{3,1,2},{2,3,1},{2,1,3},{1,3,2},{1,2,3},{2,2,2};Class(3)=10,I3(3)∈[0,9],
thus I23(3) ═ I3(3) × 560+ I2(3) ∈ [0, 5599 ];
the three symbol indices s (0) to s (2) occupy the last 3 bits,
i2(3) provides I23(3) with a code space length of [ I1(2) -I1(3)]/238192, obviously sufficient.
When 6 pulses are in 4 positions, N is 4, and possible combinations of SU (4) are shown in fig. 11;
W(4)=1820,I2(4)∈[0,1819],
SU(4)={3,1,1,1},{1,3,1,1},{1,1,3,1},{1,1,1,3},{2,2,1,1},{2,1,2,1},{2,1,1,2},{1,2,2,1},{1,2,1,2},{1,1,2,2};Class(4)=10,I3(4)∈[0,9],
thus I23(4) ═ I3(4) × 1820+ I2(4) ∈ [0, 18199 ];
the four symbol indices s (0) to s (3) occupy the last 4 bits,
i2(4) provides I23(4) with a code space length of [ I1(3) -I1(4)]/2420480, obviously suffices.
When 6 pulses are in 5 positions, N is 5, and possible combinations of SU (5) are shown in fig. 12;
W(5)=4368,I2(5)∈[0,4367],
SU(5)={2,1,1,1,1},{1,2,1,1,1},{1,1,2,1,1},{1,1,1,2,1},{1,1,1,1,2};C1ass(5)=5,I3(5)∈[0,4],
thus I23(5) ═ I3(5) × 4368+ I2(5) ∈ [0, 21839 ];
the five symbol indices s (0) to s (4) occupy the last 5 bits,
i2(5) provides I23(5) with a code space length of [ I1(6) -I1(5)]/2532768, apparently sufficient.
Sixthly, when 6 pulses are at 6 positions, N is 6, and the possible combination of SU (6) is shown in FIG. 13;
W(6)=8008,I2(6)∈[0,8007],
SU(6)={1,1,1,1,1,1},Class(6)=1,I3(6)=0,
therefore, I23(6) ═ I2(6) ∈ [0, 8007 ];
the six symbol indices s (0) to s (5) occupy the last 6 bits,
i2(6) provides I23(6) with a code space length of [ I1(4) -I1(6)]/268192, obviously sufficient.
Example two, encoding
The structure of the coded index with the signed pulse is shown in fig. 14.
The code Index Index (5) has 19 bits in total, i.e., Index (5) is ∈ [0, 2 ]19-1]. Fig. 14 shows the number of bits occupied by each part Index included in Index (5) in the case of different values of pos _ num. The determination of I1(N) is performed in a mapping manner, respectively,
I1(1)=0x78000,I1(2)=0x70000,I1(3)=0x60000,
I1(4)=0x40000,I1(5)=0x00000。
the detailed analysis of fig. 14 can be performed in accordance with fig. 7, and will not be described herein.
Example three, encodingThe structure of the coded index with the signed pulse is shown in fig. 15.
The code Index Index (4) has 16 bits in total, i.e., Index (4) is ∈ [0, 2 ]16-1]. Fig. 15 shows the number of bits occupied by each partial Index included in Index (4) when pos _ num has different values. The determination of I1(N) is performed in a mapping manner, respectively,
I1(1)=0xE000,I1(2)=0xC000,I1(3)=0x8000,I1(4)=0x0000。
the detailed analysis of fig. 15 can be performed in accordance with fig. 7, and will not be described herein.
Example four, encoding
The structure of the coded index with the signed pulse is shown in fig. 16.
The code Index Index (3) has 13 bits in total, i.e., Index (3) is from [0, 2 ]13-1]. FIG. 16 is a table of respectiveThe number of bits occupied by each part Index contained in Index (3) is shown in the case of different values of pos _ num. The determination of I1(N) is performed in a mapping manner, respectively,
I1(1)=0x1C00,I1(2)=0x1800,I1(3)=0x0000。
the detailed analysis of fig. 16 can be performed in accordance with fig. 7, and will not be described herein.
Example five, encoding
The structure of the coded index with the signed pulse is shown in fig. 17.
The code Index Index (2) has 9 bits in total, i.e., Index (2) is from [0, 2 ]9-1]. Fig. 17 shows the number of bits occupied by each partial Index included in Index (2) when pos _ num is different. The determination of I1(N) is performed in a mapping manner, respectively,
I1(1)=0x1E0,I1(2)=0x000。
the detailed analysis of fig. 17 can be performed in accordance with fig. 7, and will not be described herein.
Example six, encoding
The structure of the coded index with the signed pulse is shown in fig. 18.
The code Index Index (1) has 5 bits in total, i.e., Index (1) is from [0, 2 ]5-1]. Since N ≡ 1, in fig. 18, Index (2) includes only Index I23(1) ═ I2(1), and symbol Index s (0) of p (0).
The fourth embodiment is an encoding method, which uses the same encoding logic as the third embodiment, and the present embodiment mainly provides a method for calculating the second index I2 in the second encoding manner, so that the distribution of pulse positions on the track can be conveniently determined by algebraic calculation: p (N) } is the correspondence of I2 with { p (0), p (1).
In the calculation method of I2 in this embodiment, all possible cases of p (N) in the number N of pulse positions corresponding to the first index I1 are arranged in a set order, and the arranged sequence number is used as the second index I2 indicating the corresponding distribution case.
The "set order" is understood to mean the order of all possible cases of p (n) determined by both the codec according to the same order calculation rule. In this embodiment, the following order calculation rule is provided:
since the different conditions of p (n) are represented by different combinations of values contained in p (n), the position numbers contained in p (n) are not arranged, so that:
p (0) < p (1) <. < p (N-1), or p (0) > p (1) > p (N-1);
assuming the former is adopted, there are: p (0) is belonged to [0, M-N ], p (N) is belonged to [ p (N-1) +1, M-N + N ], and M is the total number of positions on the track. And then comparing the sizes of all dimensions in sequence for different cases of P (N), and sequencing all possible P (N) according to the sequence from small to large or from large to small.
Assuming that a sorting mode from small to large is adopted and the sorted P (N) is numbered from 0, then:
<math><mrow>
<mi>I</mi>
<mn>2</mn>
<mo>=</mo>
<msubsup>
<mi>C</mi>
<mi>M</mi>
<mi>N</mi>
</msubsup>
<mo>-</mo>
<msubsup>
<mi>C</mi>
<mrow>
<mi>M</mi>
<mo>-</mo>
<mi>p</mi>
<mrow>
<mo>(</mo>
<mn>0</mn>
<mo>)</mo>
</mrow>
</mrow>
<mi>N</mi>
</msubsup>
<mo>+</mo>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>n</mi>
<mo>-</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>N</mi>
<mo>-</mo>
<mn>1</mn>
</mrow>
</munderover>
<mo>[</mo>
<msubsup>
<mi>C</mi>
<mrow>
<mi>M</mi>
<mo>-</mo>
<mi>p</mi>
<mrow>
<mo>(</mo>
<mi>n</mi>
<mo>-</mo>
<mn>1</mn>
<mo>)</mo>
</mrow>
<mo>-</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>N</mi>
<mo>-</mo>
<mi>n</mi>
</mrow>
</msubsup>
<mo>-</mo>
<msubsup>
<mi>C</mi>
<mrow>
<mi>M</mi>
<mo>-</mo>
<mi>p</mi>
<mrow>
<mo>(</mo>
<mi>n</mi>
<mo>)</mo>
</mrow>
</mrow>
<mrow>
<mi>N</mi>
<mo>-</mo>
<mi>n</mi>
</mrow>
</msubsup>
<mo>]</mo>
</mrow></math>
wherein "C" represents the number of combinations; and Σ denotes summation. The meaning of the above formula can be interpreted as: cM N-CM-p(0) NRepresents the total number of P (N) cases in which the 1 st pulse precedes p (0); cM-p(0)-1 N-1-CM-p(1) N-1Represents the total number of cases P (N) that the 2 nd pulse is before p (1) when the 1 st pulse is at p (0); cM-p(n-1)-1 N-n-CM-p(n) N-nThe meanings of (A) can be analogized. It should be noted that the above formula is only one expression of the calculation relationship between I2 and p (n), and the calculation relationship can be equivalently described in other mathematical forms according to the same sorting rule; if different ordering rules are adopted, similar calculation relationships can be correspondingly designed, and the expression mode of the specific calculation relationship does not limit the embodiment of the invention.
To better understand the above calculation method of I2, it is assumed that a pulse relative position vector x (n) { x (1), x (2),.., x (n) }, x (n) and p (n) have the following one-to-one correspondence relationship:
x(1)=p(0);
x(i)=p(i-1)-p(i-2);
x (i) represents the relative position relationship between the ith pulse position and the (i-1) th pulse position, i ∈ [1, N ]. All possible cases P (N) can be constructed in an N-level tree structure by using X (N), the depth of the tree is N +1, and the sub-node of the ith level of the tree represents the relative position value x (i) of the ith pulse position. And (3) placing the values of x (i) from left to right in a descending order, and then coding each tail node in the bottom layer of the tree, namely the tail node from left to right in sequence. Each end node to root node path corresponds to a case of x (n), and thus the encoding of each end node is the second index I2 indicating the corresponding case of p (n).
In the following description, a practical example is given, and it is assumed that the total number M of positions on the track is 16.
For example, if the number of pulse positions pos _ num has a value N of 2, the tree structure is as shown in fig. 19.
Example two, the value N of the number of pulse positions pos _ num is 3, and the tree structure is shown in fig. 20.
When N is 4, 5, and 6, the corresponding tree structures are similar, and the calculation formula of I2 can be analogized, which is not described again.
The embodiment provides a method for obtaining the second index I2 in a calculation relationship, and since the data size occupied by I2 in the coding index is large, the storage capacity of both the coding and decoding can be reduced as much as possible by adopting the calculation method of the embodiment. Meanwhile, since I2 is continuously coded and strictly corresponds to P (N) one to one, the coded bits can be utilized to the maximum extent, and waste is avoided.
Next, the advantages of the coding index structure method in the first coding method and the second coding method are analyzed. Theoretically, on the premise that the total number of pulses _ num to be coded on the same track is fixed, all possible permutation combination numbers of all pulses on the track are the minimum value range of the code index, so that the corresponding coding bit number is the theoretical lower limit value, when the permutation combination number is an integer power of 2, the theoretical lower limit value of the coding bit number is an integer, and when the permutation combination number cannot be expressed as the integer power of 2, the theoretical lower limit value of the coding bit number is a decimal, and at this time, certain coding redundancy exists. When the total number M of positions on the track is 16, under different values of pulse _ num, comparing the theoretical lower limit of the coding bit number, the coding bit number required by using the AMR _ WB + coding scheme, and the bit number required by using the coding index structure scheme in the first coding scheme and the second coding scheme, as shown in table 1:
TABLE 1
As can be seen from the comparison in table 1, the code index structure of the second coding scheme can reach the theoretical lower limit when the theoretical lower limit is an integer; when the theoretical lower limit value is decimal, the integer part reaching the theoretical lower limit value is increased by one. The first coding mode isAnd has the same code bit length as the second coding method. Under the condition of high code rate, the coding efficiency of the two coding modes is higher than that of AMR _ WB +, namely, more bits are saved.
In terms of computational complexity, all test sequences in the reference code of the AVS-M mobile audio standard are used as test objects, and the running time statistics of AMR _ WB +, the first coding mode and the second coding mode are compared (traversing all sample spaces, including the encoding and decoding processes, the first coding mode adopts the computing mode in the second embodiment, the second coding mode adopts the computing mode in the fourth embodiment, and the decoding mode adopts the corresponding mode provided in the subsequent embodiment), as shown in table 2:
TABLE 2
As can be seen from the comparison in table 2, the first encoding scheme has a lower operation complexity in most cases, and the second encoding scheme has an operation complexity equivalent to that of the AMR _ WB + scheme. As can be seen from tables 1 and 2, the first coding scheme and the second coding scheme are used in combination
The low computational complexity of the first coding scheme is utilized, among others
A good effect can be achieved with a low coded bit length of the second coding scheme under the value condition.
The decoding method according to the embodiment of the present invention will be described in detail below.
An embodiment five is a decoding method, where the decoding method provided in this embodiment decodes the coded index obtained according to the coding method in the embodiment one, and a decoding process is an inverse process of the coding process, as shown in fig. 21, and includes:
c1, receiving coding index
C2, indexing from code
The distribution index I4 is extracted.
From
The distribution index I4 can be extracted, and I4 can be constructed into
The reverse process is performed. For example, if I4 stores the set field, it is only necessary to extract it directly.
If signed pulses are encoded, then the coded pulses are also encoded
The symbol index ss (h) corresponding to each pulse is extracted. Because the total bit number of the coded index is different under different code rates, the decoding party can directly determine the total number of the coded pulses on the same track according to the length (bit number) of the coded index
Then according to
From
Extracts a corresponding number of symbol indices ss (h). According to the first embodiment
In the structure of the utility model, the utility model has the advantages of simple structure,
a symbol index is located at
At the end, therefore, can be directly driven from
In (c) isolating each ss (h).
C3 determining the distribution of the positions of the individual pulses on the track according to the distribution index I4
The decoding I4 adopts a process reverse to the encoding I4, and if I4 is obtained by adopting a calculation relation during encoding, the same calculation relation is used for carrying out inverse operation during decoding; if the I4 is obtained by using a query relationship during encoding, the same correspondence relationship may be queried during decoding.
C4 distribution on track according to position of each pulse
The pulse sequence on the track is reconstructed.
In the case of signed pulses, when reconstructing the pulse sequence on the track, the positive or negative characteristic of the pulse sign of each pulse is also recovered according to the pulse sign information carried by each symbol index ss (h).
Sixth embodiment, a decoding method, the present embodiment uses the same decoding logic as the fifth embodiment, and the present embodiment mainly provides a calculation method for decoding the distribution index I4 obtained according to the encoding method of the second embodiment, that is, provides an inverse calculation method of the calculation method of I4 in the second embodiment on the decoding side.
For coding, according to the following:
<math><mrow>
<mi>I</mi>
<mn>4</mn>
<mo>=</mo>
<msubsup>
<mi>C</mi>
<mi>PPT</mi>
<mi>N</mi>
</msubsup>
<mo>-</mo>
<msubsup>
<mi>C</mi>
<mrow>
<mi>PPT</mi>
<mo>-</mo>
<mi>q</mi>
<mrow>
<mo>(</mo>
<mn>0</mn>
<mo>)</mo>
</mrow>
</mrow>
<mi>N</mi>
</msubsup>
<mo>+</mo>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>h</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>N</mi>
<mo>-</mo>
<mn>1</mn>
</mrow>
</munderover>
<mo>[</mo>
<msubsup>
<mi>C</mi>
<mrow>
<mi>PPT</mi>
<mo>-</mo>
<mi>h</mi>
<mo>-</mo>
<mi>q</mi>
<mrow>
<mo>(</mo>
<mi>h</mi>
<mo>-</mo>
<mn>1</mn>
<mo>)</mo>
</mrow>
</mrow>
<mrow>
<mi>N</mi>
<mo>-</mo>
<mi>h</mi>
</mrow>
</msubsup>
<mo>-</mo>
<msubsup>
<mi>C</mi>
<mrow>
<mi>PPT</mi>
<mo>-</mo>
<mi>h</mi>
<mo>-</mo>
<mi>q</mi>
<mrow>
<mo>(</mo>
<mi>h</mi>
<mo>)</mo>
</mrow>
</mrow>
<mrow>
<mi>N</mi>
<mo>-</mo>
<mi>h</mi>
</mrow>
</msubsup>
<mo>]</mo>
</mrow></math> the resulting I4, when decoded, used:
calculating q (0) from small to large in sequence
Wherein q (0) ∈ [0, M >]M is the total number of positions on the track,
the total number of pulses encoded on the same track,
"C" represents the number of combinations; record the last order T [ q (0)]The q (0) value larger than zero is used as the position serial number v0 of the 1 st pulse on the track;
② if
Then continue to calculate in order from small to large q (1)
Wherein q (1) ∈ [ v0, M](ii) a Record the last order T1[ q (1)]The q (1) value greater than zero is used as the position serial number v1 of the 2 nd pulse on the track;
thirdly, by analogy, calculating according to the sequence of q (h) from small to large
Wherein q (h) epsilon [ v (h-1), M],
Record the last line Th [ q (h)]The value of q (h) greater than zero is used as the position index vh of the h +1 th pulse on the track.
An embodiment seven is a decoding method, where the decoding method provided in this embodiment decodes the coded index obtained according to the coding method in the embodiment three, and a decoding process is an inverse process of the coding process, as shown in fig. 22, and includes:
d1, determining received code index
Total number of pulses encoded on the same track
The decoding method can directly depend on the length of the coding indexDegree (number of bits) determining the total number of pulses encoded on the same track
Of course, the decoding party can also know the corresponding code index before receiving the code index by the method appointed by the encoding party
Value (e.g., known by mutual information between two parties before receiving the code index), the embodiment is right
The specific manner of learning is not limiting.
D2, according to
Selecting a decoding mode, wherein the decoding mode comprises a first decoding mode; and executing the step D3 or the step D4 according to the selection result.
The decoding manner described in the fifth embodiment is referred to as a first decoding manner herein. The optional decoding method may include other decoding methods besides the first decoding method, and various optional decoding methods need to correspond to the encoding method provided by the encoding party. In this embodiment, a second decoding method corresponding to the second encoding method is specifically provided.
The decoding party adopts the rule corresponding to the encoding party to select the decoding mode, and the consistency of the encoding and decoding modes is ensured.
And D3, according to the result of the decoding mode selection, after determining to select the first decoding mode, decoding according to the first decoding mode. And executing the step of extracting the distribution index from the coding index.
The specific decoding process can be performed as described in embodiment five.
D4, according to the result of decoding mode selection, after determining to select the second decoding mode, decoding according to the second decoding mode, including the following steps:
d41, from
The first index I1 is extracted, and the number of positions pos _ num with pulses is determined according to I1.
Because the total bit number of the coded index is different under different code rates, the decoding party can directly determine the total number of the coded pulses on the same track according to the length (bit number) of the coded index
From
The information of each index is extracted, and each index can be combined with the information of each index during coding
The reverse process is performed. For example, if the indexes are stored in fixed fields separately, the indexes may be extracted separately.
If it is
With the structure provided in the third embodiment in which I1 is used as the start value to superimpose other indexes, I1 can be extracted first, and the other indexes are determined to be in the pos _ num value N corresponding to I1
Of (c) is used. In this case, since one I1 corresponds to
Therefore, the decoding side can judge from a plurality of set independent value ranges
And determining a first index I1 according to the initial value corresponding to the belonged value range.
D42, indexing from code
Extracting second and third indexes I2 and I3;
similar to I1, the extracts of I2 and I3 are also combined into
The reverse process is carried out, and can be directly extracted when independently placed. If the coding mode of combining and then overlapping in the third embodiment is adopted for I2 and I3, the following steps can be adopted for separation:
coding index
Extracting a combined value I23 of I2 and I3;
i23 is inThe storage position of (a) may be indicated by the value of N determined by I1.
② I2 and I3 are separated in the following way,
I2=I23%W(N),I3=Int[I23/W(N)];
wherein w (N) is the total number of all possible cases of pos _ num ═ N, p (N), m is the total number of positions on the track; % represents the remainder; int denotes rounding.
D43, if the coded pulse is signed pulse, it needs to be selected from
The symbol index s (n) corresponding to each pulse position is extracted.
As provided in example three
Structure, N symbol indexes are located at
End, and thus may be directly accessed after obtaining the value of N indicated by I1
In (c) isolating each s (n).
D44, determined by the second index I2, having a distribution p (N) of pulse positions on the track at pos _ num ═ N;
the decoding I2 adopts a process reverse to the encoding I2, and if I2 is obtained by adopting a calculation relation during encoding, the same calculation relation is used for carrying out inverse operation during decoding; if the I2 is obtained by using a query relationship during encoding, the same correspondence relationship may be queried during decoding.
D45, determining the pulse number SU (N) of each pulse position according to a third index I3; the principle of decoding I3 is similar to I2.
D46, reconstructing the pulse sequence on the track according to the distribution p (n) of the positions with pulses on the track and the number su (n) of pulses at each position with pulses.
In the case of signed pulses, when reconstructing the pulse sequence on the track, the positive or negative characteristic of each pulse symbol with a pulse position is recovered according to the pulse symbol information carried by each symbol index s (n).
An eighth embodiment of the present invention is a decoding method, and the present embodiment adopts the same decoding logic as the seventh embodiment, and the present embodiment mainly provides a calculation method for decoding the second index I2 obtained according to the encoding method of the fourth embodiment in the second decoding manner, that is, provides an inverse calculation method on the decoding side of the calculation method of I2 in the fourth embodiment.
For when coding, according to <math><mrow>
<mi>I</mi>
<mn>2</mn>
<mo>=</mo>
<msubsup>
<mi>C</mi>
<mi>M</mi>
<mi>N</mi>
</msubsup>
<mo>-</mo>
<msubsup>
<mi>C</mi>
<mrow>
<mi>M</mi>
<mo>-</mo>
<mi>p</mi>
<mrow>
<mo>(</mo>
<mn>0</mn>
<mo>)</mo>
</mrow>
</mrow>
<mi>N</mi>
</msubsup>
<mo>+</mo>
<munderover>
<mi>Σ</mi>
<mrow>
<mi>n</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>N</mi>
<mo>-</mo>
<mn>1</mn>
</mrow>
</munderover>
<mo>[</mo>
<msubsup>
<mi>C</mi>
<mrow>
<mi>M</mi>
<mo>-</mo>
<mi>p</mi>
<mrow>
<mo>(</mo>
<mi>n</mi>
<mo>-</mo>
<mn>1</mn>
<mo>)</mo>
</mrow>
<mo>-</mo>
<mn>1</mn>
</mrow>
<mrow>
<mi>N</mi>
<mo>-</mo>
<mi>n</mi>
</mrow>
</msubsup>
<mo>-</mo>
<msubsup>
<mi>C</mi>
<mrow>
<mi>M</mi>
<mo>-</mo>
<mi>p</mi>
<mrow>
<mo>(</mo>
<mi>n</mi>
<mo>)</mo>
</mrow>
</mrow>
<mrow>
<mi>N</mi>
<mo>-</mo>
<mi>n</mi>
</mrow>
</msubsup>
<mo>]</mo>
</mrow></math> The resulting I2, when decoded, used:
(ii) subtracting C from I2 one by oneM-1 N-1,...,CM-y0 N-1,
The remainder R (y0) until I2 changes from positive to negative; wherein M is the total number of positions on the track, N is the number of positions with pulses, y0 belongs to [1, M-N +1], and 'C' represents the number of combinations; the position number p (0) of the 1 st pulse position on the recording track is y 0-1;
② if N is more than 1, continue to select from R [ p (0)]In one by one subtract CM-p(0)-1 N-2,...,CM-p(0)y1 N-2Until R [ p (0)]The residue value R1(x1) is changed from positive to negative; the 2 nd position number p (1) with pulse position on the recording track is y 1-1;
③ by analogy, from R (n-1) [ p (n-1)]In one by one subtract CM-p(0)-...-p(n-1)-1 N-n-2,...,CM-p(0)-...-p(n-1)-yn N-n-2Until R (n-1) [ p (n-1)]The remainder Rn (yn) of (2) changes from positive to negative; wherein N is less than or equal to N-1; the n +1 th position number p (n) yn-1 having a pulse position on the recording track.
Decoding I2 is complete, obtaining p (N) { p (0), p (1),.., p (N-1) }.
It should be understood that software implementing the encoding and decoding methods of the present invention may be stored in a computer readable medium.
When the coding software is executed, the method comprises the following steps: counting the pulses to be coded on the track according to positions to obtain distribution information of the positions of the pulses on the track; determining a distribution index, wherein the distribution index is calculated according to the following mode: according to a set sequence, arranging all possible distribution situations of the positions of all pulses on the track under the current pulse number, and taking the arranged serial numbers as distribution indexes for indicating the corresponding distribution situations; and generating a coding index, wherein the coding index comprises the information of the distribution index.
When the decoding software is executed, the method comprises the following steps: receiving a coding index; extracting a distribution index from the coding index; determining the distribution of the positions of the pulses on the track according to the distribution index; the pulse sequence on the track is reconstructed according to the distribution of the positions of the individual pulses on the track.
The readable medium is as follows: ROM/RAM, magnetic disk, optical disk, etc.
The codec according to the embodiment of the present invention will be described in detail below.
Ninth embodiment, an encoder 10, as shown in fig. 23, includes:
a first
statistical unit 11, configured to perform statistics on the pulses to be encoded on the track according to positions to obtain distribution information of the positions of the pulses on the track
When counting the pulses with the signs, the
first counting unit 11 also outputs information of the sign index corresponding to each pulse according to the positive or negative characteristic of the sign of the pulse of each pulse
The symbol index indicates pulse symbol information of a pulse corresponding to the index;
distribution indexUnit 12 for following
Determining the distribution index I4, I4 is calculated as follows: arranging all possible distribution situations of the positions of the pulses on the track under the current pulse number according to a set sequence, and taking the arranged sequence number as I4 for indicating the corresponding distribution situation;
an
index generating unit 13 for generating a coding index
Information including a distribution index I4; when encoding the signed pulses, the
index generation unit 13 also indexes the information of the symbol corresponding to each pulse
Is combined to
In (1).
The encoding apparatus of the present embodiment can be used in the encoding methods provided in the first and second embodiments.
Embodiment ten, an encoder 20, as shown in fig. 24, includes a first encoding module 21, a second encoding module 22 and an encoding selection unit 23,
a code selection unit 23 for determining the total number of pulses to be coded on the same track
According to
Selecting a coding mode, wherein the selectable coding modes in the embodiment include a first coding mode and a second coding mode; according to the result of the coding mode selection, inAfter determining that the first encoding mode is selected, the first encoding module 21 is triggered to start encoding, and after determining that the second encoding mode is selected, the second encoding module 22 is triggered to start encoding.
The first encoding module 21 includes a first statistical unit 211, a distribution index unit 212, and an index generating unit 213, and is the same as the logic structure of the unit with the same name in the ninth embodiment.
The second encoding module 22 includes:
a second statistical unit 221, configured to perform statistics on pulses to be encoded on the track according to positions, and output the number N of pulse positions, the distribution p (N) of the pulse positions on the track, and the number su (N) of pulses at each pulse position; when counting signed pulses, the second counting unit 221 further outputs corresponding pulse sign information s (n) according to the positive or negative characteristic of each pulse sign with a pulse position;
the index calculation unit 222 includes:
a first index unit 2221 for outputting a first index I1 according to the number N of pulse positions, I1 corresponding to all possible distribution situations of pulse positions on the track for the same number of pulse positions;
a second index unit 2222, configured to output a second index I2 according to the distribution p (n) of the pulse positions on the track, where I2 indicates, from all possible distribution cases corresponding to the first index, a distribution case corresponding to the distribution of the current pulse positions;
a third indexing unit 2223 for outputting a third index I3 in accordance with the pulse number su (n) at each pulse position;
an index combining unit 223 for combining the information of the first, second, and third indexes to generate a coded index; when encoding the signed pulse, the index combining unit 223 further combines information s (n) of the symbol index corresponding to each of the pulse-present positions, which indicates the pulse symbol information of the pulse-present position corresponding to the index, into the encoding index.
When encoding is performed according to the encoding index structure provided in the second encoding method in the third embodiment, the index combining unit 223 may adopt a structure including:
a first combination unit 2231 for outputting a second and third index combined as I23,
I23=I3×W(N)+I2;
w (N) is the total number of all possible distribution situations of the pulse positions on the track, where N is the number of pulse positions corresponding to the first index.
A
second combination unit 2232 for overlapping the output of the
first combination unit 2231 with information of other indexes and outputting a coded index
The encoding apparatus of the present embodiment can be used in the encoding methods provided in the third and fourth embodiments.
Eleventh embodiment, a decoder 30, as shown in fig. 25, includes:
an
input unit 31 for receiving the code index
A
distribution extraction unit 32 for extracting a distribution from the coded index
Extracting a distribution index I4;
a
distribution decoding unit 33 for indexing according to the distribution
Determining the distribution of the positions of individual pulses on the track
A
distribution reconstruction unit 34 for distributing the pulses on the track according to their positions
The pulse sequence on the track is reconstructed.
In decoding the signed pulse, the decoder needs to further include:
a
symbol extraction unit 35 for extracting the total number of pulses encoded in the same track
From the coded index
Extracting the symbol index corresponding to each pulse
The symbol index indicates pulse symbol information of a pulse corresponding to the index;
the distribution reconstruction unit 34 then followsThe indicated pulse sign information restores the positive or negative characteristic of the pulse sign of each pulse.
The decoding apparatus of the present embodiment can be used in the decoding methods provided in the fifth and sixth embodiments.
Twelfth embodiment, a decoder 40, as shown in fig. 26, includes a first decoding module 41, a second decoding module 42, and a decoding selection unit 43:
a decoding selection unit 43 for determining the received code index
On the same trackTotal number of pulses encoded
According to
Selecting a decoding mode, wherein the selectable decoding modes in the embodiment include a first decoding mode and a second decoding mode; according to the result of the decoding mode selection, the first decoding module 41 is triggered to start decoding after the first decoding mode is determined to be selected, and the second decoding module 42 is triggered to start decoding after the second decoding mode is determined to be selected.
The first decoding module 41 includes a distribution extracting unit 412, a distribution decoding unit 413, a distribution reconstructing unit 414, and a sign extracting unit 415, and is the same as the logic structure of the unit with the same name in the eleventh embodiment.
The second decoding module 42 includes:
a first extraction unit 421 for receiving the coding index
From
Extracting a first index I1, and determining the number N of pulse positions according to I1;
a second extraction unit 422 for extracting the index from the code
Extracting second and third indexes I2 and I3;
when decoding the coding index structure provided by the second coding method in the third embodiment, the second extracting unit 422 may adopt the following structure, including:
a separating subunit 4221, configured to extract a combined value I23 of the second and third indexes from the coded index;
a resolving subunit 4222 for separating and outputting the second and third indexes I2 and I3,
I2=I23%W(N),I3=Int[I23/W(N)];
wherein w (N) is the total number of all possible distribution situations of the pulse positions on the track, given the number N of pulse positions corresponding to the first index; % represents the remainder; int denotes rounding.
A first decoding unit 423, configured to determine, according to the second index I2, a distribution p (N) of the positions with pulses on the track under the number N of positions with pulses corresponding to I1;
a second decoding unit 424, configured to determine, according to the third index I3, the number of pulses su (n) at each pulse position;
a pulse reconstruction unit 425 for reconstructing the pulse sequence on the track according to the distribution p (n) of the positions with pulses on the track and the number of pulses su (n) at each position with pulses.
In decoding the signed pulse, the decoder needs to further include:
a third extraction unit 426 for extracting N pulses from the pulse position
Extracting symbol indexes s (n) corresponding to the pulse positions, wherein the symbol indexes indicate pulse symbol information of the pulse positions corresponding to the indexes;
at this time, the pulse reconstruction unit 425 may adopt a structure including:
a first reconstruction unit 4251 for restoring the positive or negative characteristic of the pulse symbol of each pulsed position according to the distribution p (n) of the pulsed positions on the track and the symbol index s (n) corresponding to each pulsed position;
a second reconstruction unit 4252 for reconstructing the pulse sequence on the track according to the distribution of the respective signed pulse positions output by the first reconstruction unit 251 and the number of pulses su (n) at the respective signed pulse positions.
The decoding apparatus of the present embodiment can be used in the decoding methods provided in the seventh and eighth embodiments.
To better understand the above embodiments, specific examples of encoding and decoding are given below, wherein the encoding uses the third encoding method (the first encoding method uses the second calculation method, and the second encoding method uses the fourth calculation method), the decoding uses the seventh decoding method (the first decoding method uses the sixth calculation method, and the second decoding method uses the eighth calculation method), and the selection condition of the first encoding/decoding method is assumed to be
The total number of positions M on the track is 16.
For example, the pulse search result shown in fig. 8 is coded and decoded.
A. Encoding
①
Determining to adopt the second coding mode for coding,
21 bits are required
Statistics N, P (N), SU (N), S (N)
N=1;
P(1)={p(0)}={2};
SU(1)={su(0)}={6};
S(1)={s(0)}={0};
Coding I1, I2, I3 and I23
As shown in fig. 7, I1 is 0x1F0000 when N is 1;
according to the calculation method of example four, I2 ═ 2;
class (1) ═ 1, I3 ═ 0; therefore, I23 ═ I2 ═ 2;
<math><mrow>
<mo>=</mo>
<mn>0</mn>
<mi>x</mi>
<mn>1</mn>
<mi>F</mi>
<mn>0000</mn>
<mo>+</mo>
<mn>2</mn>
<mo>×</mo>
<mn>2</mn>
<mo>+</mo>
<mn>0</mn>
</mrow></math>
B. Decoding
Firstly receive
Determination based on code length
Determining to adopt a second decoding mode for decoding;
② extracts I1, s (n) and I23
According to
As shown in fig. 7, I1 ═ 0x1F0000, and N ═ N1; separating according to N ═ 1
The last 1 bit, s (0) ═ 0;
the separation of the I23 is carried out,
"> k" indicates a shift by k bits to the left;
decoding I23
According to the formula that N is equal to 1,
i3 ═ Int [ I23/W (1) ] -0, corresponding to the only case of SU (1): SU (1) {6 };
i2 ═ I23% W (1) ═ 2; according to the calculation method of the embodiment eight, P (1) ═ { P (0) } ═ 2 };
recovery of pulse sequence
As indicated by P (1) {2}, SU (1) {6}, and s (0) } 0, "6" positive pulses are present at position "2". And finishing the decoding process.
Example two, the pulse search result shown in fig. 27 is coded and decoded.
A. Encoding
①
Determining to adopt a first coding mode for coding,
19 bits are required
Q(5)={q(0),q(1),q(2),q(3),q(4)}={1,1,4,6,6};
SS(5)={ss(0),ss(1),ss(2),ss(3),ss(4)}={0,0,0,0,0};
Coding I4
According to the calculation method of the second embodiment,
<math><mrow>
<mi>Index</mi>
<mrow>
<mo>(</mo>
<mn>5</mn>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mi>I</mi>
<mn>4</mn>
<mo>×</mo>
<msup>
<mn>2</mn>
<mn>5</mn>
</msup>
<mo>+</mo>
<mi>ss</mi>
<mrow>
<mo>(</mo>
<mn>0</mn>
<mo>)</mo>
</mrow>
<mo>×</mo>
<msup>
<mn>2</mn>
<mn>4</mn>
</msup>
<mo>+</mo>
<mi>ss</mi>
<mrow>
<mo>(</mo>
<mn>1</mn>
<mo>)</mo>
</mrow>
<mo>×</mo>
<msup>
<mn>2</mn>
<mn>4</mn>
</msup>
<mo>+</mo>
<mo>.</mo>
<mo>.</mo>
<mo>.</mo>
<mo>+</mo>
<mi>ss</mi>
<mrow>
<mo>(</mo>
<mn>4</mn>
<mo>)</mo>
</mrow>
</mrow></math>
<math><mrow>
<mo>=</mo>
<mn>4215</mn>
<mo>×</mo>
<msup>
<mn>2</mn>
<mn>5</mn>
</msup>
<mo>+</mo>
<mn>0</mn>
</mrow></math>
B. Decoding
Firstly receive
Determination based on code length
Determining to decode by adopting a first decoding mode; (ii) a
Extraction of
According to
Separation of
The last 5 bits, ss (0) -ss (4) being 0;
the separation of the I4 is carried out,
decoding I4
According to the calculation method of the sixth embodiment, Q (5) {1, 1, 4, 6, 6 };
recovery of pulse sequence
As Q (5) {1, 1, 4, 6, 6}, and ss (0) -ss (4) } 0, there are "2" positive "pulses at position" 1 "," 1 "positive" pulses at position "4", and "2" positive "pulses at position" 6 ". And finishing the decoding process.
It can be seen from the above embodiments that the method for sorting and encoding the pulses to be encoded according to the distribution of the positions of the pulses on the track is adopted in the embodiments of the present invention, which can effectively reduce the computational complexity, and meanwhile, since the encoding is performed according to the sorting, different pulse distribution situations correspond to continuous encoding, which can possibly reduce the computational complexityThe redundancy of the coding is reduced, and coding bits are saved. Furthermore, the first and second coding modes provided in the embodiment of the invention are comprehensively adopted, so that the two coding modes are different
The advantages under the value are mutually complemented, and the effect is more obvious.
The present invention provides a method and a codec, which are described in detail above, and the present invention is described in principle and embodiments by using specific examples, and the description of the above embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.