Abstract:
For encoding signals corresponding to still images or video sequences, respective standards known as JPEG and MPEG have been proposed. These standards are based on digital cosine transform (DCT) compression. For economy of transmission, DCT coefficients may be &#34;thresholded&#34; prior to transmission, by dropping the less significant DCT coefficients. While maintaining JPEG or MPEG compatibility, threshold selection for the DCT coefficients of an image or video frame is based on optimizing for minimum distortion for a specified maximum target coding bit rate or, equivalently, for minimized coding bit rate for a specified maximum allowable distortion constraint. In the selection process, a dynamic programming method is used.

Description:
The U.S. Government has certain rights in this invention under Contract CDR-881111 awarded by the National Science Foundation. 
    
    
     TECHNICAL FIELD 
     The invention relates to data compression in digital image and video signal processing. 
     BACKGROUND OF THE INVENTION 
     For digital coding of signals corresponding to still images or video sequences, respective standards known as JPEG and MPEG have been proposed; see &#34;JPEG Technical Specification&#34; Revision (Draft), Joint Photographic Experts Group, ISO-IEC/JTC1/SC2/WG8, CCITT SG VIII, August 1990 and &#34;Coded Representation of Picture and Audio Information&#34;, Test Model 1, Draft Revision 1, Experts Group on ATM Video Coding, ISO-IEC/JTC1/SC29/WG11, CCITT SG XV, May 1992. These standards are based on digital cosine transform (DCT) compression. For economy of transmission, DCT coefficients may be &#34;thresholded&#34; prior to transmission, by dropping the less significant DCT coefficients. This involves use of a suitable criterion for determining significance. 
     The following are cited as background in the field of digital image and video technology: 
     U.S. Pat. No. 5,001,559, &#34;Transform Coding Using Coefficient Prediction Techniques&#34;, issued Mar. 19, 1991 to C. A. Gonzales et al. discloses an encoding-decoding technique involving subdividing an image into blocks, transform coding of the image blocks to produce DC and AC coefficients., and recovery of the image from the coefficients of image blocks. 
     U.S. Pat. No. 5,142,380, &#34;Image Data Processing Apparatus&#34;, issued Aug. 25, 1992 to K. Sakagami et al. discloses image data processing from memories for storing transform coefficients and threshold values. The ratios of transform coefficients to threshold values are quantized, a DC component is subtracted, zero values are detected and counted, and Huffman coding is applied. 
     The paper by D. L. McLaren et al., &#34;Removal of Subjective Redundancy from DCT-coded Images&#34;, IEE Proceedings-I, Vol. 138, pp. 345-349 (1991) discloses thresholding of image transform coefficients, with each threshold chosen as large as possible subject to the requirement that no difference be perceived between an original and a reconstructed image. 
     The paper by C.-T. Chen, &#34;Transform Coding of Digital Images Using Variable Block Size DCT with Adaptive Thresholding and Quantization&#34;, Proceedings of the SPIE, Vol. 1349, Applications of Digital Image Processing XIII, pp. 43-54 (1990) discloses thresholding and quantization applied to blocks of an image segmentation. The segmentation is optimized based on statistical, standard-deviation considerations. 
     The paper by C.-T. Chen et al., &#34;A K-th Order Adaptive Transform Coding Algorithm for Image Data Compression&#34;, Proceedings of the SPIE, Vol. 1153, Applications of Digital Image Processing XII, pp. 7-18 (1989) discloses transform coding of an image, with compression parameters adapted to image contents. 
     The paper by Y.-Q. Zhang, &#34;A Combined-Transform Coding (CTC) Scheme for Image Data Compression&#34;, IEEE Transactions of Consumer Electronics, Vol. 37, pp. 972-977 (1991) discloses image data compression by a so-called combined-transform coding technique in which image information is classified into a most significant portion and a less significant portion. Data compression is applied to the most significant portion as a whole. The less significant portion is segmented, and data compression is applied to the individual segments. 
     The paper by Y. Du, &#34;Scene Adaptive Vector Quantization&#34;, Third International Conference on Image Processing and its Applications, IEE Conf. Publ. No. 307, pp. 571-575 (1989) discloses image encoding involving discrete cosine transform, classification, edge detection, spectral weighting, thresholding, spectrum partition, vector quantization, address coding, and scaler quantization. 
     The paper by A. Baskurt et al., &#34;Encoding the Location of Spectral Coefficients Using Quadtrees in Transform Image Compression&#34;, IEEE, ICASSP-89: 1989 International Conference on Acoustics, Speech and Signal Processing, Vol. 3, pp. 1842-1845 (1989) discloses a transform image coding method applied to blocks, with thresholding based on statistical properties of the transform coefficients. 
     The paper by Y. B. Yu, &#34;Variable Block Size and Position Transform Coding&#34;, Proceedings, EUSIPCO-88, Fourth European Signal Processing Conference, Vol. 2, pp. 1011-1013 (1988) discloses transform coding of image data with optimized determination of block boundaries by a dynamic programming technique. 
     The paper by D. K. Mitrakos et al., &#34;Digital Image Compression with Fidelity Constraints&#34;, 1983 International Electrical, Electronics Conference Proceedings, IEEE, Vol. 2, pp. 614-617 (1983) discloses identification and exploitation of structure in data representing an image for optimized choice of encoding parameters by dynamic programming. 
     A still or video image frame may have 256×256 signal values or pixels, for example. For encoding, the frame may be subdivided into 32×32 &#34;blocks&#34;, each having 8×8 pixels. Each one of the blocks is digitally encoded into DCT coefficients. Thresholding is applied to the DCT coefficients, and the thresholded coefficients are transmitted in accordance with a standardized sequence of the blocks, corresponding to a zigzag pattern on the image. With such standardization, JPEG and MPEG decoders have become popular, so that, desirably, any improved technique should remain compatible with these decoders. 
     SUMMARY OF THE INVENTION 
     While maintaining JPEG and MPEG compatibility, the DCT coefficients of an image or video frame are selected for rate-distortion optimality. Thus, distortion is minimized for a specified maximum target coding bit rate or, equivalently, coding bit rate is minimized for a specified maximum allowable distortion level. In a preferred selection process, a dynamic programming method is used. 
    
    
     BRIEF DESCRIPTION OF THE DRAWING 
     FIG. 1 is a block diagram of signal processing involving quantization and thresholding and of a corresponding processing system in accordance with preferred embodiments of the invention. 
     FIG. 2 is a graphic representation of DCT coefficients for a typical 8×8 image block of JPEG/MPEG, linearly ordered according to the zigzag scan order. 
     FIG. 3 is a block diagram of dynamic programming recursion in accordance with a preferred embodiment of the invention, applied to an 8×8 image block. 
     FIG. 4 is a schematic which illustrates dropping or pruning of DCT coefficients in accordance with a preferred embodiment of the invention. 
     FIG. 5 is a graphic representation of distortion as a function of bit rate for two different JPEG scales, for an image as in FIGS. 7a and 7b. 
     FIG. 6 is a graphic representation of distortion as a function of bit rate for three different QP levels in MPEG, for an intraframe coded test frame. 
     FIG. 7a is an image of a house, transmitted without thresholding. 
     FIG. 7b is an image of the same house, transmitted with thresholding in accordance with a preferred embodiment of the invention. 
     FIG. 8 is a graphic representation of distortion as a function of bit rate for thresholding in accordance with a preferred embodiment of the invention, as compared with thresholding by retaining the largest coefficients in a block. 
     FIG. 9 is a block diagram of a signal processing system in accordance with a preferred embodiment of the invention. 
    
    
     DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS 
     In preferred data compression, that subset of the DCT coefficients is retained which is most favorable in a rate-distortion (R-D) sense. At a marginal sacrifice of coded quality, a significant reduction in coding bit rate may then be realized, as fewer coefficients have to be transmitted. This applies especially when deciding on the last non-zero coefficient which, in JPEG and MPEG, is followed by an inexpensive end-of-block code. 
     In a preferred method, a fast recursive dynamic programing (DP) technique is used. Starting from the highest-quality point after quantization at a fixed scale in the case of JPEG, or at a fixed QP-level in the case of MPEG, the entire thresholding R-D curve can be swept over a continuous range of target bit rates or, equivalently, of target coding qualities by dropping insignificant coefficients in an image or video frame. Thus, all points on the convex hull of the thresholding R-D curve can be found. The method takes advantage of the monotonic nature of bit rate versus zero-run-length count preceding a non-zero coefficient inherent in the Huffman tables of JPEG and MPEG. 
     The following notation is helpful for further description, and also appears in FIG. 1 which shows a quantizer or coder 1 and a thresholder or optimizer 2: 
     X denotes a signal of interest, corresponding, e.g., to an 8×8 block of an image or video frame; 
     X  denotes a DCT-quantized version of X corresponding to a fixed scale or &#34;anchor&#34; level representing the maximum quality operating point; 
     X  denotes a desired thresholded version of X ; 
     D(x,y) denotes an appropriate distortion metric between signals x and y, such as mean-squared error (MSE) distortion, for example; 
     R(x) denotes the minimum bit rate required for transmission of a signal x; and 
     R budget  denotes the maximum target bit rate. 
     Sought is X.sup.˜, having a quantized version which is the same as the quantized version of X, namely X , and such that 
     
         D(X,X.sup.˜) is minimized subject to R(X.sup.˜)≦R.sub.budget 
    
     This constrained optimization problem can be converted into a corresponding unconstrained problem with a &#34;Lagrange multiplier&#34;, λ. The task then becomes minimization of the function J(λ) defined by 
     
         J(λ)=D(X,X.sup.˜)+λ·R(X.sup.˜) 
    
     Advantageously, the optimal coefficient search for the image can be performed independently for each 8×8 image block for the fixed quality &#34;slope&#34; λ, which trades-off distortion for rate. This is because, at R-D optimality, all blocks must operate at the same slope point λ on their R-D curves; see the paper by Y. Shoham et al., &#34;Efficient bit allocation for an arbitrary set of quantizers&#34;, IEEE Transactions on Acoust., Speech, Signal Proc., Vol. 36 (1988), pp. 1445-1453. 
     In the present example of an 8×8 block, optimization is over the corresponding set of 64 coefficients. Thus, if T={0, 1, 2, . . . , 63} is the set of DCT coefficient indices of the 8×8 block, ordered in the standard zigzag scan order, if S≦T denotes any feasible ordered subset of T, and if D(S) and R(S) denote the distortion and the bit rate, respectively, associated with retaining the coefficients in S, the task of finding 
     
         D.sub.min =min.sub.S≦T D(S) subject to R(S)≦R.sub.budget 
    
     is accomplished upon defining 
     
         J(λ)=D(S)+λ·R(S) 
    
     representing the Lagrangian cost of S associated with the quality factor λ, and finding 
     
         J.sub.min (λ)=min.sub.S J(λ)=min.sub.S (D(S)+λ·R(S)) 
    
     The desired, initially unknown optimal value λ* for λ depends on the particular target budget or quality constraint. This value can be obtained readily by a convex search using the bisection method: 
     
         J.sub.min (λ*)=max.sub.λ≧0 (J.sub.min (λ)-λ·R.sub.budget) 
    
     For an exposition of the bisection method, see, e.g., the paper by K. Ramchandran et al., &#34;Best Wavelet Packet Bases in a Rate-Distortion Sense&#34;, IEEE Transactions on Image Processing, Vol. 2, pp. 160-173 (1993). 
     Since, as described above, the optimal convex-hull solution can be found by finding the minimum-Lagrangian-cost operating point, i.e., one which minimizes 
     
         J=D.sub.block +λ*·R.sub.block 
    
     for each block of the sequence independently, consideration of a single block is sufficient. In a preferred embodiment, the zigzag scan that is part of the JPEG and MPEG standards is used to order the 2-D DCT coefficients. As an initialization, the ΔJ j ,k &#39;s are determined which are associated with the incremental Lagrangian cost of going from coefficient j directly to coefficient k, i.e., of dropping all the intermediary coefficients, for all non-zero valued (j,k)-coefficient pairs with j&lt;k. ΔJ j ,k =-E k  +λ·R j ,k represents the &#34;net gain&#34; of including C  k  conditioned on the previous non-thresholded coefficient being C  j . E k  represents the &#34;goodness&#34; or quality measure as calculated by the decrease in squared error caused by retaining C  k , and is given by C k   2  -(C k  -C  k ) 2 , where C k  and C  k  are the unquantized and quantized coefficient values, respectively, and R j ,k is the conditional bit rate in coding coefficient C  k  given that the previous non-zero coefficient is C  j , i.e., R j ,k is the conditional cost of retaining C  k . For illustration, see FIG. 2. C  0  is the DC coefficient. 
     The values R j ,k can be prestored from the JPEG and MPEG standard Huffman coding tables; see, e.g., the above-referenced JPEG and MPEG references. Only the run lengths need to be stored, not the actual Huffman coded bit stream, so that little memory is required. The optimal operating point, for a fixed value of λ, can be found in a recursive fashion by finding first the minimum Lagrangian cost J*(k) and then the optimal predecessor coefficient, &#34;predecessor(k)&#34;, associated with choosing coefficient C  k  as the last non-zero coefficient for all k=1, 2, . . . , 63. Then, starting from that coefficient k* which is the least costly to retain as the last non-zero coefficient, i.e., minimum J*(.), the optimal set can be &#34;backtracked&#34; from the optimal predecessor chain calculated for all predecessors of k*. See FIG. 3 for illustration. 
     A more detailed step-by-step description of the method follows. The recursion begins with coefficient 0. The cost of dropping all AC coefficients is stored as J*(0). Then, the minimum-cost &#34;path&#34; that ends in coefficient 1 is selected. There is no choice in this, as there is only one path that ends in coefficient 1, namely dropping all coefficients from 2 to 63. This cost is saved as J*(1), and the optimal predecessor to 1 is 0. Proceeding to coefficient 2, the most efficient recursive way of determining the best path that ends in 2 is to find the optimal predecessor to 2, i.e. either 0 or 1. Since the optimal costs associated with ending at 0 or 1 are known from J*(0) and J*(1), respectively, the task of finding the least costly path ending in 2 amounts to finding the minimum of J*(0)+ΔJ 0 ,2 (where ΔJ 0 ,2 is the incremental cost of going from 0 to 2), and J*(1)+ΔJ 1 ,2. The smaller of these two costs is saved as J*(2), and the optimal predecessor of 2, i.e., the one among 0 or 1 which resulted in the smaller total cost leading to 2, is saved as predecessor(2). Proceeding similarly to coefficient 3, the best path ending in 3 must have a direct predecessor which is either 0, 1 or 2. As the best costs associated with ending at all predecessors are known from previous iterations and are stored as J*(predecessor), and as the incremental cost of going from each predecessor to &#34;3&#34; is known from the precomputed ΔJ predecessor , 3 for all predecessors 0, 1 and 2, the best path ending in 3 is computed as the least of the total costs J*(predecessor)+ΔJ predecessor , 3 for all predecessors 0, 1 and 2. The least cost is saved as J*(3), the optimal predecessor is saved as predecessor(3), and the recursion continues to coefficient 4 and so on until the last coefficient 63 is processed. At this point, the optimal last non-zero coefficient k* is the one with the smallest J*(k) for k=0, 1, . . . , 63. Backtracking from k* now yields the optimal predecessor chain sequence starting from predecessor(k*) and going back to 0, at which point the entire optimal set of coefficients to be retained for the block is known, for the given λ. 
     Generally, in finding the optimal predecessor at a particular iteration k as described above, all coefficients j&lt;k have to be considered as candidates. However, for the particular case of monotonicity of R j ,k in the zero-run-length count (k-j-1), which is the case for the default coding tables of JPEG and MPEG, a &#34;fast pruning&#34; method can be used to speed up the search. This results in a substantial decrease in computational complexity, and leads to a fast optimal method. See FIG. 4 for illustration. 
     Optimal dynamic programing is performed independently on each one of the blocks. The composite R-D point for the picked λ is then obtained as the sum of the optimally obtained R-D points for each block for that value of λ. Finally, the optimal slope λ* which solves the desired budget or quality constraint is found using a fast convex search. 
     A preferred method is illustrated further in terms of method steps listed below, in Phase I for a fixed operating slope λ for a single typical 8×8 image block. Phase I is applied independently and preferably in parallel to each signal block to determine the optimal coefficient sequence to be retained for that block. Included in Phase I, through Step 6, is a determination of the optimal last coefficient to be retained as a non-zero coefficient. This coefficient has the index k*. Then, starting at Step 7, the entire optimal set of coefficients is produced as {optset}. In Phase II, the optimal operating slope λ* for the composite problem is obtained. 
     A one-time fixed cost of gathering the required statistics is incurred as described above with reference to FIG. 2. This involves gathering, for each DCT coefficient C  k , its thresholding distortion E k  and its conditional non-thresholding coding cost R j ,k conditioned on every preceding non-zero coefficient j&lt;k. 
     In the method described by steps below, E denotes the total unquantized AC energy in the signal block, i.e., E=ρ k=1   63  C k   2 . E k  denotes the thresholding distortion associated with coefficient k, R j ,k denotes the incremental bit rate cost of coding k after j, ΔJ j ,k denotes the incremental Lagrangian cost of including k after j, J k  * is the minimum Lagrangian cost associated with having k as the last non-zero coefficient, and S k  is the set of all candidate optimal predecessor coefficients to k. See FIG. 3 for further illustration. 
     Phase I: Finding the Optimal Coefficient Set for a λ-value. 
     Finding the Optimal Last Coefficient. 
     Step 1. Compute ΔJ i ,j ←-E j  +λ·R i ,j for all non-zero coefficient pairs i,j with j&gt;i 
     Step 2. (Initialization) k*←0; k←0; S 0  *←{0}; J 0  *←E; predecessor(0)←nil 
     Step 3. k←k+1; if k=63, go to Step 7; otherwise continue with Step 4 
     Step 4. If E k  =0, set S k  ←S k   1  and go to Step 3; otherwise continue with Step 5 
     Step 5. J k  *←min i .di-elect cons.S(k-1) (J i  *+ΔJ i ,k); if J k  *≦J k*  *, then k*←k 
     Step 6. S k  ←{k}∪{i|i.di-elect cons.S k-1  and J i  *&lt;J k  *}; predecessor(k)←min -1   i .di-elect cons.s(k-1) (J i  *+ΔJ i ,k); go to Step 3 
     Backtracking to Find the Optimal Coefficient Set. 
     Step 7. Initialize the set of optimal coefficients as optset←{k*}; set k←k* 
     Step 8. If predecessor(k)=nil, then go to Step 10; otherwise, continue with Step 9 
     Step 9. Get the optimal predecessor to k and include its membership in the set {optset}: 
     {optset}←{optset}∪{predecessor(k)}; go to step 8 
     Step 10. DONE. The optimal solution of coefficients to be retained for the given λ is the set {optset}. 
     An important operation that ensures a fast algorithm is the pruning action in Step 6. This step eliminates from candidacy for predecessor to the next non-zero coefficient, all those prior coefficients whose lowest cost of retaining as the last non-zero coefficient exceeds that of the current iteration&#39;s coefficient. Thus, if the current coefficient produces the lowest cost so far, it is the only candidate for predecessor to the next non-zero coefficient. This is due to the monotonic nature of the bit-rate versus zero-run-length Huffman tables for JPEG and MPEG, where the cost of coding a non-zero coefficient is monotonically non-decreasing in the length of the zero-run preceding that coefficient. 
     Phase II: Finding the Optimal Operating Slope. 
     The optimal value λ* which solves a desired budget constraint R budget  is found using a convex-search bisection algorithm. Starting from a known initial interval encompassing the desired operating slope, the search intervals are made successively smaller, exploiting the convex relationship of both global rate and global distortion with respect to the operating slope λ, until convergence is achieved. If λ 1 .sup.(i) and λ u .sup.(i) are the lower and upper bounds to λ* at iteration i, then the convexity property is exploited in tightening either the upper bound or the lower bound at the (i+1)th iteration to λ.sup.(i+1) =|(ΔD/ΔR).sup.(i) |, where this ratio of the difference in distortion and rate associated with the slopes λ 1 .sup.(i) and λ u .sup.(i) of the i-th iteration provides a closer approximation to λ* than the one available at the i-th iteration. 
     In the exemplary method, Phase II may be implemented as an &#34;outer loop&#34; for block-by-block processing. However, as mentioned above, parallel processing is preferred. In either case, Phase I is invoked for each value of λ put forth by Phase II, for converging values of λ for a block. The value of λ* solves the budget Constrained problem to within a convex hull approximation. 
     In a systems implementation in accordance with a preferred embodiment as shown in FIG. 9, Phases I and II are implemented in the optimizer or thresholder 2. The thresholder 2 receives the quantized input signal X from the coder or quantizer 1. These are as in FIG. 1. 
     Steps 1-6 of Phase I are implemented in the thresholder 2 in a finder 21, and steps 7-10 in a backtracker 22. A stopping criterion for Phase II is implemented in the thresholder 2 in a tester 23, e.g., based on the size of the difference between current upper and lower bounds for λ*. The final subset X.sup.˜  of X  goes to a transmitter 3. 
     The method of Phase I can also be used independently, without Phase II, e.g., for &#34;sweeping&#34; through values of λ. For example, Phase I can be used to quantify the benefits of adaptive thresholding applied to the JPEG and MPEG coding environments, as R-D curves are obtained by sweeping the Lagrange multiplier λ through all positive values for typical quantization scales of interest. 
     FIG. 5 shows the R-D curves for a typical image using JPEG for pre-thresholding quantization scales of 1.0 for curve (a), and of 0.7 for curve (b). Point X on curve (a) is the unthresholded &#34;reference&#34; obtained for a scale of 1.0. First, with the bit rate fixed at the reference&#39;s bit rate of 0.615 bits per pixel (bpp): for the finer scale of 0.7, the non-thresholded bit rate, corresponding to point Z, is greater than that of X. With optimal thresholding, however, the bit budget constraint imposed by curve (a) is satisfied, and an adaptive thresholding gain in terms of increased SNR for the same bit rate is realized. Thus, point Y has a 0.7 dB gain at the same bit rate over X. Alternatively, with the PSNR fixed according to that of X (37.15 dB): point W has a compression advantage at the same PSNR of approximately 15%. 
     FIG. 6 also shows optimal thresholding R-D curves, for an intra-frame coded frame of the &#34;mit&#34; test sequence and using an MPEG intra-frame code book. Curve (a) corresponds to a QP level of 48, curve (b) to a finer quantizer QP level of 40, and curve (c) to a still finer QP level of 32. If the reference is fixed at point X on curve (a) corresponding to a QP of 48, point Y can be reached by &#34;backing off&#34; to the finer QP=40 and thresholding optimally to point Y at the same bit rate as X. For this example, with reference X, the thresholding gain at point Y is approximately 0.52 dB at a bit rate of 0.377 bpp. Alternatively, at the same MSE of 112.5, a 12% reduction in bit rate is realized at point W of curve (b). If point Z on curve (c) with QP=32 were chosen, a lesser coding gain of approximately 0.26 dB would be realized over point X. 
     In experiments, it was found that &#34;backing off&#34; to a finer quantization scale and thresholding optimally until the same reference bit rate or PSNR is achieved as an unthresholded coarser quantized version resulted in an appreciable coding gain. However, as illustrated by FIG. 6, there was an optimal back-off point beyond which the performance started to degrade. Thresholding after starting with a finer quantization scale is inadvisable beyond a point, as the gain of representing the non-thresholded coefficients with less distortion is no longer outweighed by dropping entire coefficients, since for fine quantization scales, there is not much distortion to begin with. 
     Coding results obtained from performing optimal thresholding on typical images and video sequence frames used in the image processing community revealed a coding gain of about 0.5-1 dB, or about 12-15% bit rate compression improvement while retaining complete decoder compatibility. Subjectively, optimal thresholding appears as most beneficial in the case of low to medium bit rate coding, as illustrated by FIGS. 7a and 7b. FIG. 7a shows as a non-thresholded reference a standard &#34;House&#34; image coded with JPEG using a quantization scale of 3.0. The thresholded version using a scale of 2.0 is shown in FIG. 7b. The coding gain is 0.8 dB, and the subjective quality is improved. An intuitive reason lies in that, for low bit rate applications, it is preferable to represent the low frequency coefficients with maximum fidelity while dropping the expensive high frequency coefficients. This gives a smoother but less noisy image, which is best possible at low bit rates. Thus, adaptive thresholding can take the place of noise shaping or low pass filtering without any external processing and without affecting the decoder. 
     The performance of the optimal algorithm was compared with a simple-minded heuristic method that retains for each block the k DCT coefficients which are largest in magnitude. FIG. 8 shows that considerable gain can be realized by using an optimal method, namely more than 5 dB for bit rates below 0.6 bpp. At 0.52 bpp, the gain is approximately 5.6 db. 
     While the above is a description of the invention in preferred embodiments, various modifications, alternatives and equivalents may be employed, only some of which have been described above. For example, preferred processing can be applied to image or video frames which may be partitioned in other ways than into 8×8 blocks. Also, instead of simple mean-squared error, another suitable distortion metric can be used, e.g., to take subjective measures into account. Thus, for example, activity-weighted mean-squared error can be used. Yet other variations will be apparent to those skilled in the art.