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 "thresholded" 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.