1.  Field of the Invention
The present invention relates to a method and apparatus for encoding and/or decoding moving pictures, and more particularly, to a method and an apparatus for encoding and/or decoding moving pictures which are capable of enhancing the efficiency of encoding moving pictures by adaptively selecting a quantization matrix in consideration of the characteristics of images input into a moving picture encoder. 
2.  Description of the Related Art
FIG.  1 is a block diagram of an encoding unit 120 for encoding moving pictures and a decoding unit 140 for decoding encoded moving pictures. 
In order to provide a video-on-demand (VOD) service or to enable a moving picture communication, the encoding unit 120 creates a bitstream encoded by a compression technique, and the decoding unit 140 restores original images from a bitstream input thereinto. 
A discrete cosine transform (DCT) unit 122 carries out a DCT operation on image data input thereinto in the unit of an 8×8 pixel block in order to remove spatial correlation from the input image data.  A quantization unit (Q) 124 carries out highly efficient data loss compression by carrying out quantization on the input image data using a DCT coefficient obtained by the DCT unit 122 and representing the quantized data by several representative values. 
An inverse quantization unit (IQ) 126 inversely quantizes the quantized image data provided by the quantization unit 124.  An inverse discrete cosine transform (IDCT) unit 128 carries out an IDCT on the inversely quantized image data provided by the inverse quantization unit 126.  A frame memory unit 130 stores the IDCT'ed image data provided by the IDCT unit 128 on a frame-by-frame basis. 
A motion estimation and compensation unit (ME/MC) 132 estimates a motion vector (MV) for each macroblock and a sum of absolute difference (SAD), which correspond to a block matching error, by using the image data of a current frame inputted thereinto and the image data of a previous frame stored in the frame memory unit 130. 
A variable length coding unit (VLC) 134 removes statistical redundancy from digital cosine transformed and quantized image data according to the estimated motion vector provided by the motion estimation and compensation unit 132. 
A bitstream encoded by the encoding unit 120 is decoded by the decoding unit 140.  The decoding unit 140 includes a variable length decoding unit (VLD) 142, an inverse quantization unit 144, an IDCT unit 146, a frame memory unit 148, and a motion estimation unit 150. 
U.S. Pat.  No.  6,480,539 discloses an example of an apparatus for encoding moving pictures. 
A set-top box, which receives an analog terrestrial broadcast program and then encodes and stores the received program by using a data compression method such as MPEG2 or MPEG4, has recently been developed.  However, in the case of a terrestrial broadcast, images arriving at a receiving terminal may be distorted due to channel noise.  For example, an image may look as if white Gaussian noise were added thereto.  If the image is compressed as it is, the efficiency of compressing the image may be very low due to the influence of the white Gaussian noise. 
Therefore, in order to get rid of noise in a conventional method of encoding moving pictures, a pretreatment filter is provided at an input port of an encoder.  However, in the case of using the pretreatment filter, an additional calculation process for encoding moving pictures is needed. 
In addition, in such a conventional method of encoding moving pictures, a quantization matrix is determined irrespective of the characteristics of an input image, and quantization is carried out on the input image by applying the quantization matrix to the input image on a picture-by-picture basis, in which case the efficiency of encoding the inputted image is low.