Abstract:
In a quantization number selecting apparatus and method for a DVCR which can simplify the hardware configuration of a quantizer and can efficiently assign a proper quantization number minimizing quantization errors, the apparatus includes a plurality of quantizers serially connected and having each quantization number, for receiving a video segment composed of a plurality of macro-blocks and sequentially performing quantization according to each area number and class number, a plurality of bit-rate calculators for calculating each bit rate by the respective outputs of the plurality of quantizers, a plurality of quantization error summing portions serially connected for calculating quantization errors by the outputs of the plurality of quantizers and sequentially summing the same, and a bit estimator for selecting a quantization number by which each macro-block can be compressed into an adaptive length by the respective outputs of the bit-rate calculators and quantization error summing portions. Also, the method includes the steps of (1) sequentially quantizing a plurality of macro-blocks constituting a video segment, (2) calculating and sequentially summing bit-rates and quantization errors depending on the plurality of quantized macro-blocks, and (3) searching a macro-block having the minimum quantization error based on the calculated and summed bit-rates and quantization errors and allotting a quantization number having an adaptive bit-rate.

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates to a quantization number selecting apparatus for a digital video cassette recorder (DVCR) and a method therefor, and more particularly, to a quantization number selecting apparatus and method for a digital video cassette recorder (DVCR) which can simplify the hardware configuration of a quantizer by improving algorithms for assigning quantization number and can efficiently assign a proper quantization number which minimizes quantization errors using the errors generated during quantization and coded bit length. 
     In general, according to the formatting method, a 1/4&#34; DVCR can be divided into a standard definition (SD)-DVCR, a high definition (HD)-DVCR, an advanced television (ATV)-DVCR which is a follow-on generation broadcasting, and a digital video disk (DVD)-DVCR, etc. 
     In SD-DVCR, the National Television System Committee (NTSC) or Phase Alternation by line (PAL) method, which is a currently used method, is digitally converted for compression using its own compression algorithm to then be recorded and reproduced in digital, and the specification is already determined, that is, tape formatting, encoding and decoding methods are prescribed. 
     In other words, the algorithm depending on the determined specification should be developed by manufacturers themselves. Particularly, for a DVCR implementation, it is very important to solve the problem of a quantization number Q NO  which is the most influential factor in determining the efficiency of SD. 
     Hereinbelow, the generation of a general bit stream will be described with reference to accompanying drawings. 
     In the digital signal processing (DSP) in the SD method, an input NTSC or PAL signal is processed by an analog/digital (A/D) conversion to produce a Y.U.V composite digital signal sampled in a ratio of 4:2:2. Here, the luminance signal (Y) is sampled at 13.5 MHz and the chrominance signal (C) is sampled at 6.75 MHz. At this time, however, C is divided into Cr and Cb, each sampled at 3.375 MHz. 
     The thus-sampled video data quantity is too much to be recorded as it is. Thus, the data is decimated into a format of 4:1:1 to then be segmented into four 8×8 luminance DCT (discret cosine transform) blocks and two 8×8 chrominance DCT blocks, which consist of a macro-block unit. 
     For example, in case of the A/D conversion with 8-bit resolution, 8 bits/sample×(13.5 MHz+6.7 MHz)=162 Mbps. 
     The thus-converted digital video signal is compressed using DCT to then be recorded. 
     At this time, a DCT block is composed of 8 pixels horizontally and 8 lines vertically, as shown in FIG. 1. 
     As shown in FIGS. 2A and 2B which are schematic diagram of a luminance DCT block and a chrominance DCT block in a 525/60 system, in an NTSC (525 lines/60 Hz) system, the luminance DCT block is composed of 60 DCT blocks vertically and 90 DCT blocks horizontally, and the chrominance DCT block is composed of 60 DCT blocks vertically and 22.5 DCT blocks horizontally. 
     As shown in FIGS. 3A and 3B which are schematic diagram of a luminance DCT block and a chrominance DCT block in a 625/50 system, in a PAL (625 lines/50 Hz) system, the luminance DCT block is composed of 72 DCT blocks vertically and 90 DCT blocks horizontally, and the chrominance DCT block is composed of 36 DCT blocks vertically and 45 DCT blocks horizontally. 
     The digital video signal is subdivided into DCT blocks having the above-described configuration to produce a macro-block (MB) including four luminance DCT blocks and two chrominance DCT blocks, as shown in FIGS. 4A and 4B which are schematic diagram of a macro-block according to the NTSC or PAL method. 
     27 adjacent MBs are further combined to form a super block (SB), as shown in FIGS. 5A and 5B which are schematic diagrams of a 525/60 or 625/50 system. In a video having an SB, five MBs form a video segment, as shown in FIGS. 6A and 6B, to perform a bit rate reduction. At this time, each of five MBs constituting a video segment is shuffled based on the following regulation among various SBs: 
     
         VSi,k={MB(i+2)modn,2,k, MB(i+6)mod n,1,k, MB(i+8)mod n,3,k, MBimod n,0,k, MB(i+4)mod n,4,k), 
    
     where i=0, . . . n-1, and k=0, . . . 26. If n is 10, the system is a 525/60 system, and if n is 12, the system is a 625/50 system. 
     In the VS constructed as described above, 77 bytes are assigned to each MB through a data compression process, and the overall VS should be reduced at a constant ratio of 385 bytes. 
     In the data compressed as described above, each compressed MB data fetched from different VS&#39;s is taken to the original position to be recorded, prior to another recording operation. 
     Hereinbelow, a bit rate reduction process for data compression will be described with reference to accompanying drawings. 
     FIG. 7 is a schematic block diagram illustrating the generation of a bit stream in a general DVCR. 
     First, as described above, the apparatus for generating a bit stream in a general DVCR includes a shuffler 71 for shuffling an input video in order to efficiently compress the same to then reconstruct the video, a motion estimator 72 for detecting a motion vector in order to efficiently perform the DCT with respect to the reconstructed video and a DCT portion 75 for performing a DCT operation depending on the motion vector of motion estimator 72. DCT portion 75 performs in two modes as shown in FIGS. 8A and 8B which are tables showing examples of DCT operations depending on the motion vector. 
     If the motion vector is small, a 8×8 DCT is performed. ##EQU1## Here P i ,j,k,l (x,y) represents a pixel and C i ,j,k,l (h,v) represents a DCT coefficient. ##EQU2## Here, P i ,j,k,l (x,y) represents a pixel and C i ,j,k,l (h,v) represents a DCT coefficient. 
     As described above, after preforming DCT operations in different modes depending on the motion vector, each DCT coefficient is added with a wieghted value. Each weighted-value-added coefficient within DCT block is scanned by a scanner 76. 
     At this time, the scanning is processed in the numerical sequence shown in FIGS. 8A and 8B depending on the DCT mode. 
     In addition, each DCT block selects one of four different classes in a class determiner 73 using the class information needed for selecting a quantizer during quantization. The class is selected depending on the activity of each DCT block. 
     Particularly, in case of class 3 having the largest activity, one bit of the least significant bit (LSB) of every area class (AC) coefficient within the DCT block is removed, which is called an initial scaling. This process is performed in a scale coefficient determiner 77. 
     At this time, the activity of each DCT block is obtained in a bit rate analyzer 74 by comparing all AC coefficients within the DCT block to search the coefficient having the maximum absolute magnitude (MAM), 
     Each DCT block whose classes are analyzed as described above, is subdivided so as to have four different areas within the DCT block to have different quantization steps depending on the weighted value of the AC coefficient during quantization process, as shown in FIGS. 9A and 9B. 
     In other words, a low-frequency DCT coefficient is coded more precisely than a high-frequency DCT coefficient. 
     As described above, each DCT block constituting an MB has each class and each block is subdivided into four areas. 
     The number of areas represents the weight of a DCT coefficient. 
     At this time, quantizer is constructed to have 16 quantization steps, and the quantization steps are expressed, depending on the class and area, as shown in FIG. 10 which is a table illustrating quantization steps. 
     At this time, the multi-quantization converter 78 performs quantizations in four quantizations steps depending on the class and area using the quantization number Q NO . 
     Each MB is quantized in a quantization converter 80 with one Q NO  selected in quantization coefficient selector 79 to be variable-length coded in a variable-length coder (VLC) 81 and finally to then be sorted as shown in FIG. 11 which is a schematic diagram of the video quantized from the coded video information. 
     As described above, when an MB is sorted within 77 bytes, each MB performs a variable-length coding with different Q NO  s to have data having variable lengths. 
     Therefore, such MBs having variable length are first recorded in their own regions and then the data of the remaining MBs are recorded onto another MB areas which cannot filled in 77 bytes. Thus, each VS entirely satisfies 385 bytes. 
     The MBs within the thus-compressed VS restore into the original position taken before shuffling, prior to being recorded onto a tape again, that is a formatting is performed. 
     However, in the above-described quantization process, the respective MBs consisting of a VS are compressed with the Q NO  s suitable to their characteristics. In order to compress the VS in a fixed ratio, prior to quantization, if each DCT block predetermined and classified within the respective MBs consisting of a VS is quantization-VLC-performed, the compression should have been completed within 385 bytes in the unit of a VS, as described above. However, the respective shuffled MBs are independent from one another. Therefore, if the compression is collectively performed into 77 bytes, the picture quality may be deteriorated. 
     Therefore, in the conventional quantization process, in order to solve the above-mentioned problems, in order to perform compression by the allocation of bits adaptive to the complexity for the respective MBs, bits are allotted according to the ratio of the absolute magnitude sum (AMS) for the AC coefficients except the DC within the whole VS with respect to the AMS for the AC coefficients except the DC within the respective VSs. ##EQU3## where i represents the number of MBs, j represents the number of DCT blocks, k and l the numbers of DCT coefficients, C represents the DCT coefficient, and WL represents the whole length. 
     As described above, since proper bits are allotted to each MB to be quantized prior to quantization, an MB which is more complex and having more information is coded more perfectly, which is called a pre-analyzing. 
     In the pre-analyzing for a proper bit allocation according to the aforementioned quantization method, in order to select the quantization number Q NO  which can code adaptively to the number of bits, quantization should be performed for each MB in advance. 
     However, in the above-described method, the hardware constituting a quantizer becomes larger proportionally, and 16 kinds of quantizers and the corresponding VLC look-up tables are necessary. 
     Hereinbelow, a conventional quantization number selector will be described with reference to accompanying drawings. 
     As shown in FIG. 12, in the conventional quantization number selector, video segments are input to respective quantizers (Q 0  through Q 15 ) 20. Also, class number and area number are input to each quantizer 20. 
     In other words, the system is a multi-quantizer system that all possible quantizations depending on the quantization number Q NO  exist. 
     The quantization step for each class number and area number depending on the quantization number Q NO  is output by quantizers (Q 0  through Q 15 ) 20 and bit calculators (0 through 15) 21 so that the quantization number Q NO  close to a desired compression ratio is selected in a bit estimator 22. 
     However, in the conventional multi-quantizer system, at least 1-bit shift not exceeding 4-bit shift is necessary according to the quantization steps. 
     A constant number of bits suitable for each macro-block of the input video segment should be allotted. Also, the quantization number Q NO  suitable for the allotted should be selected for each macro-block. At this time, if the number of allotted bits is not suitable for the macro-block, a distortion may be caused to the macro-block. 
     SUMMARY OF THE INVENTION 
     Therefore, to solve the above problems of the conventional arts, it is an object of the present invention to provide an apparatus and method for selecting a quantization number of a DVCR which can simplify the hardware configuration of a quantizer by improving the algorithm for quantization number allocation and can efficiently assign the quantization number having optimum quantization error and a constant bit rate using the quantization error and coded bit length by using a serial quantizer not necessitating the quantization bank of full specification. 
     To accomplish the above object, there is provided a quantization number selecting apparatus of a DVCR according to the present invention comprising: a plurality of quantizers serially connected and having each quantization number, for receiving a video segment composed of a plurality of macro-blocks and sequentially performing quantization according to each area number and class number; a plurality of bit-rate calculators for calculating each bit rate by the respective outputs of the plurality of quantizers; a plurality of quantization error summing portions serially connected for calculating quantization errors by the outputs of the plurality of quantizers and sequentially summing the same; and a bit estimator for selecting a quantization number by which each macro-block can be compressed into an adaptive length by the respective outputs of the bit-rate calculators and quantization error summing portions. 
     Also, there is provided a method for selecting a quantization number of a DVCR according to the present invention comprising the steps of: (1) sequentially quantizing a plurality of macro-blocks constituting a video segment; (2) calculating and sequentially summing bit-rates and quantization errors depending on the plurality of quantized macro-block; and (3) searching a macro-block having the minimum quantization error based on the calculated and summed bit-rates and quantization errors and allotting a quantization number having an adaptive bit-rate. 
     Also, according to another embodiment of the present invention, there is provided a quantization number selecting apparatus comprising: a first quantizer for quantizing a video segment composed of an input plurality of macro-blocks into a first quantization number and calculating a variable-length (VL) coded value accessed from a VLC table; a first delay for delaying the input video segment for a constant time and outputting the delayed video segment; a first switch for switching access of a VLC value of the VLC table by the VLC value of the first quantizer; a second quantizer for quantizing the video segment output from the first delay into a second quantization number depending on the selection of the first switch; a third quantizer for quantizing the video segment output from the first delay into a third quantization number; a second switch for switching access of the VLC value of the VLC table by the VLC value of the second and third quantizers; a second delay for delaying the video segment output from the first delay for another constant time and outputting the delayed video segment; a fourth quantizer for quantizing the video segment output from the second delay into a fourth quantization number by the switching operation of the second switch; a fifth quantizer for quantizing the video segment output from the second delay into a fifth quantization number; a sixth quantizer for quantizing the video segment output from the second delay into a sixth quantization number; a seventh quantizer for quantizing the video segment output from the second delay into a seventh quantization number; and a quantization number selector for receiving the VLC values of the first through seventh quantizers and selecting a quantization number. 
     Also, according to another embodiment of the present invention, there is provided a method for selecting a quantization number of a DVCR according to the present invention comprising the steps of: (1) sequentially quantizing a video segment composed of a plurality macro-blocks into a first quantization number, calculating a first VLC value and comparing the same with a target length; (2) quantizing the video segment into a second quantization number if the first VLC value is greater than the target length, to calculate a second VLC value and compare the same with a target length, and quantizing the video segment composed of a plurality macro-blocks into a third quantization number for the other values to calculate a third VLC value and compare the same with a target length; (3) quantizing the video segment into a fourth quantization number if the third VLC value is greater than the target length, to calculate a fourth VLC value, and quantizing the video segment into a fifth quantization number for the other values to calculate a fifth VLC value, or quantizing the video segment into a sixth quantization number if the second VLC value is greater than the target length, to calculate a sixth VLC value, and quantizing the video segment into a seventh quantization number for the other values, to calculate a seventh VLC value; (4) determining a quantization number using the VLC values calculated according to the quantization steps in the first, second and third processes. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The above objects and advantages of the present invention will become more apparent by describing in detail a preferred embodiment thereof with reference to the attached drawings in which: 
     FIG. 1 is a schematic diagram of a DCT block; 
     FIGS. 2A and 2B are schematic diagrams of a luminance DCT block and a chrominance DCT block in a 525/60 system, respectively; 
     FIGS. 3A and 3B are schematic diagrams of a luminance DCT block and a chrominance DCT block in a 625/50 system, respectively; 
     FIGS. 4A and 4B are schematic diagrams of a macro-block according to an NTSC or PAL method; 
     FIGS. 5A and 5B are schematic diagrams of a super-block in the 525/60 or 625/50 system; 
     FIGS. 6A and 6B are schematic diagrams of a frame in the 525/60 or 625/50 system; 
     FIG. 7 is a schematic block diagram illustrating a process of generating a bit stream in a general DVCR; 
     FIGS. 8A and 8B are construction tables showing examples of DCT transform; 
     FIGS. 9A and 9B are construction tables showing examples of DCT transform according to area numbers; 
     FIG. 10 is a construction table showing quantization steps; 
     FIG. 11 is a schematic diagram of a quantized video; 
     FIG. 12 is a schematic block diagram of a conventional quantization number selector; 
     FIG. 13 is a schematic block diagram of a quantization number selector according to a first embodiment of the present invention; 
     FIG. 14 is a flowchart showing a quantization number selecting method according to the first embodiment of the present invention; 
     FIG. 15 is a schematic block diagram of a quantization number selector according to a second embodiment of the present invention; 
     FIG. 16 is a first flowchart showing a quantization number selecting method according to the second embodiment of the present invention; 
     FIG. 17 is a graph showing the bit-rate variation depending on the change of the quantization numbers according to the second embodiment of the present invention; 
     FIG. 18 is a second flowchart showing a quantization number selecting method according to the second embodiment of the present invention; and 
     FIG. 19 is a formatting schematic diagram according to the second embodiment of the present invention. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     According to the first embodiment of the present invention, the quantization number selecting and method of a DVCR selects a quantization number using a quantization error and coded bit length. 
     As shown in FIG. 10, the quantization steps are generally in the form of 1.2.4.8.16, which can be expressed in 2 n  (n=0, 1, 2, . . .). Therefore, quantization is performed by shifting the least significant bit (LSB). 
     At this time, if the LSB of shift circuit is &#34;1,&#34; a quantization error is inserted. If the LSB of shift circuit is &#34;0,&#34; a quantization error is not inserted, which is a special case. 
     In other words, if the quantization step is 1.2.4.8 in case of 8 (that is, 1000), a quantization error is not generated at all. 
     Therefore, as described above, the LSB for each macro-block is checked to search a quantization number to minimize the quantization errors, so that a quantization number for each macro-block, which can compress a video segment to a constant unit or below, can be selected. 
     The quantization step is determined according to the quantization number by input class number and area number if there are quantization numbers Q NO15  ˜Q NO0 . The class number indicates the activity of a DCT block and the area number indicates the weight of a DCT coefficient. 
     As shown in FIG. 13, according to a first embodiment of the present invention, if quantizers 30 having each quantization number Q NO15  ˜Q NO0  are serially connected for serial processing, only 1-bit shifts exist all the time, thereby simplifying the hardware of quantizers 30. 
     For example, if the quantization number QNO is changed from 8 to 7, the step is changed from 1 to 2 only when the class number is 0 and the area number is 2. When the class number is 2, since the quantization step is changed from 2 to 4 and from 4 to 8, for the area numbers 1 and 3, 1-bit shift only completes the quantization. 
     If the rate of five compressed macro-blocks, i.e., the bit-rate of a video segment, is longer than an original target rate, it should be determined which macro-block is more compressed than other four macro-blocks, that is, whose quantization number Q NO  is reduced. The quantization number Q NO  of the macro-block MB having the minimum quantization error Q E  is reduced using the quantization errors calculated by bit-rate calculator/quantization error summing portions 31, thereby controlling the bit-rate. 
     Hereinbelow, the operation of the quantization number selector according to the first embodiment of the present invention for obtaining the optimum quantization number will be described. 
     As shown in FIG. 14, vide segment signals are input and five macro-blocks are quantized into quantization number (Q NO ) 15, respectively (step 701). The bit-rate of each macro-block (MB) generated thereat and quantization error are calculated and summed (step 702). 
     The summed bit rate and a target bit rate are compared (step 703). 
     If it is determined in step 703 that the bit rate of the video segment is higher than the intended target bit rate, in order to select whose quantization number Q NO  should be reduced among five MBs, the MB having the minimum quantization error Q E  is searched, based on the quantization errors obtained in bit-rate calculator/quantization error summing portions 31 (step 705). 
     It is determined whether the quantization number Q NO  of the MB having the minimum quantization error Q E  is 0 or not (step 706). If the quantization number Q NO  is 0, the MB having the minimum quantization error Q E  is searched among the MBs whose quantization number Q NO  is not 0 (step 707). 
     The quantization number Q NO  of the MB having the minimum quantization error Q E  is reduced (step 708). The bit-rate and quantization error Q E  of each macro-block (MB) are calculated and summed (step 709). The summed bit rate and a target bit rate are compared again (step 703). If the summed bit rate is proper, the obtained quantization number Q NO  of each MB is used as the actual scale factor (step 704). 
     In other words, since the quantization number Q NO  of the MB having the minimum quantization error Q E  is reduced, the bit-rate is the video segment finally coincides with the target rate, thereby efficiently designating the proper quantization number Q NO  having the minimum quantization error Q E . 
     FIG. 15 is a schematic block diagram of a quantization number selecting apparatus according to a second embodiment of the present invention, and FIG. 16 is a first flowchart showing a quantization number selecting method according to the second embodiment of the present invention. 
     First, as shown in FIG. 15, the quantization number selector according to a second embodiment of the present invention includes a first quantizer Q 8  for quantizing a video segment composed of an input plurality of macro-blocks into a quantization number 8 (Q NO  8) and calculating a variable-length coded (VLC) value accessed from a variable length coding (VLC) table, a first delay 120 for delaying the input video segment for a constant time and outputting the delayed video segment, a first switch 126a for switching access of a VLC value of VLC table by the VLC value of first quantizer Q 8 , a second quantizer Q 12 , for quantizing the video segment output from first delay 120 into a quantization number Q NO  12 depending on the selection of first switch 126a, a third quantizer Q 4  for quantizing the video segment output from first delay 120 into a quantization number 4 (Q NO  4), a second switch 126b for switching access of the VLC value of VLC table by the VLC values VL12 (MB) and VL4 (MB) of second and third quantizers Q 12  and Q 4 , a second delay 121 for delaying the video segment output from first delay 120 for another constant time and outputting the delayed video segment, a fourth quantizer Q 14  for quantizing the video segment output from second delay 121 into a quantization number 14 Q NO  14 by the switching operation of second switch 126b, a fifth quantizer Q 10  for quantizing the video segment output from second delay 121 into a quantization number 10 (Q NO  10), a sixth quantizer Q 6  for quantizing the video segment output from second delay 121 into a quantization number 6 (Q NO  6), a seventh quantizer Q 2  for quantizing the video segment output from second delay 121 into a quantization number 2 (Q NO  2), and a quantization number selector 125 for receiving the VLC values of first through seventh quantizers Q 8 , Q 12 , Q 4 , Q 14 , Q 10 , Q 6  and Q 2  and selecting a quantization number Q NO . 
     Also, as shown in FIG. 16, the quantization number selecting method according to the second embodiment of the present invention includes the steps of (1) quantizing a video segment composed of a plurality macro-blocks into a quantization number 8 (Q NO  8) to calculate a VLC value VL8 (MB) (step 130) and comparing the same with a target length (step 131), (2) quantizing the video segment into a quantization number 4 (Q NO  4) if the VLC value VL8 (MB) is greater than the target length, to calculate a VLC value VL4 (MB) (step 133) and compare the same with a target length (step 135), and quantizing the video segment composed of a plurality macro-blocks into a quantization number 12 (Q NO  12) for the other values, to calculate a VLC value VL12 (MB) (step 132) and compare the same with a target length (step 134), (3) quantizing the video segment into a quantization number 10 (Q NO  10) if the VLC value VL12 (MB) is greater than the target length, to calculate a VLC value VL10 (MB) (step 137), and quantizing the video segment into a quantization number 14 (Q NO  14) for the other values, to calculate a VLC value VL14 (MB) (step 136), or quantizing the video segment into a quantization number 2 (Q NO  2) if the VLC value VL4 (MB) is greater than the target length, to calculate a VLC value VL2 (MB) (step 139), and quantizing the video segment into a quantization number 6 (Q NO  6) for the other values, to calculate a VLC value VL6 (MB) (step 138), (4) determining a quantization number using the VLC values (Q NO  2, Q NO  4, . . . Q NO  12 , Q NO  14) calculated according to the quantization steps in the first, second and third processes (step 140). 
     In other words, the bit number of the MB is simply calculated by the quantization using first quantizer Q 8  having quantization number 8 (Q NO  8) which is the mid number of Q NO  15 and Q NO  0 and VLC table (look-up table) including VLC lengths. 
     If the bit number of the MB, calculated by first quantizer Q8, is smaller than or equal to the target length (VL8 (MB)≦target length), the MB has a more suitable quantization number Q NO . 
     Therefore, in the following step, the quantization number Q NO  exists between 15 and 8, the quantization is performed and the VLC length is calculated into a quantization number 12 being therebetween. 
     If the value obtained in the above process satisfies the relationship VL12 (MB)≦target length, the desired quantization number Q NO  exists between quantization numbers 15 and 12. However, if the relationship is not satisfied, the desired quantization number Q NO  exists between quantization numbers 12 and 8. 
     Therefore, in the final step, the quantization is performed and the VLC length is calculated with a more satisfiable quantization number Q NO  of Q 14  and Q 10  being between the above two ranges of the quantization number, to then the result to quantization number selector 125. 
     Quantization number selector 125 selects the quantization number Q NO  by the algorithm to be described below. 
     FIG. 17 is a graph showing the bit-rate variation depending on the change of the quantization numbers according to the second embodiment of the present invention, and FIG. 18 is a second flowchart showing a quantization number selecting method according to the second embodiment of the present invention. 
     As shown in FIG. 18, the quantization number selecting method according to the second embodiment of the present invention includes the steps of (1) comparing VL14 (MB) with a target bit-rate in order to estimate and calculate a mid or boundary value of the quantization number Q NO  (step 150), determining the quantization number Q NO  as 15 if VL14 (MB) is smaller than the target bit-rate (step 151), comparing VL2 (MB) with the target bit-rate if VL14 (MB) is larger than the target bit-rate (step 152), (2) adding the bit-rate of a first quantization number Q NO  (a) and the bit-rate of a second quantization number Q NO  (b) and if the target bit-rate is larger than VL2 (MB), dividing the added bit-rate by two, that is, {(a+b)/2=Y} (step 154), comparing the result (Y) with the target bit-rate (step 155), determining the quantization number Q NO  as Q+2 (step 157) if the target bit-rate is smaller than Y, determining the quantization number Q NO  as Q+1 (step 158) if the target bit-rate is larger than Y, and (3) multiplying the bit-rate of the first quantization number Q NO  (a) by three, subtracting the bit-rate of the second quantization number Q NO  (b) and then dividing by two, that is, {(3a-b)/2=Y&#39;}, if VL14 (MB) is smaller than the target bit-rate, (step 153), comparing the result (Y&#39;) with the target bit-rate (step 156), determining the quantization number Q NO  as 2 if the target bit-rate is larger than Y&#39;,(step 160), multiplying the bit-rate of the first quantization number Q NO  (a) by two and subtracting the bit-rate of the second quantization number Q NO  (b), that is, {(2a-b)/2=Y&#34;} (step 159), comparing the result (Y&#34;) with the target bit-rate (step 168), determining the quantization number Q NO  as 0 if the target bit-rate is larger than Y&#34;, (step 167), and determining the quantization number Q NO  as 1 if the target bit-rate is smaller than Y&#34;, (step 169). Here, the first quantization number Q NO  (a) is the bit-rate when QNO equals to Q, and the second quantization number Q NO  (b) is the bit-rate when QNO equals to Q+2, where Q=2, 4, . . . , 12, 14. 
     As described above, if the quantization number Q NO  is determined by quantization number selector 125, the quantization and VLC operation are performed with the quantization number Q NO  to generate a bit stream to then be transmitted to a formatter (not shown). 
     At this time, since the bit stream transmitted to the formatter is obtained in quantization number selector 125, the bit stream is not always smaller than the target rate. 
     In other words, in case of VLQ+1 (MB), since the bit stream is estimated by VLQ and VLQ+2, the formatter formats the coded data stream into a unit (U), as shown in FIG. 19. At this time, U.sub.(i+2)mod n,2,k partially includes all kinds of data of MB.sub.(i+2)mod n,2,k. Also, the compressed data of MB.sub.(i+6)mod n,1,k, MB.sub.(i+8)mod n,3,k, MB imod  n,0,k, and MB.sub.(i+4)mod n,4,k may be included. 
     Also, since U.sub.(i+6)mod n,1,k, U.sub.(i+8)mod n,3,k, U imod  n,0,k, and U.sub.(i+4)mod n,4,k have the same characteristics as above, five MBs are compressed with a fixed rate in the unit of a video segment (VS) to then be recorded. 
     Finally, the shuffled MBs for each VS are restored into their original position to then be recorded. 
     As described above, the quantization number selecting apparatus and method for a DVCR according to the present invention can simplify the hardware configuration of a quantizer by skipping calculation of a set of quantization numbers unnecessary for the next state with several delays, in determining the quantization number. The adaptive quantization number having the minimum quantization error can be efficiently designated using the errors generated during quantization process and coded bit length.