DIGITAL SIGNAL COMPRESSION ENCODING WITH IMPROVED QUANTISATION

Abstract: In compression encoding of a digital signal, such as MPEG2, transform coefficients are quantised with the lower bound of each interval being controlled by a parameter lambda . In the MPEG2 reference coder, for example, lambda =0.75. Because the quantised coefficients are variable length coded, improved quality or reduced bit rates can be achieved by controlling lambda so as to vary dynamically the bound of each interval with respect to the associated representation level. The parameter lambda can vary with coefficient amplitude, with frequency, with quantisation step size. In a transcoding operation, lambda can also vary with parameters in the initial coding operation.

Description: DIGITAL SIGNAL COMPRESSION ENCODING WITH IMPROVED QUANTISATION This invention relates to the compression of digital video, audio or other signals. Compression encoding generally involves a number of separate techniques. These will usually include a transformation, such as the block- based discrete cosine transform (DCT) of MPEG-2; an optional prediction step; a quantisation step and variable length coding. This invention is particularly concerned in this context with quantisation. The quantisation step maps a range of original amplitudes onto the same representation level. The quantisation process is therefore irreversible. MPEG-2, (in common with other compression standards such as MPEG-1 , JPEG, CCITT/ITU-T Rec.H.261 and ITU-T Rec.H.263) defines representation levels and leaves undefined the manner in which the original amplitudes are mapped onto a given set of representation levels. In general terms, a quantizer assigns to an input value, which may be continuous or may previously have been subjected to a quantisation process, a code usually selected from quantization levels immediately above and immediately below the input value. The error in such a quantization will generally be minimised if the quantization level closest to the input value is selected. In a compression system, it is further necessary to consider the efficiency with which respective quantization levels may be coded. In variable length coding, the quantization levels which are employed most frequently are assigned the shortest codes. Typically, the zero level has the shortest code. A decision to assign a higher quantization level, on the basis that it is the closest, rather than a lower level (and especially the zero level) will therefore decrease coding efficiency. In MPEG2, the overall bit rate of the compressed signal is maintained beneath a pre-determined limit by increasing the separation of quantization levels in response to a tendency toward higher bit rate. Repeated decisions to assign quantization levels on the basis of which is closest, may through coding inefficiency thus lead to a coarser quantization process. The behaviour of a quantizer in this respect may be characterised through a parameter λ which is arithmetically combined with the input value, with one value of λ (typically λ = 1) representing the selection of the closest quantization level or "rounding". A different value of λ (typically λ = 0) will in contrast represent the automatic choice of the lower of the two nearest quantization levels, or "truncating". In the MPEG2 reference coder, an attempt is made to compromise between the nominal reduction in error which is the attribute of rounding and the tendency toward bit rate efficiency which is associated with truncating, by setting a standard value for λ of λ = 0.75. Whilst particular attention has here been paid to MPEG2 coding, similar considerations apply to other methods of compression encoding of a digital signal, which including the steps of conducting a transformation process to generate values and quantising the values through partitioning the amplitude range of a value into a set of adjacent intervals, whereby each interval is mapped onto a respective one of a set of representation levels which are to be variable length coded, such that a bound of each interval is controlled by a parameter λ. The transformation process may take a large variety of forms, including block-based transforms such as the DCT of MPEG2, and sub-band coding. It is an object of one aspect of the present invention to provide an improvement in such a method which enables higher quality to be achieved at a given bitrate or a reduction in bitrate for a given level of quality. Accordingly, the present invention is in one aspect characterised in that λ is controlled so as to vary dynamically the bound of each interval with respect to the associated representation level. Suitably, wherein each value is arithmetically combined with λ. Advantageously, λ is : a function of the quantity represented by the value; where the transformation is a DCT, a function of horizontal and vertical frequency; a function of the quantisation step size; or a function of the amplitude of the value. In a particular form of the present invention, the digital signal to be encoded has been subjected to previous encoding and decoding processes and λ is controlled as a function of a parameter in said previous encoding and decoding processes. In a further aspect, the present invention consists in a (q, λ) quantiser operating on a set of transform coefficients x k representative of respective frequency indices f k in which λ is dynamically controlled in dependence upon the values of XR and f . Advantageously, λ is dynamically controlled to minimise a cost function D + μH where D is a measure of the distortion introduced by the quantisation in the uncompressed domain and H is a measure of compressed bit rate. The invention will now be described by way of example with reference to the accompanying drawings, in which:- Figure 1 is a diagram illustrating the relationships between representation levels, decision levels and the value of λ; Figure 2 is a block diagram representation of the quantization process in the MPEG2 reference coder; Figure 3 is a block diagram representation of a simplified and improved quantization process; Figure 4 is a block diagram representation of the core elements of Figure 3; Figure 5 is a block diagram representation of a quantization process according to one aspect of the present invention; and Figure 6 is a block diagram representation of a quantization process according to a further aspect of the present invention. In the specifically mentioned compression standards, the original amplitude x results from a discrete cosine transform (DCT) and is thus related to a horizontal frequency index f hor and a vertical frequency index f ver - Whilst this approach is taken as an example in what follows, the invention is not restricted in this regard. In general, a quantiser describes a mapping from an original amplitude x of frequencies f or and f ver onto an amplitude y = Q(x). The mapping performed by the quantiser is fully determined by the set of representation levels {r and by the corresponding decision levels {d# as illustrated in Figure 1. All original amplitudes in the range d / ≤ x < d ( ι +1) are mapped onto the same representation level y - Q(x) = η. As can be seen from Figure 1 , consecutive decision levels are related by the quantisation step size q: and for a given representation level η, the corresponding decision level is calculated as: dι = rι - j . q (2) The quantiser is fully specified by the quantisation step-size q and the parameter λ for a given set of representation levels {rι}. Therefore, a quantiser that complies with equations (1) and (2) can be referred to as a (q,λ) quantiser. Currently proposed quantisers, as described in the reference coders for the H.261 , H.263, MPEG-1 and MPEG-2 standards, all apply a special type of (q, λ) quantiser in that a fixed value of λ is used: for example λ = 0.75 in the MPEG-2 reference coder or λ = 1.0 in the MPEG-1 reference coder for quantisation of intra-DCT-coefficients. According to one aspect of this invention, λ is not constant but is a function that depends on the horizontal frequency index f hor , the vertical frequency index f ve the quantisation step-size q and the amplitude x: λ = fhor. f ver > q> x) (3) Examples of ways in which the function may usefully be derived to improve picture quality in video compression at a given bit-rate - or to reduce the required bit-rate at a given picture quality - will be set out below. The invention extends also to the case of transcoding when a first generation amplitude y-i - Qι(x) is mapped onto a second generation amplitude y 2 = Q∑fyi) to further reduce the bit-rate from the first to the second generation without having access to the original amplitude x. In this case the first generation quantiser Qi and the second generation quantiser Q 2 are described as a (qi, λ-ι)-type quantiser and a (q 2 , λ^-type quantiser, respectively. The second generation λ 2 value is described as a function: λ 2 = λ 2 (f hor , f ver , <?,, λ,, q 2 , λ 2 .ref , y,) (4) The parameter λ 2 , r e f that appears in Eqn. (4) is applied in a reference fa, λ 2, r e β)-type quantiser. This reference quantiser bypasses the first generation and directly maps an original amplitude x onto a second generation reference amplitude y2, ef = Q2,ret(x)- The functional relationship of Eqn. (4) can be used to minimise the error (y 2 - y ∑ .r ef ) or the error (y 2 - x). In the first case, the resulting second generation quantiser may be called a maximum a-pσsteriori (MAP) quantiser. In the second case, the resulting second generation quantiser may be called a mean squared error (MSE) quantiser. Examples of the second generation (q 2 , λ 2, ΛP -type and (q 2 , λ^ M seMype quantisers are given below. For a more detailed explanation of the theoretical background, reference is directed to the paper "Transcoding of MPEG-2 intra frames" - Oliver Werner - IEEE Transactions on Image Processing 1998, which will for ease of reference be referred to hereafter as "the Paper". A copy of the Paper is appended to British patent application No. 9703831 from which the present application claims priority. The present invention refers specifically to quantization of 'intra' DCT coefficients in MPEG2 video coding but can be applied to non-intra coefficients, to other video compression schemes and to compression of signals other than video. In MPEG2, the prior art is provided by what is known as Test Model 5 (TM5). The quantization scheme of TM5 for positive intra coefficients is illustrated in Figure 2. In order to simplify the description, the above diagram will be replaced by Figure 3, which illustrates essentially the same quantizer except for small values of q, where it corrects an anomaly as described in the Paper. In this quantizer, the incoming coefficients are first divided by quantizer weighting matrix values, W, which depend on the coefficient frequency but which are fixed across the picture, and then by a quantizer scale value q which can vary from one macroblock to the next but which is the same for all coefficient frequencies. Prior to the adder, the equivalent inverse quantizer reconstruction levels are simply the integers 0, 1 , 2 ... . A fixed number λ/2 , is then added to the value and the result truncated. The significance of λ is that a value of 0 makes the quantizer (of the value input to the adder) a simple truncation, while a value of 1 makes it a rounding operation. In TM5, the value of λ is fixed at 0.75. Attention will hereafter be focused on the operation of the 'core' quantizer shown in Figure 4. In a class of MPEG-2 compatible quantisers for, intra frame coding, non-negative original dct-coefficients x ( or the same coefficents after division by weighting matrix values W) are mapped onto the representation levels as: y = Q(x) = L £ + _| . ? (5) q z The floor function /aVextracts the integer part of the given argument a. Negative values are mirrored: y = - Q (\ χ \) (6) The amplitude range of the quantisation step-size q in eq. (1) is standardised; q has to be transmitted as side information in every MPEG-2 bit stream. This does not hold for the parameter λ in eq. (1). This parameter is not needed for reconstructing the dct-coefficients from the bit stream, and is therefore not transmitted. However, the λ-value controls the mapping of the original dct-coefficients x onto the given set of representation levels rι - l . q (7) According to eq. (1), the (positive) x-axis is partitioned by the decision levels f λλ d, = / - - . q I = 1, 2, .... (8) V 2J Each x <= [ d|, d ι +1 ) is mapped onto the representation level y = η. As a special case, the interval [0, d ) is mapped onto y = 0. The parameter λ can be adjusted for each quantisation step-size q, resulting in a distortion rate optimised quantisation: the mean-squared-error D = E [(x - y) 2 ] (9) is minimised under a bit rate constraint imposed on the coefficients y. In order to simplify the analysis, the first order source entropy H = Σ, - P, . log, P, (10) of the coefficients y instead of the MPEG-2 codeword table is taken to calculate the bit rate. It has been verified in the Paper that the entropy H can be used to derive a reliable estimate for the number of bits that result from the MPEG-2 codeword table. In Eqn. (10), P / denotes the probability for the occurrence of the coefficient y=η. The above constrained minimisation problem can be solved by applying the Lagrange multiplier method, introducing the Lagrange multiplier μ. One then gets the basic equation to calculate the quantisation parameter λ: 3D OH — + μ. — = 0 (11) dλ μ dλ Note, that the solution for λ that one obtains from Eqn. (11) depends on the value of μ. The value of μ is determined by the bit rate constraint H ≤ Ho (12) where H 0 specifies the maximum allowed bit rate for encoding the coefficients y. In general, the amplitude range of the Lagrange multiplier is 0 < μ < oo. In the special case of H 0 → ∞, one obtains μ → 0. Conversely for Ho → 0, one obtains in general μ → oo. The Laplacian probability density function (pdf) is an appropriate model for describing the statistical distribution of the amplitudes of the original dct- coefficients. This model is now applied to evaluate analytically Eqn. (11). One then obtains a distortion-rate optimised quantiser characteristic by inserting the resulting value for λ in eq. (5). Due to the symmetric quantiser characteristic for positive and negative amplitudes in Eqns. (5) and (6), we introduce a pdf p for describing the distribution of the absolute original amplitudes |x|. The probability P 0 for the occurrence of the coefficient y = 0 can then be specified as i --1 -) Po = \ p(x)dx (13) 0 Similarly, the probability P / for the coefficient \y becomes P, - J p(x)ώ I - 1.2. (1 ) { ■ $ ■ < With Eqns. (13) and (14), the partial derivative of the entropy Hofeq. (10) can be written after a straightforward calculation as 3H dλT (15) From eq. (9) one can first deduce Λ λ (i- ).g (i + ι- 2 )q D = { x 2 . p(x)dx + ∑ J " (x - Lc i) 2 -P(x)dx (16) o l≥I „ λ and further from eq. (16) 3D -q 3 (, λ) It can be seen from eq. (17) that 3D — ≥O ifO≤λ≤l (18) όλ Thus, when λ is increased from zero to one, the resulting distortion D is monotonically decreasing until the minimum value is reached for λ = 1. The latter is the solution to the unconstrained minimisation of the mean- squared-error, however, the resulting entropy H will in general not fulfil the bit rate constraint of eq. (12). Under the assumption of P, ≥ PM in eq. (15), we see that cHldk≥ Q. Thus, there is a monotonic behaviour: when λ is increased from zero to one, the resulting distortion D monotonically decreases, at the same time the resulting entropy H montonically increases. Immediately, an iterative algorithm can be derived from this monotonic behaviour. The parameter λ is initially set to λ = 7, and the resulting entropy H is computed. If H is larger than the target bit rate H 0 , the value of λ is decreased in further iteration steps until the bit rate constraint, eq. (12), is fulfilled. While this iterative procedure forms the basis of a simplified distortion-rate method proposed for transcoding of l-frames, we continue to derive an analytical solution for λ. Eqns. (15) and (17) can be evaluated for the Laplacian model: p(x) = β. a. e" if x > d, = \ 1 - j.q (19) After inserting the model pdf of Eqn. (19) in Eqns. (15) and (17), it can be shown that the basic equation (11) leads then to the analytical solution for λ, Po λ = 1 - — 2 . h(z) + (1 - z) . log. ( (20) q 1 - Pc with z = e "a q and the 'z'-entropy h(z) = -zλog 2 z - (1 -z) . log / - z) (21) Eqn. (20) provides only an implicit solution for λ, as the probability P 0 on the right hand side depends on λ according to eq. (13). In general, the value of P 0 can be determined only for known λ by applying the quantiser characteristic of Eqns. (5) and (6) and counting the relative frequency of the event y = 0. However, eq. (20) is a fixed-point equation for λ which becomes more obvious if the right hand side is described by the function Po g(V = ι- - h(z) + (1 -z) . log, (22) U - Po) resulting in the classical fixed-point form λ = g(λ). Thus, it follows from the fixed point theorem of Stefan Banach that the solution for λcan be found by an iterative procedure with in the + 1)-th iteration step. The iteration of (23) converges towards the solution for an arbitrary initial value λo if the function g is 'self-contracting', i.e. Lipschitz-continuous with a Lipschitz-constant smaller than one. As an application of the mean theorem for the differential calculus, it is not difficult to prove that g is always 'self-contracting' if the absolute value of the partial derivative is less than one. This yields the convergence condition 1 μ a ; > (24) dλ 2 . ln(2) - ~ q ~ ' (I ' Z) - T 0 A distortion-rate optimised quantisation method will now be derived based on the results obtained above. As an example, a technique is outlined for quantising the AC-coefficients of MPEG-2 intra frames. It is straightforward to modify this technique for quantising the dct-coefficients of MPEG-2 inter frames, i.e. P- and B-frames. Firstly, one has to take into account that the 63 AC-coefficients of an 8x8 dct-block do not share the same distribution. Thus, an individual Laplacian model pdf according to eq. (19) with parameter a-, is assigned to each AC-frequency index /. This results in an individual quantiser characteristic according to Eqns. (5) and (6) with parameter λ,-. Furthermore, the quantisation step-size q, depends on the visual weight w, and a frequency-independent qscale parameter as w, . qscαle ?, (25) Ϊ6 For a given step-size q h the quantisation results in a distortion Dj(λj) and a bit rate Hj(λj) for the AC-coefficients of the same frequency index / ' . As the dct is an orthogonal transform, and as the distortion is measured by the mean-squared-error, the resulting distortion D in the spatial (sample/pixel) domain can be written as with some positive normalising constant c. Alternatively the distortion can measured in the weighted coefficient domain in order to compensate for the variation in the human visual response at different spatial frequencies. Similarly, the total bit rate H becomes H = ∑ H, (λ.) (27) For a distortion rate optimised quantisation, the 63 parameters λ / have to be adjusted such that the cost function D + μ . H (28) is minimised. The non-negative Lagrange multiplier μ is determined by the bit rate constraint H ≤ Ho (29) Alternatively, if the distortion is expressed in the logarithmic domain as: D' = 20 log 10 D dB (28a) The cost function to be minimised becomes: B = D + μ'H (28b) Where μ' is now an a priori constant linking distortion to bit rate. A theoretical argument based on coding white noise gives a law of 6 dB per bit per coefficient. In practice, observation of actual coding results at different bit rates gives a law of k dB per bit, where k takes values from about 5 to about 8 depending on the overall bit rate. In practice, the intuitive '6dB' law corresponds well with observation. Additionally, the qscale parameter can be changed to meet the bit rate constraint of Eqn. (25). In principle, the visual weights w, offer another degree of freedom but for simplicity we assume a fixed weighting matrix as in the MPEG-2 reference decoder. This results in the following distortion rate optimised quantisation technique which can be stated in a 'C'-language-like form: /* Begin of quantising the AC-coefficients in MPEG-2 intra frames*/ D mm = ∞; for (qscale = qmin; qscale ≤qmax; qscale - qscale + 2)1* linear qscale table*/ { μ = 0; do { Step 1 : determine λι,λ 2 , ..., λ 6 3 by minimising D + μ • H; Step 2: calculate H = ∑ Hj (λ / ); μ = μ + δ; / * δ to be selected appropriately*/ }while (H > H 0 ); Step 3: calculate D = c • Σ 0/ (λ/); (D < D min ){ qscale opt = qscale; for (/ = 1 ; / < 63; / = + 1 ) , op t = λ ; ; D min = D;} } w, . qscale opt Q, opt 16 \ χ \ λ y = Q ι ( χ ) = L — - + -y^J . ^, ,0 „ . Jgw (x) quantise all AC-coefficients of frequency-index / by } / * End of quantising the AC-coefficients in MPEG-2 intra frames * / There are several options for performing Step 1 - Step 3: 1. Options for performing Step 1 The parameters λ 7 , λ 2 , .... λ 63 can be determined a) analytically by applying Eqns. (20)-(23) of Section 3. b) . iteratively by dynamic programming of D + μ • H, where either of the options described in the next points can be used to calculate D and H. 2. Options for performing Step 2 H = Σ Hi (λ,) can be calculated (a) by applying the Laplacian model pdf, resulting in h (z, ) = ∑ hfPoj ) + (1 - Po., ) - (32) Zi where h(P 0 ,i) and Λ(Z,) are the entropies as defined in eq. (21) of P 0i (eq. (13)) and Z, = e 'α , Λ respectively. Note that P 0 ,ι in Eqn. (32) can be determined by counting for each dct-frequency index / the relative frequency of the zero-amplitude y = Q,(x) = 0. Interestingly, eq. (32) shows that the impact of the quantisation parameters λ,- on the resulting bit rate H only consists in controlling the zero-amplitude probabilities P 0 ,ι. b) from a histogram of the original dct-coefficients, resulting with Eqns. (10), (13) and (14) in c) by applying the MPEG-2 codeword table 3. Options for performing Step 3 D - c Σ Dj (λ,) can be calculated a) by applying the Laplacian model pdf of Eqn. (19) and evaluating Eqn. (16). b) by calculating D = E [ (x - y) 2 ] directly from a histogram of the original dct-coefficients x. Depending on which options are chosen for Step 1 - Step 3, the proposed method results in a single pass encoding scheme if the Laplacian model pdf is chosen or in a multi pass scheme if the MPEG-2 codeword table is chosen. Furthermore, the method can be applied on a frame, macroblock or on a 8x8-block basis, and the options can be chosen appropriately. The latter is of particular interest for any rate control scheme that sets the target bit rate H 0 either locally on a macroblock basis or globally on a frame basis. Furthermore, we note that the proposed method skips automatically high-frequency dct-coefficients if this is the best option in the rate-distortion sense. This is indicated if the final quantisation parameter λ/, opr has a value close to one for low-frequency indices / but a small value, e.g. zero, for high- frequency indices. A distortion-rate optimised quantisation method for MPEG-2 compatible coding has been described, with several options for an implementation. The invention can immediately be applied to standalone (first generation) coding. In particular, the results help designing a sophisticated rate control scheme. The quantiser characteristic of eqs. (5) and (6) can be generalised to i x - r(x) λ(x) i , , y = Q(x) = r(x) + l~ - - + -^J . q(x) (34) q(x) 2 for non-negative amplitudes x. The floor-function LaJ in eq. (34) returns the integer part of the argument a. Negative amplitudes are mirrored, y = - Q (\ χ \) (35) The generalisation is reflected by the amplitude dependent values λ (x), q(x), r(x) in eq. (34). For a given set of representation levels ... < rμ < τ < η+i < ... and a given amplitude x, the pair of consecutive representation levels is selected that fulfils The value of the local representation level is then set to r(x) = r,., (37) The value of the local quantisation step-size results from q(x) = 1, = r, - r,.ι (38) A straightforward extension of the rate-distortion concept detailed above yields for the local lambda parameter, very similar to eq. (20) , λ(x) = λι = 1 - q, • lo g ^ ri JJ ' (39) 0 = 1 L) Similar to eqs. (13), (14), the probabilities in eq. (39) depend on the lambda parameters, Po = J p(x)dx (40) and Therefore, eq. (39) represents a system of non-linear equations for determining the lambda parameters λ-i, ..., λ_. In general, this system can only be solved numerically. However, eq. (39) can be simplified if the term log 2 (Pι-ι/Pι) is interpreted as the difference of optimum codeword lengths // = -log R/ /,. / = -log 2 R w (43) associated with the representation levels η, r \ . \ . A practical implementation of the above will now be described. Once the probability distribution, parametric or actual, of the unquantized coefficients is known, it is possible to choose a set of quantizer decision levels that will minimise the cost function B, because both the entropy H and the distortion D are known as functions of the decision levels for a given probability distribution. This minimization can be performed offline and the calculated sets of decision levels stored for each of a set of probability distributions. In general, it will be seen that the optimum value of λ corresponding to each decision level is different for different coefficient amplitudes. In practice, it appears that the greatest variation in the optimum value of λ with amplitude is apparent between the innermost quantizer level (the one whose reconstruction level is 0) and all the other levels. This means that it may be sufficient in some cases to calculate, for each coefficient index and for each value (suitably quantized) of the probability distribution parameter, two values of λ, one for the innermost quantizer level and one for all the others. A practical approach following the above description is shown in Figure 5. The DCT coefficients are taken to a linear quantizer 52 providing the input to a histogram building unit 54. The histogram is thus based on linearly quantized versions of the input DCT coefficients. The level spacing of that linear quantizer 52 is not critical but should probably be about the same as the average value of q. The extent of the histogram function required depends on the complexity of the parametric representation of the pdf; in the case of a Laplacian or Gaussian distribution it may be sufficient to calculate the mean or variance of the coefficients, while in the 'zero excluded' Laplacian used in the Paper it is sufficient to calculate the mean and the proportion of zero values. This histogram, which may be built up over a picture period or longer, is used in block 56 as the basis of an estimate of the pdf parameter or parameters, providing one of the inputs to the calculation of λ in block 58. Another input to the calculation of λ is from a set of comparators 60 which are in effect a coarse quantizer, determining in which range of values the coefficient to be quantized falls. In the most likely case described above, it is sufficient to compare the value with the innermost non-zero reconstruction level. The final input required to calculate λ is the quantizer scale. In general, an analytical equation for λ cannot be obtained. Instead, a set of values can be calculated numerically for various combinations of pdf parameters, comparator outputs and quantizer scale values, and the results stored in a lookup table. Such a table need not be very large (it may, for example, contain fewer than 1000 values) because the optima are not very sharp. The value of λ calculated is then divided by 2 and added in adder 62 to the coefficient prior to the final truncation operation in block 64. Instead of using variable codeword lengths that depend on the current probabilities according to eq. (43), a fixed table of variable codeword lengths Co C L can be applied to simplify the process. The values of C 0 ,.. C L can be determined in advance by designing a single variable length code, ie. a Huffman code, for a set of training signals and bit rates. In principle, they can also be obtained directly from the MPEG2 variable-length code table. The only complication is the fact that MPEG2 variable-length coding is based on combinations of runs of zero coefficients terminated by non-zero coefficients. One solution to this problem is to estimate 'equivalent codeword lengths' from the MPEG2 VLC tables. This can be done quite easily if one makes the assumption that the probability distributions of the DCT coefficients are independent of each other. Another possibility is to consider the recent past history of quantization within the current DCT block to estimate the likely effect of each of the two possible quantization levels on the overall coding cost. Then, eq. (39) changes to λ(x) = λ, = 7 - ( C, - C,,) ,(l = / L) (44) <lι The resulting distortion-rate optimised quantisation algorithm is essentially the same as detailed previously except that the lambda parameters are calculated either from eq. (39) or eq. (44) for each pair of horizontal and vertical frequency indices. A simplified method of calculating λ(x) will now, be described, where only the local distortion is considered for each coefficient. Here, we make use of the fact that the variable-length code (VLC) table used for a given picture in MPEG2 is fixed and known. This should simplify and make more accurate the calculations of the trade-off between bit rate and distortion. In particular, the calculations can be made on a coefficient basis since the effect on the bit rate of the options for quantizing a particular coefficient is immediately known. The same is true (although a little more difficult to justify) of the effect on the quantizing distortion. If we accept the assumptions implied in the above paragraph, then we can very simply calculate the value of the decision level to minimize the local contribution to the cost function B. This will in fact be the level at which the reduction in the bit count obtained by quantizing to the lower reconstruction level (rather than the higher level) is offset exactly by the corresponding increase in quantizing distortion. If the two reconstruction levels being considered have indices i and i + 1 , the corresponding codewords have lengths Lj, and L i+1 , and the quantizer scale is q, then: (i) the reduction in bit count is Lj+ι - Lj. (ii) the local increase in distortion is 20 log 10 q(1 - λ/2) - 20 log-ι 0 qλ/2. Combining these using the law linking distortion to bit rate, we have 6(L i+1 - L l ) = 20 logι 0 (2/λ - 1) (45) or, more simply L i+1 - Li = log 2 (2/λ - 1) (46) leading to λ = 2/ (1 + 2 ( ' - Ll) ) (47) This elegant result shows that the value of λ depends here only on the difference in bit count between the higher and lower quantizer reconstruction levels. The fact that the level of λ is now independent both of the coefficient probability distribution and the quantizer scale leads to the following, much simplified implementation shown in Figure 6. Here, the DCT coefficients are passed to the side-chain truncate block 70 before serving as the address in a coding cost lookup table 72. The value of lambda/2 is provided to adder 76 by block 74 and the output is truncated in truncate block 78. There have been described a considerable number of ways in which the present invention may be employed to improve quantisation in a coder; still others will be evident to the skilled reader. It should be understood that the invention is also applicable to transcoding and switching. The question will now be addressed of a two stage-quantiser. This problem is addressed in detail in the Paper which sets out the theory of so- called maximum a-posteriori (MAP) and the mean squared error (MSE) quantisers. By way of further exemplification there will now be described an implementation of the MAP and MSE quantiser for transcoding of MPEG2 [MPEG2] intra AC-coefficients that result from an 8x8 discrete cosine transform (dct). The class of the first generation quantisers yi = Q-ι(x) specified by these equations is spanned by the quantisation step-size qi and the parameter λi; such a quantiser is called (q-i, λι)-type quantiser. In the transcoder, the first generation coefficients yi are mapped onto the second generation coefficients y 2 = Q 2 (yι) to further reduce the bit rate. Under the assumption of a (q π , λι)-type quantiser in the first generation, eg. MPEG2 reference coder TM5 , it follows from the results set out in the Paper that the MAP quantiser Q2, ma p and the MSE quantiser Q 2 ,mse can be implemented as a (q 2 , λ 2 , ma p)-type and a (q 2 , λ 2 , mse )-type quantiser, respectively. For both, the MAP and the MSE quantiser, the second generation step-size q 2 is calculated from the second generation parameters w 2 and qscalβ 2 . However, there are different equations for calculating λ 2,ma p and λ 2 ,mse- With the results of the Paper, it follows that λ 2 ,ma P can be calculated as λ map = λ 2,ref + ( "mmaapp * λ ) . (48) The parameter λ2, re f can be changed in the range 0 < λ 2 , re f≤ 1 for adjusting the bit rate and the resulting signal-to-noise-ratio. This gives an additional degree for freedom for the MAP quantiser compared with the MSE quantiser. The value of λ2, re f = 0.9 is particularly preferred. The parameter Mm a p and the parameter μm s e are calculated from the first generation quantisation step-size qi and a z-value, "- = -W ■ HIT?' (50) 1 - (l - In ( z q ' ) ) . z q ' ^mse " Iin- (/ zJ q 'n ) • " 1 ι - z _ q q, ( 5 ' The amplitude range of the values that result from these equations can be limited to the range 0 < μ map , μ ms β≤ 2. Similarly, the amplitude range of the resulting values can be limited to 0 < λ2,ma P , λ∑.mse≤ 2. The z-value has a normalised amplitude range, ie. 0 < z < 1 , and can be calculated either from the first generation dct-coefficients yi or from the original dct-coefficients x as described in the Paper. In the latter case, the z- value is transmitted as additional side information, eg. user data, along with the first generation bit stream so that no additional calculation of z is required in the transcoder. Alternatively, a default z-value may be used. An individual z-value is assigned to each pair of horizontal and vertical frequency indices. This results in 63 different z-values for the AC-coefficients of an 8x8 dct. As a consequence of the frequency dependent z-values, the parameters λ 2,maP and λ2,msβ are also frequency dependent, resulting in 63 (q 2 , λ 2 , a p)-type quantisers and 63 (q 2 , λ 2 , mse )-type quantisers, respectively. Additionally, there are different parameter sets for the luminance and the chrominance components. The default z-values for the luminance and chrominance components are shown in Table 1 and Table 2 respectively. TABLE 1 Normalised z-values, eg. 256 x z, for luminance (default) 0 1 3 4 7 7 TABLE 2 Normalised z-values, ie. 256 x z, for chrominance (default) 0 7 0 7 For a description of preferred techniques for making available to subsequent coding and decoding processes, information relating to earlier coding and decoding processes, reference is directed to EP-A-0 765 576; EP-A-0 807 356 and WO-A-9803017. Transcoding of MPEG-2 intra frames 1. Introduction Transcoding is the key technique to further reduce the bit rate of a previously compressed image signal. In contrast to a standalone source encoder, a transcoder has only access to a previously compressed signal that already contains quantisation noise when compared to the original source signal. Thus, the bit stream output of the transcoder is the result of cascaded coding with a so called first generation encoder in the first stage followed by the transcoder, see Fig.l. enc-1 transc. s = source signal, enc-1 = first generation encoder, transc. = transcoder b x , b 2 = first, second generation bit stream Fig. 1: Cascaded coding as a result of first generation encoding and subsequent transcoding It is assumed throughout that the first generation bit stream bj that defines the input of the transcoder and the second generation bit stream b 2 that represents the output are both MPEG- 2 [MPEG-2] compliant. Hence, b i and b 2 can be passed on to a MPEG-2 decoder. In MPEG-2 motion compensating prediction (mcp) is combined with the discrete cosine transform (dct) in a hybrid coding algorithm [TM5-93]. In general both elements, mcp and dct coding, can be exploited for efficient transcoding. Compared to inter frames, i.e. P- and B-frames, mcp is switched off in intra frames (I-frames). Therefore, only dct coding can be exploited to transcode 1-frames. In this paper we concentrate on MPEG-2 compatible transcoding of I-frames. A generalized block diagram of a MPEG-21-frame decoder is given in Fig. 2 vld = variable length decoder, idct = inverse discrete cosine transform D l(2) = first (second) generation bit stream, ^p ) = decoded dct-coeff. of first (second) generation Sχ (2) = reconstructed image signals of first (second) generation Fig.2 : Generalized MPEG-21-frame decoder The corresponding first generation encoder and transcoder are detailed in Fig.3 and Fig.4, respectively. yi dct Ql vie dct = discrete cosine transform, Q x = first generation quantiser, vie = variable length encoder s = original source signal, x = original dct-coeff., y^ = dct-coeff. of first generation bj = first generation bit stream Fig. 3 : Generalized MPEG-2 compatible first generation I-frame encoder Yl y2 vld Q2 vie vld = variable length decoder, Q 2 = second generation quantiser, vie = variable length encoder bj = first generation bit stream, x = dct-coeff. of first generation b 2 = second generation bit stream, y 2 = dct-coeff. of second generation Fig. 4 : Generalized MPEG-2 compatible I-frame transcoder As can be seen from Fig.4 the element of the transcoder to further reduce the bit rate is the sec ¬ ond generation quantiser Q 2 . Hence, the fundamental issue of transcoding is the design of Q 2 . To the author's knowledge, only a few publications have previously addressed this problem. In [BT-94] and [Sarnoff-96] it is suggested to implement in Q 2 essentially the same quantiser characteristic that is used for Q j in the first generation encoder, Fig.3. In this case Q j and Q 2 have the same shape, e.g. a uniform quantiser characteristic, and differ only in their level of coarseness, i.e. the representation levels of Q 2 are more widely spaced compared to the representation levels of G^. Another approach to specify Q 2 is described in [Columbia-95]. Each DCT-coefficient y-y of the first generation is checked, and a decision is made whether to retain or skip it, i.e. y 2 = Q 2 (yι)/ where either Q 2 (yι) = yi or Q 2 (yι) = 0 holds. The decision whether to retain or skip is determined in a iterative optimisation procedure on a frame basis. Experimental results given in [Columbia-95] indicate that, to a large extent, high frequency dct-coefficents are skipped and low frequency dct-coefficients are retained. Therefore, this type of quantisation results in dct-based low pass filtering, which in general carries the risk of introducing visible block artefacts. Whilst this approach may be considered for transcoding for small bit rate changes between the first and the second generation, it appears questionable whether skipping of dct-coefficients functions well in general. Unfortunately, experimental results in [Columbia- 95] are only given for transcoding between 4 and 3 Mbits/s, but not e.g. between 9 and 3 Mbit/ s. In [Samoff-96] the authors show in their experimental results that, even for transcoding between 4 and 3 Mbit/s, skipping of dct-coefficients is inferior compared with the above re-quantisation where Q j and Q 2 have the same shape and differ only in their level of coarseness. However, different algorithms for skipping of dct-coefficients have been used in [Sarnoff-96] and in [Columbia-95]. This paper provides a theoretical analysis of the transcoding problem. The formal description of the second generation quantiser Q 2 includes the suggestions mentioned above of [BT- 94][Columbia-95][Sarnoff-96] as special cases. From the results of the analysis, we derive theoretically the optimum quantiser characteristic Q 2 for both the mean-squared-error (mse) cost function and a so-called maximum-a-posteriori (map) cost function. The difference between these two cost functions is explained, along with pointing out in which case each cost function is more suitable. In order to efficiently apply the optimum mse- and map-quantiser characteristics in a transcoder, it is necessary to model the statistics of the original dct-coefficients x, see Fig.3. This paper proposes a parametric model. This model is first validated with real image data before it is used in the experiments to evaluate the mse- and map-quantiser characteristics. For reference, the results are compared with the performance of the quantiser characteris ¬ tic of MPEG-2 test model TM5 [TM5-931. The rest of the paper is organised as follows. In section 2, a formal desription of a MPEG-2 compatible quantiser is introduced. Two examples suitable for the quantiser Qi of a first generation encoder are discussed and compared. Section 3 focusses on the second generation quantiser Q 2 used in the transcoder. The problem of designing Q 2 is analysed by making a comparison to a reference quantiser Q 2 ,ref • The reference quantiser is used in a standalone encoder that bypasses the first generation stage and directly compresses the original signal to the desired bit rate of the second generation. In Section 4, two methods of designing Q 2 are proposed, explained, and compared. The first method minimises the mse cost function, the second minimises the map related costs. In Section 5 a parametric model to describe the statistics of the original dct-coefficients is introduced and validated with real image data. Based on this parametric model, an analytical evaluation for both the mse and the map cost function is carried out in section 6. Experimental results are discussed in section 7. Finally, conclusions and suggestions for future work are given in section 8. 2. MPEG-2 compatible quantisation in a first generation encoder An MPEG-2 I-frame is partitioned into blocks of 8x8 samples of the original signal s. As shown in Fig.3, each block is submitted to the dct, resulting in 64 dct-coefficients x,- . The DC-coefficient X fj is separately quantised and encoded. As the DC-quantiser characteristic is fixed for each frame, we concentrate on the AC-coefficients x,- , i-1,2,...63, with amplitude range jx.l < 1024. Without loss of generality, the frequency index i can be fixed for the following discussion. For clarity the frequency index i is therefore omitted. The original dct-coefficient x is passed to the first generation quantiser j . The MPEG-2 standard [MPEG-2] specifies in its normative part the set of representation levels \j - Qι(x); in a MPEG-2 decoder, see Fig.2, a representation level y 7 is reconstructed as V ι = '1 • <? ! (1) with the quantisation step-size The amplitude level l j can take an integer value out of the allowed amplitude range \ I < 2047 , and is transmitted as (8x8)-block data in the first generation bit stream b 3 ; b 1 includes as additional side information the values of tu j and qscale 1 needed to calculate the quantisation step- size \ . The value of w x can be set for each frame and depends on the frequency index, thus taking into account the frequency dependent properties of human visual perception. The value of qscale^ does not depend on the frequency index and can be changed on a macroblock basis within each frame. A macroblock consists of four luminance and two co-sited chrominance blocks, each of 8x8 samples. A MPEG-2 compatible quantiser complies with the reconstruction rules of (1) and (2). Additionally, j has to be rounded to an integer which is omitted in our discussion to ease the notation. For a given step-size cf 1 there is no unique MPEG-2 compatible quantiser ? = Q (x) because of the remaining degree of freedom how to map the set of original samples x onto the given set of representation levels. As an example, the quantiser characteristic can be specified for non-negative values x as where the floor function characteristic of (3) can be mirrored for negative values of x, y : = -Q t M) W The parameter λ, in eq. (3) determines how the positive x-axis is partitioned into half-open intervals ^ιi' ^i ( i + i ■ Every interval is defined by two consecutive decision levels d. , with d. Q = 0 for / = 0 and d u = { l -τ)-* (5) for / > 1 . According to (3), each x e [d. ., d * ,, , -, ) is mapped onto the same representation level r, 1/ 1/ = l . q, (6) see Fig. 5. l π r u '!(/ + !) r l(/ + l) α i(/ + 2) Fig. 5: Decision and representation levels of the quantiser in eq. (3) The value of λ, can be tuned to the cost function that is used to measure the quantiser performance. Here, two types of performance are considered. (i) mse performance The mean-squared-error (mse) is a familiar cost function to measure the quantiser performance. In this case the value of λ. is determined by minirnising the expectation value In order to minimise (7), each orginal dct-coefficient x has to be mapped onto the nearest representation level yi= r. .. Thus, without applying the calculus for differentiation one can conclude: the corresponding decision levels d, , that rxiirtimise (7) are defined by the arithmetic mean values ^ l t - r ' (, - ' ) "" (8) for the given set of representation levels r« , . The result in eq. (8) can be regarded as the first half of the celebrated Lloyd-Max quantiser design rule described in [Lloyd-57] and [Max-60] which in its second half requires each representation level r, , to coincide with the local cen- troid of the corresponding bin [d^, d. . ) . However, the latter can in general not be achieved for the signal-independent representation levels of eq. (6) because the local centroids depend on the probability distribution of the original dct-coefficients x, and are therefore signal-dependent. With eqs. (6) and (8) it follows from eq. (5) that λ, = 1 is the solution for the mse cost function. (ii) rate-distortion performance In a rate-distortion sense it is more suitable to minirnise the mse term of eq. (7) subject to a given bit rate constraint for the first generation bit stream b j . In this case the bit rate needed to encode the first generation dct-coefficients y^ is not allowed to exceed a preset value H. Let H ( λ , ) denote the resulting bit rate for an adjustment of the decision levels d . ^ according to eq. (5). It then follows from the method of Lagrange multipliers [Heuser-82] that the optimum value of λ, can be found by nrtinimising the extended cost function The Lagrange multiplier μ in eq. (9) is determined by the constraint H χ {X χ ) ≤ H . (10) There are two extreme cases. For H → ∞ the Lagrange multiplier aproaches zero, μ — > 0 , and eq. (9) coincides with eq. (7), i.e. no attention is paid to the resulting bit rate and only the mse is minimised. For H -→ 0 no dct-coeffcients y j can be coded. As a consequence, the decision level d. , already approaches infinity for / = 1 , i.e. d, ■. → ∞ so that all original coefficients x are quantised to zero. If the latter case with d, , → ∞ is only applied to particular blocks or to a selected range of frequency indices, e.g. all high frequency dct-coefficients, then, the optimisation of eqs. (9) and (10) results in skipping of dct-coefficients. The first twenty-five frames of the CCLR 601 test signal 'mobile' have been coded to evaluate both the mse and the rate-distortion performance of the quantiser specified in eqs. (3) and (4). Two values of λ, have been used: a.) λ, = 1 and b.) λ, = 0.75 . The weighting matrix proposed in MPEG-2 test model TM5 [TM5-93] has been applied for a frequency dependent quantisation. Fig. 6 shows the resulting peak-signal-to-noise-ratio (PSNR) as a function of qscale^ , see eq. (2) for the meaning of qscale^. Fig. 6: PSNR/mse performance of the quantiser of eqs. (3) and (4) for the test signal 'mobile' In accordance with the theoretical results the largest PSNR values are achieved for λ j = 1 . The PSNR values drop by about 0.4 dB if the value is changed to λ = 0.75 . However, λ, = 0.75 is the better choice in terms of rate-distortion performance for small and medium bit rates as is revealed in Fig. 7. For a given distortion of e.g. PSNR = 30 dB the resulting bit amount is approx. 450000 bit/frame in case of λ, = 1 and approx. 410000 bit/ frame in case of λ. = 0.75 , this results in a bit saving of approx. 9% in the latter case. Conversely, for a given bit amount of 450000 bit/ frame the PSNR value can be increased by about 0.5 dB from 30 dB to 30.5 dB when changing from λ = 1 to λ, = 0.75 . As explained above, when the bit rate is infinite, again the rate-distortion performance of λ, = 1 is best. Hence, one can expect an intersection between the rate-distortion curves of Fig. 7 when the bit rate is increased. This is shown in Fig. 8. For bit rates larger than approx. 1 Megabit/ frame which corresponds to PSNR values larger than 38 dB the results are in favour of λ, = 1 . However, the difference to the result of λ. = 0.75 is rather small. bit amount for AC-coeff. per frame Fig. 7: Rate-distortion performance in case of small and medium bit rates for the quantiser of eqs. (3) and (4), test signal 'mobile' bit amount for AC-coeff. per frame Fig. 8: Rate-distortion performance in case of high bit rates for the quantiser of eqs. (3) and (4), test signal 'mobile' The value λ. = 0.75 is the 'intended' value for the quantiser of the MPEG-2 test model TM5. Due to a simplified calculation of eqs. (3) and (4) involving integer rounding operations, the value of λ, that is used in TM5 depends on the value of qscale}, for further details the reader is refered to the TM5 description in [TM5-93]. The functional relationship between λ, and qscalei of TM5 is shown in Fig. 9. ale. Fig. 9: MPEG-2 test model TM5, functional relationship between λi and qscalei For qscalβ ! = 2 the resulting lambda value is λ j = 1 , this is fine because a small qscale ! value corresponds to a high bit rate, and then λ, = 1 is the best choice. With increased qscalei the λ, values approach the 'intended' value 0.75. This value is exactly matched, i.e. λ j = 0.75 , if qscalej is a multiple of 4, e.g. qscale^ = 4,8,12,16,... Of course, the experimental results give no evidence that λ. = 0.75 is the optimum value in the rate-distortion sense of eqs. (9) and (10). The tuning of λ, , or more generally, the adjustment of the decision levels for a given set of representation levels to improve the rate-distortion performance of the first generation quantiser is another issue and beyond this paper's scope. In the following sections we concentrate on the second generation quantiser and investigate how the degree of freedom that lies in the adjustment of the decision levels can be exploited for efficient transcoding. 3. MPEG-2 compatible quantisation in a transcoder - the transcoding problem In contrast to the first generation quantiser Q_χ that has access to the original dct-coefficients x, the second generation quantiser Q 2 used in the transcoder has only access to the first generation dct-coefficients γ Thus, Q 2 maps the first generation dct-coefficients onto the second generation, y 2 = 2 2 (y t ) . (11) With y^ β. OO (12) for the first generation quantiser, the relationship between the original dct-coefficients and the second generation becomes Ideally, the result of cascaded quantisation in eq. (13) should be identical to the output of a reference quantiser Q 2 ,re f at h as access to the original dct-coefficients, 'W = 2 « - < 14 > The reference quantiser is used in a standalone encoder that by-passes the first generation stage and directly compresses the original signal to the desired bit rate of the second generation. For y~ = y there is no additional loss due to transcoding. 2, ref Therefore, we start analysing the transcoding problem with the investigation for which cases y 2 = y is achievable. As an example, Fig. 10 shows the quantiser characteristics of the first generation and of the reference for transcoding. In this example, the two basic cases of transcoding occur. Case 1: In the first case the half-open interval [d « ,, d, , , j x ) on the x-axis is considered. Each x e [^i / > ^i / ■ / + n ) is mapped by the first generation quantiser onto the representation level i =QΛx) = Tii. As a consequence, no matter on which second generation value y 2 thisrep- resentation level is mapped by the transcoder's characteristic y 2 = β 2 (^ l = r ! ) the resulting characteristic of eq. (13) will always be constant over the entire interval [d . j , d , , , , ) . However, the reference quantiser of eq. (14) changes the representation level over the interval n ) • Each x [ γι,dr ) is mapped onto the representation level y 2, ref = Q 2 , re X) = r 2 L - 1 ) while each e [rf , re/' d l (I + 1 ) } is ma PP ed onto r 2 L • The dilemma for the transcoder is that only the entire interval Wι .^ι ι + n) can be mapped either on r 2 f / ■ _ ι ■ » or on r~, . Clearly, no matter how the final choice is done, y~= y is not achievable for all x e [d,,, d, ,, * s ) . Case 2: In the second case the interval [d, , , , γ d , , 2 ) on the x-axis is considered. In this case the reference quantiser maps the entire interval - £ ' }( + ιy^i ( + 2\ ) on the representation level r 2L ■ Hence, y 2 = y is achievable for all x e transcod ¬ er applies the mapping l w d l(t+l) d l(/ + 2) d l(/ + 3) d l(/ + 4) Fig.10: Quantiser characteristics of first generation and of the reference for transcoding Case 1 must be avoided in order to fulfil y~ = y for the whole x-axis. This is accomplished Δ, ref if the set of decision levels {d , ,} of the reference quantiser forms a subset of the set of decision levels I α\ , I of the first generation quantiser, For the parametric description of the decision levels in eq. (5), condition (16) can be translated into an equivalent condition that involves the quantisation step-sizes q j and q 2 of the first and the second generation, respectively, Eq. (17) reads as follows. For given parameters λ j and λ 2 re /- of the first generation and the reference quantiser, respectively, y 2 = y is achievable for the whole x-axis if there exists a positive integer n Q such that the middle term of (17) results in another positive integer k q 2 which at the same time has to be equal to the ratio — of the step-sizes. < ?l As an example, in the case of the mse cost function for the first generation and the reference q 2 quantiser with λ, = λ 2 f = 1 , eq. (17) becomes — = (2 • n 0 + 1 ) = k . This means that <?2 4i the ratio — has to be equal to an odd valued integer, e.g. 3, 5, 7, ... In general for arbitrary q { and q 2 , condition (17) cannot be met, and as a consequence, there is an additional loss due to transcoding. This loss can be described by Case 1. It can be derived from Fig. 10 that the mismatch between y~ and y 2 f s especially large if the decision level a, , coincides with the centre of the interval [d. ,, d, ( , , . For the above example of λ j = 2 re y = 1 this is indicated by an even ratio <? 2 /"7ι = 2, 4, 6, ... However, Case 1 does not occur throughout if eq. (17) is not fulfilled. The decision intervals of the first generation quantiser can be partitioned into two classes, those who belong to Case 1, e.g. i f ^w n) in Fig. 10, and those who belong to Case 2, e.g. [^i / + n> ^w + 2)^ in Fig. 10. In general, the resulting two classes do not have equal number of assigned intervals. The percentage of intervals that belong to Case 1 depends on q and q as well as on λ j and q 2 λ 2 re f . The percentage of Case 1 intervals decreases asymptotically to zero as the ratio — tends to infinity, compare Fig. 10. Indeed, — = ∞ can be regarded as a special case of eq. (17) 4l for n 0 , k → oo, thus, Case 2 intervals are guaranteed throughout. For q { > 0 this results in q 2 = ∞ which can be interpreted as skipping of dct-coefficients in the transcoder and as well in the reference quantiser. However, skipping of dct-coefficients may not be the default for a sophisticated reference quantiser to achieve a good rate-distortion performance, e.g. a reference quantiser defined by eqs. (3) and (4). Therefore, techniques are required that r inimise the additional loss due to transcoding in Case 1 intervals. This problem will be addressed in the following section. 4. Design of the second generation quantiser Q 2 used in the transcoder From the results of the previous section it follows that the mapping of eq. (15) should be applied in the transcoder for Case 2 intervals. Therefore, this section concentrates on Case 1 intervals. Resuming the discussion of Case 1, the transcoder has to take a binary decision for the interval is represented by the first generati is to map y, = r, , either onto the second generation representation level y 2 = r ιu _ n or onto y , = r r • This decision can be taken based on the rriinimisation of a cost function. Here, two cost functions are considered. 4.1 MSE cost function Similar to eq. (7) in section 3, the mean-squared-error (mse) cost function can be applied, resulting in the expectation value £[(x- 3 > 2 ) 2 ] . (18) Thus, the objective of this cost function is to minimise the mse between the original dct-coefficients x and the second generation coefficients y 2 that follow from the transcoder characteristic y 2 = Q 2 (yι ) ■ For the mse cost function of eq. (18), the corresponding reference quantiser Q 2 rej is defined by eqs. (3) and (4) with the parameter λ 2< re r = 1 and the second generation step-size q . Hence, the decision level d » , in Fig. 10 is related to the representation levels by eq. (8), i.e. As the transcoder has access to the first generation coefficients y j , this information can be exploited to minimise the term of eq. (18). Therefore, the mse cost function is expanded by introducing a conditional expectation value that depends on y-t, With eq. (20) the resulting binary decision rule can be written for the Case 1 interval i^ll< d Kl + l ) m Fi - 10 as follows, The conditional expectation values in eq. (21) depend on the probability density function (pdf) p(x) of the original dct-coefficients x. The pdf determines the probability P . , that a single value x falls in the interval [ -i d,,, * ), and is mapped onto the first generation level y 1 = β 1 ( χ ) = r w , P u = J p(x)dx. (22) d U With the definition of a local centroid, f U/+l) J (x-p(x))dx 'U (23) C U = 1/ and the decision level of eq. (19), the decision rule of eq. (21) can be re-stated after a straightforward calculation as In the case of c, , = d , * in eq. (24), an arbitrary decision between > ~ 2 ( L-l ) anc r 2L can be made. However, the decision might then be in favour of the lower level, i.e. r^ -\ \ > De " cause in general lower amplitude levels correspond to MPEG-2 codewords of smaller length. 4.1.1 Implementation of the mse cost function There are several ways to implement (24) in a transcoder. Here, we outline a straightforward implementation of the mse cost function as a quantiser characteristic y 2 = Q (y, ) . Given the first generation coefficient y, = r. ,, the transcoder can compute the corresponding interval 1^11^1 ( 1 + I ) ) on the x-axis, e.g. for the first generation quantiser of eqs. (3), (4) one obtains and d l(l+ l) s: d U + «\ ' < 26 ) In passing we note that the first generation quantiser step-size q^ required in eqs. (25) and (26) has to be transmitted as side information in any MPEG-2 bit stream. However, the parameter λ, is not specified in MPEG-2, and must therefore be additionally signalled, e.g. as user data in the first generation bit stream, see [MPEG-2] for the definition of user data. Having computed the interval [d, ,, d, , , , s. ) f the corresponding second generation representation levels can be determined with the reference quantiser β 2 , see also Fig. 10, and r 2L = 2 , re • «2' (28) with λ 2 , = 1 for the mse cost function. With eqs. (27) and (28), the corresponding decision level d , , can be calculated from eq. (19). The pdf p(x) is needed to calculate the local centroid c, , according to eqs. (22) and (23). In order to save the amount of additional side information, the transcoder can apply a model description for p(x) , involving only a few parameters. A parametric model suitable to describe the statistics of the original dct-coefficients x will be detailed and validated in the next section 5. Now, all parameters are available, i.e. ^ ( - 1 ) ,r 2L' d L ref and c \ l ' to a PPty me decision rule of eq. (24). A more compact form of (24) in the sense of a quantiser characteristic can be stated as follows, Eq. (29) specifies the second generation coefficient y 2 as a function of the local centroid c. .. However, as we are interested rather in the transcoder's quantiser characteristic y 2 = β (y ι ) , the local centroid has to be related to the first generation coefficient y , . As in eq. (25), the local centroid c . . can be specified by a parameter μ. , that relates the centroid to the decision level '1/' Clearly, for μ, , = 1 the local centroid coincides with the centre of the decision interval [d, ι, d-, ( i + \ °f length q. . From eqs. (25) and (30) one deduces After inserting (31) in (29) and by defining of *1 λ 2 = l + (μ l [ - λ l ) - — , (32) 2 one obtains the desired result, y\ y 2 = Q 2 (y : = r ) = «2 ' (33) q 2 2 Thus, the transcoder's quantiser characteristic of eq. (33) is essentially the same as the one of the first generation of eq. (3). However, as can be seen from (32), the parameter λ 2 is in general not a constant and depends on the actual value of μ, , which can change with varying y, . Thus, in contrast to the first generation parameter λ j , the second generation parameter λ 2 depends in general on the actual input value y t of the transcoder's quantiser. Nevertheless, in special cases depending on the pdf p(x) , the parameter λ 2 can become a constant, e.g. for a uniform pdf, i.e. p(x) = const , it follows from eqs. (22), (23) and (30) that μ, . = 1 throughout, and as a consequence of eq. (32) λ 2 becomes also a constant. Another special case with constant parameter λ2 occurs if μ, , = λ, holds in eq. (32). In this case each first generation coefficient y ϊ coincides with the corresponding local centroid c ^ , see eq. (31), resulting in λ 2 = 1 for the second generation. 4.2 From the mse to the map cost function In addition to eq. (33), there is another instructive interpretation of the mse decision rule. We therefore have to re-state eq. (24) by substituting the local centroid c , , with the parameter μ, . according to eq. (30). After re-ordering one obtains With Fig. 10, the term in eq. (34) can be interpreted as the a-posteriori probability q \ P uni that the original dct-coefficient x falls in the interval [d^ p d , given the first generation coefficient y. = r. . in the case of a uniform pdf p(x) = const over the interval i d i r d l (l + l ) ) of length ς τ , i.e. P uni = >^ e Vπ > d L, refψl = r U P = c → = ~ ' < This is a curious result. Although the pdf p(x) is non-uniform in general, eq. (34) suggests one ^1 / computes P uni and compares this value with the threshold -r- . In general, the a-posteriori probability P ma „ depends on the pdf as follows, L, ref J P(x)dx P '1 / map = P\x e [ L d, 1 /„ d L r , ref .)' \y. = r. ,] = (36) y \ W 1 / where the denominator P. , is defined as in eq. (22). The complementary a-posteriori probability is given by For the special case of p(x) = const the a-posteriori probability P map of eq. (36) becomes identical to P uni of eq. (35). Also, the parameters that are related to the local centroids then become μ. , = 1 , throughout. Hence for this special case, the decision rule of eq. (34) can be restated with eqs. (36) and (37) as r rr 22((. - l) P map > P map y 2 = β 2 (y 1 = r H ) = '/ (38) 2 2 •^Z7.. P ma < P map In general for a non-uniform pdf, i.e. p(x) ≠ const, the decision rule of eq. (38) does not coincide with the mse decision rule of eq. (34). The decision in (38) is based on the maximum a- posteriori (map) probability which is either P ' or P m „ ■ Therefore, eq. (38) is called the map decision rule. Another important difference between the mse decision rule of eq. (34) and the map decision rule of eq. (38) is that the reference quantiser g 2 is fixed in the mse case but can be arbitrary in the map case. Note that Q~ determines the second generation decision level d . , in eqs. (36) and (37), and has therefore a significant impact on the a-posteriori probabilities. As an example, the map decision rule can be applied to the class of reference quantisers β 2 re f of eqs. (3) and (4) which is spanned by the parameter λ 2 , . In the special case of λ- , = 1 , one obtains the reference quantiser of the mse cost function; however as explained earlier, the map decison rule will then only coincide with the mse decison rule if, additionally, the pdf is constant. The degree of freedom to select the reference quantiser for the map decision rule can be exploited by specifying a characteristic Q~ z, rej f that results in a sophisticated rate-distortion perform- ance. Thus, the map decision rule can take into account not only the mse but also the resulting bit amount which is more suitable in a rate-distortion sense compared with the mse decision rule. As the mse decision rule of eq. (34) πiinimises the cost function of eq. (18), one may now consider what cost function is minimised by the map decision rule of eq. (38). It is not difficult to verify that the map decision rule minimises the cost function where y 7 and y n , are defined as in eqs. (13) and (14), respectively. Interestingly, it is again z z, ref a mean-squared-error that we end up with. However, the mse of eq. (39) is more suitable in a rate-distortion sense than the mse of eq. (18). Finally in this section, we note that both the mse and the map cost function belong to the family of Bayesian cost functions [Melsa-Cohn]. 5. A parametric model to describe the statistics of the dct-coefficients The transcoder needs to know the pdf p(x) of the original dct-coefficients x in order to apply both the mse and the map cost functions. Basically, there are two possible approaches. In the first case, p(x) is transmitted as additional side information along with the first generation bit stream. Second, no additional side information is transmitted, and p(x) is estimated fro the first generation dct-coefficients y. . A parametric model is required that involves only a few parameters to limit the amount of additional side information in the first case. Also in the second case a parametric model with only a few parameters is needed because the reconstructed coefficients y, may not cover a sufficient amplitude range and/or their number may not be sufficient to achieve a reliable estimate for many parameters; this problem is known as 'context dilution' [Rissanen et. al. - 96]. In the following steps, a common parametric model will be derived that is suitable for both cases. In the first step, we propose to model p(x) as a Laplacian-like pdf which can be described by a single positive parameter α . A priori, the AC-coefficients of an 8x8 block cannot be assumed to share the same distribution. Therefore, an individual α value is specified for each AC-frequency index, resulting in 63 parameters in total. Due to the discrete nature of the dct-coefficients, the probability P. . to encounter a representation level y. = r. . = I ■ q. is given by eq. (22). For the special case of <?, = 1 , P. ^ can be considered the probability of the original dct-coeffcients . A histogram for ten consecutive frames of the CCIR 601 test signal 'mobile' has been computed in order to check whether the parametric model of (40) is suitable for the original dct-coefficients . Due to the symmetry as- sumption for positive and negative amplitudes in eq. (40), the relative frequencies — of absolute amplitude levels | | = / have been measured, where 0 ≤ I ≤ 1024 and N = 10 x 6480 for each AC frequency index. The results are similar for all 63 AC frequencies, three examples for selected horiziontal and vertical frequency indices are shown in Fig. 11. Each curve has its maximum at |x| = I = 1 and decays rapidly with increasing / . The maximum at |x| = / = 1 is larger and sharper peaked for higher frequencies, indicating a decreasing variance for increasing frequencies. Similar results have been obtained for other test signals. Qualitatively, the type of curve shown in Fig. 11 can be generated with eq.(40) by appropriate adjustment of the parameter α . In order to get the best parameter fit one can take advantage of the fact that the transcoder needs to know the pdf p(x) only for x values that are mapped onto non-zero representation levels y, ≠ 0 by the first generation quantiser. This is because the first generation coefficients y. = 0 are always mapped onto the second generation coefficients y 2 = 0. Hence, the pdf has to be modelled only for | | > d. , , where d, , is the smallest positive first generation decision level. Fig. 11: Histogram for absolute amplitude levels of original dct-coefficients for different horizontal and vertical frequency indices, test signal 'mobile' For the parametric description of eq. (5), one obtains <-\ , = f 1 - — j • α j . In order to become independent of the first generation quantisation step-size q, , the value of d^ j can be set to ' 11 - J • q m . where q . is the smallest possible step-size that complies with eq. (2). Therefore, the pdf is modelled as P (x) = p L (x) = β - 2 . β αW ,\x\ ≥ d (41) 11 • The parameter β in eq. (41) takes into account that the integral J p(x)dx is smaller than one when calculated only over the range |x| > d , . . The value of β can be used to match the condition l -/ 0 . (42) The right hand side of (42) is determined by the measured relative frequencies n —l of absolute values I x| = / that are commonly mapped onto y, = 0 by the first generation quantiser. The latter is indicated in eq. (42) by the index which depends on the decision level d. .. Thus, instead of calculating the sum n l /o = ∑ κι Q that appears in the right hand side of (42) one can also measure the relative frequency / 0 of the event y. = 0. It is important to notice that β is not needed to apply the parametric model of eq. (41) to both the mse and the map cost function. During the calculation of the local centroids with eqs. (22) and (23), the value of β is cancelled out as it appears in the top and in the bottom line in eq. (23). Cancellation also occurs for the map cost function during the calculation of the a-posteriori probabilities of eqs. (36) and (37). Hence, only the value of α is needed in the transcoder. As a consequence, eq. (41) can provide a better fit for the curves shown in Fig. 11 than eq. (40), resulting in a more accurate estimate of the parameter α with no increase of side information. The probabilities P, , can be evaluated for the parametric description of the decision levels of eq. (5) by inserting the parametric model of eq. (41) in eq. (22). After a straightforward calculation that also takes into account condition (42) one obtains , y ( - l ) -( - q. ) P = 5 - ( l - / 0 ) ( l - z) - - 7- Λ ≤ \ ≤ L Λ = e . (43) 1 - Z We recall that eq. (43) specifies the probability that one observes a first generation coefficient y zz r . . = / • q . . It is interesting to notice that the first generation quantiser parameter λ 1 is not needed in eq. (43) but only the step-size q { . Due to the symmetry assumption of the parametric model (41) one gets P u = Rι ( _ ) as a outcome of (43). For / = 0 the probability is set to R 10 = / 0 . The largest index in (43), i.e. L , can be set to the largest possible value L - 1024 for AC-coefficients or it may be set more accurately to the largest value that is actually encountered in the transcoder. While eq. (43) forms the basis to estimate the parameter α from the first generation coefficients y . , we need a corresponding equation to estimate α from the original coefficients x . As already mentioned, the original dct-coefficients result as a special case for the step-size q { = 1, i.e. x = y, = r, , = /• 1. When combined with condition (42), eq.(43) has to be modified as follows, (|/|- 0 ) P \l = 5 "( o) -(1-z)- L _ l +1) Λ≤l Q ≤\l\< ,z = e "α . (44) 1-z ° As in the previous case, the probabilities for indices in the range |/| < / 0 that are not defined by eq. (44) can be set to the value of the corresponding relative frequencies of the original dct-coefficients . We first concentrate on estimating the parameter α according with eq. (43). Ideally, the model probabilities P, , of eq. (43) should coincide with the relative frequencies f { of the first generation coefficients y, = r,, = l-q. that can be measured in the transcoder. However, there is only one free parameter in the model, i.e. α . Therefore, P, , = /, is in general not achievable for each index / . A coding argument can be used as a guideline for adjusting . If the parametric model of (43) were applied to encode the first generation coefficients y . , then the minimum average codeword length cwl would be cwl = _-f r logP u ≥_-f r logf [ = ent, (45) / / cwl is given in the unit 'bit per coefficient' if the logarithm is taken relative to the base of 2 in eq. (45). The right hand side of (45) specifies the (first order) source entropy ent which is the lower bound for cwl that can only be reached if P, , = /, holds, throughout. The goal is now to adjust the parameter α of the probabilities P, , such that the resulting cwl is minimised and is as close as possible to the source entropy ent . It is further interesting to notice that cwl can also be written as cwl = ∑-f [ -\ogP ll = ---logP(y u ,y l2 y lN ), (46) where p (y,,,y, 2 , ... , y , N ) specifies the joint probability that results from the parametric model (43) for all first generation coefficients y. arranged in some scan order V j ^, •■•• y \N' As a consequence of (46), the minirnisation of cwl by adjusting α coincides with the maximisa ¬ tion of P(y ιι> y i2 Vi Λ ^ for the observed coefficients y^. v 12 » ■•• '^'lN- Tnus we see at the parameter α is determined by a maximum likelihood (ML) estimation. The ML-estimate for α can be calculated with — cwl = 0 . In order to simplify this calcula- o tion, eq. (46) is evaluated by inserting the parametric model for P. , that results when the largest index L in eq. (43) tends to mfinity. This is justified by the fact that in practice L is very large, e.g. L = 1024. For L — > ∞ , after differentiating and re-ordering one gets the equation d :wl = α. -. ( 0 h da .' ■ Γ - ° (47) In eq. (47) the value of α is indirectly given by z ~ e , see also eq. (43), and / specifies the measured average value of the absolute first generation indices |/| , i.e. / = ∑|/| - / r (48) / From eq. (47) one obtains the ML-estimate for α, Note that only the mean value / of eq. (48) and the relative frequency / 0 of the event y = 0 have to be measured from the first generation coefficients to determine the ML-estimate of (49). One obtains a corresponding result if the parameter α is not estimated from the first generation coefficients y-, but from the original dct-coefficients . In this case eq. (44) instead of eq. (43) is used to derive the ML-estimate z = e *-< o> - z o (50) ι - (\ -f Q ) - (i Q - ) where the mean value is given by / = Σ 1 N (51) l ≥ l 0, As introduced earlier the ratios n —l i .n eq. (51) specify the relative frequencies of the abolute values |x| = / , see also Fig. 11. The ML estimation of eqs. (50) and (51) coincides with the ML es ¬ timation of eqs. (48) and (49) in the special case of <? j = Z Q = 1 . In general, one obtains different estimation values for the parameter α. As more information is provided by the orig- inal dct-coefficients, the ML-estimation with (50) and (51) is more accurate, however, the parameter α has then to be signalled as additional side information. In this case it may be more convenient to signal z = e rather than CC because the z -values have a normalised amplitude range, i.e. 0 < z ≤ 1 , so that each z -value can be rounded to a fractional binary number of e.g. 8 bit length. In contrast to (50) and (51), the ML-estimation with (48) and (49) requires no additional side information that has to be sent to the transcoder. As an example, the parameter α has been estimated for each curve of Fig. 11 from the original dct-coefficients x by applying eqs. (50) and (51). In order to determine the value of l 0 the decision level d . . has been set according to "ιι = -TH ■ H)-S-** cβ/β «i« = (52) resulting in w _1 <o - nl = (53) 16 where the function a ~ \ rounds the given argument a up to the nearest integer. The resulting ML-estimate of z = e ~ can be used for all qscale { -values that are larger or equal to qscale min = 2 . According to eq. (53) the value of l Q depends only on the visual weight W j that changes with the horizontal and vertical frequency index of the AC-coefficients. The weighting matrix of MPEG-2 test model TM5 has been used. Additionally, the estimated z -values have been rounded to fractional binary numbers of 8 bit length. Figs. 12a - 12c show the resulting model probabilities of eq. (44) in comparison to the measured histograms of Fig. 11. Note that in Figs. 12a-12c the model probabilities for the absolute amplitude levels are shown, i.e. R l | = R w + P 1 ( _ for |/| > l . Fig. 12 a: Model probabilities ace. to eq. (44) (solid line) and histogram (dashed line) for absolute amplitude levels of original dct-coeffidents, test signal 'mobile' Fig. 12 b: Model probabilities ace. to eq. (44) (solid line) and histogram (dashed line) for absolute amplitude levels of original dct-coeffidents, test signal 'mobile' Fig. 12 c: Model probabilities ace. to eq. (44) (solid line) and histogram (dashed line) for absolute amplitude levels of original dct-coeffidents, test signal 'mobile' 6. Evaluation of the mse and the map cost function for the parametric model In this section both the mse and the map cost function are evaluated for the parametric model of the pdf p(x) of eq. (41). The model parameter α can be estimated as described in the previous section. In order to ease the comparison between the mse and the map cost function, the resulting decision rules of eq. (34) and (38) are considered, respectively. Firstly, the mse decision rule of eq. (34) is evaluated. The pdf p(x) determines the parameter μ j ■ that is related to the local centroid c , , according to eq. (30). The local centroid ^ can be calculated for the dedsion levels of eqs. (25) and (26) by inserting the parametric model of eq. (41) in eqs. (22) and (23). Without loss of generality a positive index / > 1 can be considered, the result can be mirrored for the corresponding negative index - . The calculus then yields -(α - 4ι ) j l - ( l + α - fl j ) - β (54) C U = d U + a -(α - o j ) \ - e l l / From eq. (30) one gets . , = d, , + — • q-, and by comparison with eq. (54) It follows from eq. (55) that the local centroid parameter μ, , does not depend on the index / that is selected in the transcoder by the actual first generation coeffident y. = r. , = I - q. , rather μ. , depends only on the estimated parameter α and the step-size q, that is decoded from the first generation bit stream. Hence, the Lapladan-like pdf defined by the parametric model of eq. (41) is another case that results in a constant parameter μ, . apart from the spedal cases already discussed in the last paragraph of Section 4.1.1. Consequently, the parametric model of eq. (41) also reduces the complexity for implementing the mse decision rule in the transcoder. Secondly, the parametric model is evaluated for the map dedsion rule of eq. (38). After the computation of the a-posteriori probabilities of eqs. (36) and (37) for the decision levels of eqs. (25), (26) and the model pdf of eq. (41), the map dedsion rule of eq. (38) can be rewritten in a similar form to the mse decision rule of eq. (34), The map-threshold in eq. (56) is given by where ln(α) returns the natural logarithm, i.e. logarithm relative to the base e , of the argument a . Thus we see that the map decision rule can be implemented in essentially the same way as the mse dedsion rule for the parametric model of eq. (41). The main differences are that the mse- threshold is defined by eq. (55) but the map-threshold by eq. (57), and that the decision levels d j , are fixed in the mse case but can vary depending on the reference quantiser Q~ in the map case as discussed earlier in Section 4.2. The same estimated parameter α can be applied to both the mse and the map cost functions. Therefore, the transcoder has the option to switch locally e.g. on a 8x8 block basis, between the mse and the map cost function with no further increase of additional side information. 7. Experimental results In order to verify the theoretical results derived in the previous sections, the transcoding set up of Figs. 3 and 4 has been simulated for ten consecutive frames of the CCIR-601 [CCIR-601] formatted test signal 'mobile'. As the MPEG-2 test model TM5 [TM5-93] is a widely acknowledged reference for a MPEG-2 standalone encoder, the first generation quantiser Q. has been fixed to the TM5 quantiser characteristic throughout in the experiments. The transcoder's quantiser characteristic β 2 has been set to TM5 in the first experiment. As an example, the corresponding qscale value has been fixed to qscale* - 32 , which corresponds approximately to the adjustment in 1-frames that is used for a 3 Mbit/s simulation including P- and B-frames. According to the linear qscale table of MPEG-2, the qscale value of the TM5- quantiser used in the first generation encoder has been varied in the range qscale. = 2, 4, 6, 8, ..., 32. Thus, transcoding is simulated for different first generation bit rates and a fixed target bit rate for the second generation. The resulting PSNR values for the image signal s~ reconstructed from the second generation bit stream £> 2 are shown in Fig. 13a as a function of qscale , . For reference, the solid line shows the resulting PSNR value of a standalone TM5-encoder that by-passes the first generation and directly encodes the original signal with a qscale value of 32. The Peak-Signal-to-Noise-Ratio is related to the mean-squared- 2 error between the original and the second generation signal as PSNR = 10 1og ιn[255 /mse] . In addition, Fig 13b conveys the bit amount needed to encode the second generation AC-coef- fidents with the MPEG-2 intra vie table. qscale i Fig. 13a: PSNR of 2nd generation signal as a function of qscale j for fixed qscale 2 = 32, TM5, test signal 'mobile' AC-bit amount per frame for MPEG-2 Intra VLC [bit] qscale, Fig. 13b: AC-bit amount of 2nd generation signal as a function of qscale j for Fixed qscale 2 = 32, TM5, test signal 'mobile' The PSNR values drop dramatically by more than 1 dB for medium values of qsc l i in the range of 16-20 when compared to the reference. At the same time, the resulting bit amount changes considerably. In this case the resulting ratio qscale 2 / qscale = q / q is around 2, which is unfavourable for transcoding as explained during the discussion of eq. (17) in Section 3. As an example, for qscale i = 20, the PSNR value is about 1.5 dB below the reference line while the resulting bit amount is approximately (within 3%) the same for the reference and the trans- coded signal, see Figs. 13a, 13b. When qscalei is increased to 22, the PSNR value recovers and is only 0.1 dB below the reference line, however, now the bit amount dramatically exceeds the reference line by about 29%. These considerable changes between consecutive qscalei values would have the most unpleasant effect on any rate control scheme that is used in the transcoder, thus resulting in a poor picture quality for the second generation. The PSNR value recovers when the qscalβ value approaches qscale 2 , but the resulting bit amount is rather high. For qscalei = qscale 2 = 32, transparency is achieved, i.e. the first and the second generation bit stream are identical. The TM5-quantiser provides the best results for small values of qscalej in the range 2-8. Clearly, the first generation dct-coeffidents contain less quantisation noise when qscalei is small, and as a consequence, the difference between the second generation and the reference signal also becomes small. Similar results have been obtained for other test signals [OW-BBC-1]. In addition to the TM5 quantiser characteristic, the transcoder has the option to apply the mse or the map cost function. The decision to select either of them may be based on the rate-distortion performance. While the resulting PSNR/mse-values can be estimated and compared in the transcoder by using the parametric model of eq. (41) for the pdf p(x) , it would be rather complex if the resulting bit amount had to be computed for each cost function by forming the MPEG-2 compatible two-dimensional (runlengthjιmplitude)-events of each 8x8 block and by looking up each codeword length from the intra vie table. It is less complex for the transcoder to calculate the first order source entropy, as in eq. (45), because only a histogram count for the second generation coefficients is then needed. Fig. 14a shows the bit amount for the MPEG-2 intra vie of Fig. 13b scaled down for 8x8 blocks in comparison to the source entropy summed up for all 63 AC-coefficients. It can be seen that the two curves shown in Fig. 14a have essentially the same shape. This is confirmed if one calculates the ratio between them for each qscale-^ value, see Fig 14b. The ratio is almost constant, i.e.0.84. Thus, a comparison of the mse and the map cost function and the TM5 performance in terms of bit rate can also be carried out on the basis of the source entropy rather than by applying the MPEG-2 intra vie. Another interesting result of Fig. 14b is that up to approx. 16% of the bit rate could be saved by using the AC-en- tropy source model instead of the MPEG two-dimensional (runlength, amplitude) model. However, this result cannot be exploited for MPEG-2 compatible bit streams. qscale, Fig. 14 a: Bit amount of 2nd generation AC coefficients: MPEG-2 Intra VLC vs. first order source entropy, test signal 'mobile' qscale 1 Fig. 14 b: Bit amount ratio: First order source entropy over MPEG-2 Intra VLC (solid line), ratio =0.84 (dashed line), test signal 'mobile' PSNR of 2nd generation [dB] qscale j Fig. 15a: PSNR of 2nd generation signal as a function of qscalej for fixed qscale 2 = 32; mse(upper line), map 2 tref = 0.90(middle line), TM5(dashed line), test signal 'mobile' AC-entropy per 8x8 block of 2nd generation [bit] qscale j Fig. 15b: AC-entropy of 2nd generation signal as a function of qscalej for fixed qscale 2 = 32; mse(upper line), map/X^ f = 0.90(middle line), TM5(dashed line), test signal 'mobile' The mse and the map cost function have been simulated in the next experiment. The reference quantiser Q 2 re f of the map cost function complies to eqs. (3) and (4), as an example the ded- son level parameter has been set to λ-, rej , = 0.90. The pdf parameter α has been estimated for each AC-frequency index as described in the example given in Section 5, see Figs. 12a-12c, with respert to the original dct-coefficients, resulting in 63 x 8 = 504 bit additional side information. We recall that these oc -values do not depend on the actual qscalei value as they are estimated according to eqs. (52) and (53). Thus, the additional side information of 504 bit is the same for all first generation bit streams. A more accurate estimation of α is possible if the actual qscale value is inserted in eq. (52) instead of qscale min = 2 ; however, the additional side information would then depend on the first generation encoding process. A comparison of the cases where either the TM5 quantiser, the mse or the map cost function is used in the transcoder is shown in Figs. 15a and 15b. The mse cost function achieves the largest PSNR values, see Fig. 15a. For example in the case of qscalei - 20, the PSNR value can be increased by approx. 1.1 dB from approx. 25.6 dB for the TM5-quantiser to approx. 26.7 dB for the mse cost function. However, the mse cost function comes at a price as the entropy of the AC-coeffidents is significantly increased, see Fig. 15b. The mse cost function may therefore not be applicable throughout. However, the mse cost function can be used locally to transcode blocks with critical image content. As a further option, the mse cost function can only be applied to AC-coefficients with low frequency index because the human visual system is in general more sensitive to quantisation noise that is added to low frequencies. The map cost function is more suitable in a rate-distortion sense compared with the mse cost function. For the critical case of qscale , = 20 , the AC-entropy is approximately 4.7% smaller and at the same time the PSNR value is approximately 0.4 dB larger in comparison to TM5. Figs. 15a and 15b show just one example for the map cost function. As the map cost function is governed by the parameter λ 2 f , a set of rate-distortion characteristics can be generated by varying λ„ * , thus allowing a smooth transition between the TM5-quantiser performance and the mse cost function in terms of PSNR and corresponding bit rate. The results for different values of λ 2 , in Figs. 16a and 16b show a monotonic behaviour: when λ 2 , is increased, both the PSNR value and the AC-entropy are increased, too. PSNR of 2nd generation [dB] qscale j Fig. 16a: PSNR of 2nd generation signal as a function of qscale j for fixed qscale 2 = 32; map cost function for different values of ^.nf » test signal 'mobile' λ 2ιref = 0.95 (upper line), 0.90, 0.85, 0.80, 6.75 (lower line) AC-entropy per 8x8 block of 2nd generation [bit] Fig. 16b: AC-entropy of 2nd generation signal as a function of qscalej for fixed qscale 2 = 32; map cost function for different values of λs ref , test signal 'mobile' λ 2p-cf = 0.95 (upper line), 0.90, 0.85, 0.80, 6.75 (lower line) In the last experiment the impact of estimating the pdf parameter α not from the original dct- coeffidents but from the first generation coefficients is investigated. No additional side information is necessary if α is estimated from the first generation coeffdents. A comparison between the two methods is shown in Figs. 17a and 17b for the mse cost function. While the PSNR/ mse performance in Fig. 17a is almost identical with and without additional side information, one can see from Fig. 17b that the resulting bit amount is significantly higher in some cases without side information. Thus, not very surprisingly, the results are in favour of sending additional side information. This conclusion is not necessarily true for the map cost function as shown for the example of 2 f — 0.90 in Figs. 18a and 18b. Similar to the mse cost function, the AC-entropy is significantly higher for some qscalei values when no side information is sent (Fig.18b), however, the resulting PSNR values also exceed the corresponding PSNR values for the case of additional side information. Thus, a good performance can be achieved even when no additional side information is sent to the transcoder. PSNR of 2nd generation [dB] qscale j Fig. 17a: PSNR of 2nd generation signal as a function of qscale j for fixed qscale2 = 32; mse cost function with and without additional side information, test signal 'mobile' AC-entropy per 8x8 block of 2nd generation [bit] qscalej Fig. 17b: AC-entropy of 2nd generation signal as a function of qscale j for fixed qscale 2 = 32; mse cost function with and without additional side information, test signal 'mobile' PSNR of 2nd generation [dB] qscale j Fig. 18a: PSNR of 2nd generation signal as a function of qscale j for fixed qscale 2 = 32; map cost function with and without additional side information, ^ ref = 0.90. test signal 'mobile' AC-entropy of 2nd generation [bit] qscale j Fig. 18b: AC-entropy of 2nd generation signal as a function of qscale j for fixed qscale 2 = 32; map cost function with and without additional side information, λ 2ιref = 0.90, test signal 'mobile' 8. Conclusions and future work This paper discusses transcoding of MPEG-2 intra frames. A theoretical analysis of the transcoding problem is carried out with emphasis on designing the quantiser characteristic of the transcoder. The comparison with a reference quantiser of a standalone encoder shows that transcoding only results in an equivalent overall quantiser characteristic under spedal conditions. This is indicated by the ratio of the first and the second generation quantisation step-sizes. Only for certain ratios is the mapping of the original dct-coeffidents onto the second generation coeffidents the same for the reference quantiser and the overall quantiser characteristic that results from transcoding. In general for an arbitrary ratio, the standalone reference quantiser characteristic cannot be achieved during transcoding. As a consequence, there is a loss due to transcoding when the mean-squared-error (mse) or the rate-distortion performance is considered. In order to minimise this loss, the degree of freedom that lies in selecting the decision levels for an MPEG-2 compatible quantiser can be exploited. Two approaches for the adjustment of the dedsion levels in the transcoder are proposed, explained and compared. Firstly, the mirrimisation of the mse cost function is taken as a guideline for adjusting the dedsion levels. The objective of the mse cost function is to give the smallest mse values between the original and the second generation coefficients. The resulting mse dedsion rule can be implemented in the transcoder in essentially the same way as the first generation quantiser characteristic. However, the mse cost function comes at a price as no attention is paid to the bit rate needed to encode the second generation coeffidents. Therefore, the maximum a-posteriori (map) cost function is additionally introduced. The map cost function is more suitable in a rate-distortion sense than the mse cost function. While the standalone reference quantiser is fixed for the mse cost function, the map cost function has the additional freedom to choose the standalone reference quantiser. Thus, by changing the reference quantiser, a set of rate-distortion characteristics can be generated with the map cost function. Interestingly, the map cost function is again given by a mean-squared-error (mse); however in contrast to the mse cost function, the mse between the output of the standalone reference quantiser and the second generation coefficients is minimised. The statistical distribution of the original dct-coefficients is needed to apply both the mse and the map cost function in the transcoder. A parametric model based on a Laplacian probability density function (pdf) is proposed. One parameter for each frequency component allows adaptation to the actual signal statistic. This parameter can be estimated either in the transcoder from the first generation coeffidents or from the original dct-coefficients. In general, the latter results in a more accurate estimate, however, the parameter has then to be transmitted as ad- ditional side information along with the first generation bit stream. For both cases, a maximum likelihood estimation rule is derived. The parametric model is validated with real image data; experimental results confirm that the model pdf is suitable for describing the distribution of the dct-coefficients. The mse and the map cost function are evaluated for the parametric model. It is shown that the proposed model pdf also simplifies the implementation, and that the resulting mse and map dedsion rules can then be stated in very similar forms. Experimental results confirm the effectiveness of the mse and the map cost function. For reference, the quantiser characteristic of the MPEG-2 reference encoder TM5 [TM5-93] has also been used in the transcoder. The results show large changes in terms of PSNR values and bit rate of the second generation coeffidents for a ratio around two of the second and first generation quantisation step-sizes. The PSNR value can drop by about 1.5 dB while the bit rate remains constant or, conversely, the PSNR value remains rather constant while the bit rate is increased by almost 30%. This causes problems for a rate controller that is used in the transcoder. The mse cost function achieves the largest PSNR values, resulting in up to 1.1 dB gain compared to TM5. However, the mse cost function also leads to the largest bit rates and may therefore only be applied locally to blocks with critical image content. As a further option, the mse cost function can only be applied to AC-coeffidents with low frequency indices because the human visual system is in general more sensitive to quantisation noise that is added to low frequencies. Experimental results show that in comparison to TM5, the map cost function can lead to a smaller bit rate (4.7 %) and at the same time to a larger PSNR value (0.4 dB) in critical cases, thus resulting in a better rate-distortion performance. By changing the reference quantiser of the map cost function, a set of rate-distortion characteristics can be generated allowing a smooth transition between the rate-distortion performance of the mse cost function and TM5. In the experiments, the class of reference quantisers is spanned by a single parameter; results show a monotonic behaviour in that an increase of the reference quantiser parameter leads to a larger PSNR value and to a larger bit rate. Experimental results confirm that for the mse cost function the estimation of the pdf model pa ¬ rameter from the original dct-coeffidents leads to a better rate-distortion performance than estimating the model parameter from the first generation coeffidents. This is not necessarily true for the map cost function, as revealed in one example. Thus, a good transcoding performance can also be achieved when no additional side information is transmitted along with the first generation bit stream. It is further shown that the first order source entropy of the second generation coefficients can be used to derive an estimate of the bit rate that results from the MPEG-2 intra vie codeword table. This would simplify the computation of the bit rate if the transcoder had to dedde upon either the TM5, the mse or the map cost function based on the best rate-distortion performance. The resulting PSNR values can be compared in the transcoder on the basis of the Laplacian model pdf. This could be simplified for the map cost function due to the monotonic behaviour of the rate-distortion performance, e.g. after setting a target bit rate on a frame or block basis, the parameter of the reference quantiser can be increased until the first order source entropy exeeds the target bit rate. The investigation of an 'easy-to-implement' algorithm based on the above rate-distortion considerations is a promising goal of future work. Furthermore, the presented results can be adapted for transcoding of MPEG-2 inter-frames, i.e. P- and B-frames, involving motion compensating prediction. However, the problem of drift [OW-94] [OW-96] between the predictors of the encoder and the decoder has then additionally to be taken into account.

Claims: CLAIMS 1. A method for compression encoding of a digital signal, including the steps of conducting a transformation process to generate values and quantising the values through partitioning the amplitude range of a value into a set of adjacent intervals, whereby each interval is mapped onto a respective one of a set of representation levels which are to be variable length coded, such that a bound of each interval is controlled by a parameter λ, characterised in that λ is controlled so as to vary dynamically the bound of each interval with respect to the associated representation level. 2. A method according to Claim 1 , wherein each value is arithmetically combined with λ. 3. A method according to Claim 1or Claim 2, wherein λ is a function of the quantity represented by the value. 4. A method according to Claim 3, wherein the transformation is a DCT and λ is a function of horizontal and vertical frequency. 5. A method according to any one of the preceding claims, wherein λ is a function of the quantisation step size. 6. A method according to any one of the preceding claims, wherein λ is a function of the value amplitude. 7. A method according to any one of the preceding claims, wherein the digital signal to be encoded has been subjected to previous encoding and decoding processes and λ is controlled as a function of a parameter in said previous encoding and decoding processes. 8. A method according to Claim 7, having quantisation step size q = q 2 and a value of λ = λ 2 . in which the value to be quantised has previously been quantised using a quantisation step size q = qi and a value of λ = λ-i, wherein λ is a function of q-i and λi . 9. A method according to Claim 7 or Claim 8, wherein λ is a function of λ rβ f , where λ ref is the value of λ that would have been selected in a method according to Claim 1 operating with a quantisation step size q = q 2 upon the value prior to quantisation with the quantisation step size q = qi. 10. A method according to any one of the preceding claims, wherein the quantisation step size q is independent of the input value, otherwise than for the zero quantisation level. 11. A (q, λ) quantiser operating on a set of transform coefficients x k representative of respective frequency indices f k in which λ is dynamically controlled in dependence upon the values of x k and f k 12. A quantiser according to Claim 11 , wherein the parameters f k are frequency indices. 13. A quantiser according to Claim 11 or Claim 12, in which λ is dynamically controlled to minimise a cost function D + μH where D is a measure of the distortion introduced by the quantisation in the uncompressed domain and H is a measure of compressed bit rate and μ is a constant determined by the bit rate constraint. 14. In a compression transcoder, operating on a compressed signal quantised in first (q- t , λ-ι)-type quantiser, a second (q 2) λ^-type quantiser in which the second generation λ 2 value is controlled as a function: λl - λ (f hor , f ver , q,, λ q 2 , λ 2 ,ref , yi) 15. A compression transcoder according to Claim 14 in which the parameter λ 2 rβ f, represents a notional reference ( q 2 λ 2rref ) -type quantiser which bypasses the first generation coding and directly maps an original amplitude onto a second generation reference amplitude. 16. A compression transcoder according to Claim 14 in which the parameter λ 2 βf is selected empirically. 17. A compression transcoder according to Claim 16 in which the parameter λ 2 rβf is fixed for each frequency.

Inventors: KNEE MICHAEL JAMES, WELLS NICHOLAS DOMINIC, WERNER OLIVER HARTWIG, KNEE, MICHAEL, JAMES, WELLS, NICHOLAS, DOMINIC, WERNER, OLIVER, HARTWIG
Applicants: BRITISH BROADCASTING CORP, KNEE MICHAEL JAMES, SNELL & WILCOX LTD, WELLS NICHOLAS DOMINIC, WERNER OLIVER HARTWIG, BRITISH BROADCASTING CORPORATION, KNEE, MICHAEL, JAMES, SNELL & WILCOX LIMITED, WELLS, NICHOLAS, DOMINIC, WERNER, OLIVER, HARTWIG
Application year: 1998
Main classification: H04N7
IPC codes: G06T9, H04N7