KR20040067239A - Method of bit allocation in quantizer, and apparatus thereof - Google Patents

Method of bit allocation in quantizer, and apparatus thereof Download PDF

Info

Publication number
KR20040067239A
KR20040067239A KR1020030004255A KR20030004255A KR20040067239A KR 20040067239 A KR20040067239 A KR 20040067239A KR 1020030004255 A KR1020030004255 A KR 1020030004255A KR 20030004255 A KR20030004255 A KR 20030004255A KR 20040067239 A KR20040067239 A KR 20040067239A
Authority
KR
South Korea
Prior art keywords
value
bits
quantization
zeros
dct coefficients
Prior art date
Application number
KR1020030004255A
Other languages
Korean (ko)
Inventor
장승기
장지밍
Original Assignee
삼성전자주식회사
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 삼성전자주식회사 filed Critical 삼성전자주식회사
Priority to KR1020030004255A priority Critical patent/KR20040067239A/en
Publication of KR20040067239A publication Critical patent/KR20040067239A/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • H04N19/137Motion inside a coding unit, e.g. average field, frame or block difference
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/625Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using discrete cosine transform [DCT]

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • Discrete Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

PURPOSE: A method for assigning bits used for performing quantization is provided to linearly approximate the number of assigned bits for quantization, in order to effectively carry out the quantization, thereby maintaining high accuracy even though a scene change is generated. CONSTITUTION: A system receives DCT coefficients for one macro block of one inputted image frame(S410). The system counts the number of '0' among the DCT coefficients within the inputted macro block, and calculates the ratio of the counted number of '0'(S420). The system decides whether the ratio of the counted number of '0' is calculated for all macro blocks of the one image frame(S430). If some macro blocks to be inputted remain, the system receives a next macro block, and receives all the macro blocks. If the calculation of the ratio of the counted number of '0' is completed, the system assigns predetermined bits by linearizing with the use of the calculated ratio of the counted number of '0' (S440).

Description

양자화 수행시에 사용되는 비트의 할당방법 및 장치{Method of bit allocation in quantizer, and apparatus thereof}Method and apparatus for allocating bits used when performing quantization {Method of bit allocation in quantizer, and apparatus}

본 발명은 비디오 코딩에 관한 것으로, 구체적으로는 엠펙과 같은 방법을 사용한 비디오 코딩에서 양자화 수행시에 할당되는 비트수를 조절하는 방법 및 장치에 관한 것이다.The present invention relates to video coding, and more particularly, to a method and apparatus for adjusting the number of bits allocated when performing quantization in video coding using a method such as MPEG.

엠펙(Moving Picture Expert Group : MPEG)에서 제안하고 있는 동영상 압축방법은 시간적 중복(temporal redundancy) 및 공간적 중복(spatial redundancy)을 제거하는 방법에 기반을 두고 있다. 즉, 이동보상 압축방법을 이용하여 시간적 중복을 제거하고, 정지화상에 DCT(Discrete Cosine Transform)를 적용하여 공간적 중복을 제거한다.The video compression method proposed by Moving Picture Expert Group (MPEG) is based on the method of eliminating temporal redundancy and spatial redundancy. That is, temporal redundancy is removed by using the moving compensation compression method, and spatial coherence is removed by applying DCT (Discrete Cosine Transform) to still images.

도 1은 엠펙(MPEG)의 동영상 압축과정을 도시한 도면이다.FIG. 1 is a diagram illustrating a video compression process of MPEG.

즉, 원본영상을 입력받아(S110), 전처리 과정을 수행한 후(S120) 주파수 영역(domain)으로의 변환을 수행한다(S130). 전처리 과정 수행 단계(S120)에서는 압축을 수행하기 위한 준비단계로 컬러 스페이스(color space) 변환, 필터링(filtering) 및 컬러 서브 샘플링(color subsampling) 등이 수행된다. 그리고, 변환 단계(S130)에서는 입력된 영상 데이터의 중복성을 제거하기 위해 여러 종류의 수학적인 변환방법을 사용하여 입력된 영상을 공간영역(spatial domain)에서 다른 영역으로 변환하는데, 엠펙에서는 주파수 영역으로 변환하고 이 변환과정에서 DCT가 사용된다.That is, after receiving the original image (S110), performing the preprocessing process (S120) and converting to the frequency domain (domain) (S130). In the preprocessing step S120, color space conversion, filtering, and color subsampling may be performed as a preparation step for performing compression. In the conversion step (S130), the input image is converted from a spatial domain to another region by using various types of mathematical transformation methods in order to remove redundancy of the input image data. DCT is used during this conversion.

DCT를 수행하면 DCT 계수(coefficient)가 생성되는데, 생성된 DCT 계수를 가지고 양자화(quantization)를 수행한다(S140). 그러면, 고주파 성분은 제거되고 저주파 성분만이 남게 되는데, 이렇게 남은 저주파 성분만을 코딩한다(S150). 따라서압축효율을 높일 수 있다. 그리고 생성된 코딩된 비트 스트림을 출력한다(S160). 변환 단계(S130)에서 DCT 는 매크로 블록(macro block) 단위로 수행된다. 8x8 크기의 매크로 블록에 대해서 DCT 가 수행되면 DCT 계수(coefficient)로 이루어진 행렬 A 가 생성된다. 이렇게 생성된 행렬 A 에는 저주파 성분과 고주파 성분이 함께 존재하는데, 일반적으로 중요한 데이터들은 주로 저주파 성분에 존재하므로 양자화 과정(S140)에서는 고주파 성분들을 주로 제거한다.When DCT is performed, DCT coefficients are generated, and quantization is performed using the generated DCT coefficients (S140). Then, the high frequency component is removed and only the low frequency component remains, so only the low frequency component is encoded (S150). Therefore, the compression efficiency can be improved. The generated coded bit stream is output (S160). In the converting step S130, the DCT is performed in macro block units. When DCT is performed on an 8 × 8 macroblock, a matrix A consisting of DCT coefficients is generated. In the matrix A generated as described above, low frequency components and high frequency components exist together. In general, important data are mainly located in low frequency components, and thus high frequency components are mainly removed in the quantization process S140.

코딩은 가변길이 부호화(Variable Length Coding : VLC)가 주로 사용된다. 가변길이 부호화(VLC)는 데이터의 출현 빈도에 따라 자주 나타나는 데이터는 적은 비트수로 표현하고 자주 나타나지 않은 데이터는 상대적으로 큰 비트수로 표현하여 전체적인 파일의 크기를 줄이는 방법이다. 이렇게 빈도수에 따른 처리방법으로 허프만(Huffman) 부호화 방법 등이 사용된다.As coding, variable length coding (VLC) is mainly used. Variable Length Coding (VLC) is a method of reducing the size of an entire file by representing data that appears frequently according to the frequency of appearance of data in a small number of bits and data that does not appear frequently in a relatively large number of bits. Huffman coding is used as the processing method according to the frequency.

객체기반 부호화(Object based coding) 방법인 MPEG-4 에서 가변 비트율(Variable Bit Rate : VBR) 서비스의 제공시에 고정된 양자화 비트를 사용하는 방법이 여전히 많이 사용되고 있다. 이렇게 고정된 양자화 비트를 사용할 때, 출력되는 비트 스트림의 데이터 양이 너무 심하게 변화하면 출력버퍼의 오버플로우(overflow)나 언더플로우(underflow) 현상이 일어날 가능성이 많아진다. 또한, 항등 비트율(Constant Bit Rate : CBR) 서비스에서는 양자화 비트를 유연하게 조정하여, 출력되는 데이터의 양이 입력된 영상의 종류에 관계없이 일정하도록 조절할 필요가 있는데, 이를 비트율 제어(Rate Control)라고 한다.In MPEG-4, which is an object based coding method, a method of using a fixed quantization bit in providing a variable bit rate (VBR) service is still widely used. When using this fixed quantization bit, if the amount of data in the output bit stream changes too much, there is a high possibility that an overflow or underflow of the output buffer occurs. In addition, in constant bit rate (CBR) service, it is necessary to flexibly adjust the quantization bit so that the amount of output data is constant regardless of the type of the input image. This is called rate control. do.

비트율 제어방법에는 출력되는 데이터의 양을 프레임 단위로 조절하는 프레임 기반의 비트율 제어방법과 출력되는 데이터의 양을 프레임 내의 각 매크로 블록단위로 조절하는 매크로 블록 기반의 비트율 제어 방법이 존재한다. 매크로 블록 기반의 비트율 제어방법이 더 정확하게 비트율을 제어할 수 있지만, 제어방법이 너무 복잡하고 어려우므로 프레임 기반의 비트율 제어방법이 일반적으로 많이 사용된다.The bit rate control method includes a frame-based bit rate control method for adjusting the amount of output data in units of frames and a macro block based bit rate control method for adjusting the amount of output data in units of macroblocks in a frame. Although the macroblock-based bitrate control method can more accurately control the bitrate, the frame-based bitrate control method is generally used because the control method is too complicated and difficult.

MPEG-4 VM18(Verification Model 18)에서의 프레임 기반 비트율 제어 알고리즘에서, Quadratic 전송율 왜곡(Rate Distortion : RD) 모델은 다음 수학식 1과 같이 표현된다.In the frame-based bit rate control algorithm in MPEG-4 VM18 (Verification Model 18), the Quadratic Rate Distortion (RD) model is expressed by Equation 1 below.

여기서 T 는 타겟 비트(target bits), 즉, 양자화시에 사용되는 비트의 수를 의미하고, MAD 는 입력 이미지와 움직임 보상되어(motion compensated) 재구성된 이미지간의 차의 절대치의 합을 의미한다. 또한 QP 는 양자화기(quantizer)를 나타내고, X1과 X2는 전송율 왜곡(RD) 모델링 파라미터로 각각의 입력 이미지 프레임에 대한 인코딩 과정이 수행된 후에 갱신되는 값들이다.Here, T means target bits, that is, the number of bits used in quantization, and MAD means the sum of the absolute values of the difference between the input image and the motion compensated reconstructed image. In addition, QP represents a quantizer, and X 1 and X 2 are rate distortion (RD) modeling parameters, which are values updated after an encoding process for each input image frame is performed.

도 2a는 수학식 1을 그래프로 표현한 도면이다.2A is a diagram illustrating Equation 1 as a graph.

도 2a를 참조하면 비선형적 특성을 나타냄을 알 수 있는데, 이렇게 비선형적 특성을 선형적으로 변경할 필요가 있고, 이러한 수학식 1이 스케일러블(scalable)하다고 하더라도, DCT 계수(coefficient)는 매 입력 프레임마다 갱신되어야 하므로비트율을 제어하기 위한 계산과정이 복잡하고, 특히 장면의 변화(scene change)가 존재할 때 상기 수학식 1을 양자화에 그대로 적용하는 경우에는 모델의 정확도가 떨어진다는 문제점이 있다.Referring to FIG. 2A, it can be seen that the nonlinear characteristic is shown. In this way, it is necessary to change the nonlinear characteristic linearly, and even though Equation 1 is scalable, the DCT coefficient is equal to every input frame. Since the calculation process for controlling the bit rate is complicated, especially when the equation 1 is applied to the quantization as it is when there is a scene change, the accuracy of the model is poor.

본 발명이 이루고자 하는 기술적 과제는, 엠펙 4와 같이 동영상 압축방법에서 사용되는 양자화 시에 할당되는 비트의 수를 선형적으로 근사화시켜서 효율적으로 양자화를 수행할 수 있는 양자화 수행시에 사용되는 비트의 할당방법 및 할당장치를 제공하는데 있다.The technical problem to be solved by the present invention is to allocate the bits used in the quantization to efficiently perform quantization by linearly approximating the number of bits allocated in the quantization used in the video compression method as in MPEG 4. To provide a method and an allocation device.

도 1은 엠펙(MPEG)의 동영상 압축과정을 도시한 도면이다.FIG. 1 is a diagram illustrating a video compression process of MPEG.

도 2a는 수학식 1을 그래프로 표현한 도면이다.2A is a diagram illustrating Equation 1 as a graph.

도 2b는 본 발명의 비트할당 방법을 사용한 경우의 특성 그래프이다.2B is a characteristic graph when the bit allocation method of the present invention is used.

도 3a 내지 도 3b는 양자화시 할당되는 비트를 결정하는데 사용되는 계수 ρ를 계산하는 과정을 설명하기 위한 도면이다.3A to 3B are diagrams for explaining a process of calculating a coefficient ρ used to determine bits allocated in quantization.

도 4는 상술한 본 발명의 비트할당 방법의 흐름도이다.4 is a flowchart of the bit allocation method of the present invention described above.

도 5는 상술한 본 발명의 비트할당 방법이 적용되는 비트할당 장치의 블록도이다.5 is a block diagram of a bit allocation apparatus to which the bit allocation method of the present invention described above is applied.

도 6은 본 발명의 비트할당 방법을 사용한 경우에 사용된 비트수와 실제 사용된 비트수와의 관계를 도시한 그래프이다.6 is a graph showing the relationship between the number of bits used and the number of bits actually used when the bit allocation method of the present invention is used.

도 7은 QCIF 크기의 "mobile" 이라는 제목의 이미지를 입력한 경우의 실험결과 그래프이다.7 is a graph of experimental results when an image titled "mobile" having a QCIF size is input.

상기의 과제를 이루기 위하여 본 발명에 의한 양자화 수행시에 사용되는 비트의 할당방법은, 매크로 블록에 대한 DCT 계수내에 존재하는 0의 갯수를 카운트하는 단계; 및 상기 카운트한 0의 갯수가 많으면 양자화시 할당할 비트의 수를 적게 하고, 상기 카운트한 0의 갯수가 적으면 양자화시 할당할 비트의 수를 많게 하는 단계를 구비한다.In order to achieve the above object, a bit allocation method used in performing quantization according to the present invention includes the steps of: counting the number of zeros present in a DCT coefficient for a macroblock; And reducing the number of bits to be allocated during quantization if the number of counted zeros is large, and increasing the number of bits to be allocated during quantization if the number of zeros counted is small.

상기의 과제를 이루기 위하여 본 발명에 의한 양자화 수행시에 사용되는 비트의 할당방법은, 매크로 블록에 대한 DCT 계수를 입력받는 단계; 상기 입력받은 매크로 블록내의 DCT 계수들 중에서 0의 갯수를 카운트하여 0의 갯수의 비율 ρ(i,j) 값을 계산하는 단계; 하나의 영상 프레임의 모든 매크로 블록에 대해서 ρ(i,j) 값이 계산되었는지 판단하는 단계; 및 상기 판단결과 아직 입력받을 매크로 블록이 남아 있으며 다음 매크로 블록을 입력받고, 모든 매크로 블록을 입력받은 경우에는 상기 ρ(i,j) 값을 이용하여 선형화시켜서 소정의 비트할당을 수행하는 단계를 구비한다.In order to achieve the above object, a bit allocation method used in performing quantization according to the present invention includes: receiving a DCT coefficient for a macro block; Counting the number of zeros among the DCT coefficients in the input macroblock and calculating a ratio p (i, j) of the number of zeros; Determining whether a value of ρ (i, j) is calculated for all macroblocks of one image frame; And if the macroblock to be input remains as a result of the determination and receives the next macroblock, and if all the macroblocks are received, performing a predetermined bit allocation by linearizing using the value of ρ (i, j). do.

상기의 과제를 이루기 위하여 본 발명에 의한 양자화 수행시에 사용되는 비트의 할당장치는, 하나의 영상 프레임의 하나의 매크로 블록에 대한 DCT 계수를 매크로 블록단위로 순차적으로 입력하는 영상 입력부; 상기 입력된 매크로 블록내의 DCT 계수의 0의 갯수를 카운트하는 계수부; 상기 계수부에서 카운트한 0의 갯수의 비율 ρ(i,j) 값을 계산하는 중간값 계산부; 및 상기 중간값 계산부에서 계산된 ρ(i,j) 값을 이용하여 선형화시켜서 양자화시 사용될 비트를 결정하는 할당비트 결정부를 구비한다.In order to achieve the above object, an apparatus for allocating bits used in quantization according to the present invention includes: an image input unit sequentially inputting DCT coefficients for one macro block of one image frame in macroblock units; A counting unit for counting a number of zeros of DCT coefficients in the input macro block; An intermediate value calculator for calculating a ratio p (i, j) of the number of zeros counted by the counter; And an allocation bit determiner configured to linearize using the value of ρ (i, j) calculated by the intermediate value calculator to determine a bit to be used for quantization.

상기한 과제를 이루기 위하여 본 발명에서는, 상기 방법을 컴퓨터에서 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체를 제공한다.In order to achieve the above object, the present invention provides a computer-readable recording medium recording a program for executing the method on a computer.

이하, 첨부된 도면을 참조하여 본 발명에 따른 바람직한 일실시예를 상세히 설명한다.Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings.

도 2b는 본 발명의 비트할당 방법을 사용한 경우의 특성 그래프이다.2B is a characteristic graph when the bit allocation method of the present invention is used.

상술한 수학식 1을 사용한 비트할당 방법을 사용하면 비선형적인 특성이 나오는데 비하여, 본 발명의 비트할당 방법을 사용하면 선형적인 특성이 나오는 것을 알 수 있다. 선형적인 특성이 나오는 것에 대해서는 후술하기로 한다.When the bit allocation method using Equation 1 described above is used, a nonlinear characteristic is obtained, whereas when the bit allocation method of the present invention is used, a linear characteristic is obtained. The linear characteristics will be described later.

비디오 스트림 S를 고정된 비트의 양자화기(constant quantizer) j 를 가진 MPEG-4 인코더로 인코딩 한다고 가정하고, 프레임 i 에 대한 인코딩된 비트 스트림을 T(i, j)라고 표현하자. 그리고 비디오 스트림 S가 고정된 비트의 양자화기 k 를가진 MPEG-4 인코더로 인코딩 된다고 하면, 프레임 i 에 대한 인코딩된 비트 스트림을 T(i, k)로 표현할 수 있다.Assume that video stream S is encoded with an MPEG-4 encoder with a fixed bit quantizer j, and express the encoded bit stream for frame i as T (i, j). If the video stream S is encoded by an MPEG-4 encoder having a fixed bit quantizer k, the encoded bit stream for the frame i may be represented by T (i, k).

그러면 인코딩된 비트 스트림 T(i, j)와 T(i, k)간에는 다음 수학식 2와 같은 선형적 관계가 존재한다.Then, there is a linear relationship between the encoded bit streams T (i, j) and T (i, k) as shown in Equation 2 below.

여기서 j, k 는 상술한 바와 같이 양자화기를 나타내고, T(i, j) 와 T(i, k)는 프레임 i 에 대한 인코딩된 비트 스트림을 나타내며, N은 입력된 비디오 스트림S 의 전체 프레임 수를 나타낸다.Where j and k denote quantizers as described above, T (i, j) and T (i, k) denote encoded bit streams for frame i, and N denotes the total number of frames of the input video stream S Indicates.

MPEG-4 비디오 압축시에 움직임 보상(Motion Compensation : MC)과 DCT가 수행된 후에 양자화가 수행된다. DCT 계수는 양자화기 j 에 의해서 얻어진다. 양자화된 계수는 각각의 매크로 블록 내에서 지그재그 스캔(zigzag scan)에 의해서 1차원 어레이(1-D array) L 로 재정렬된다.Quantization is performed after Motion Compensation (MC) and DCT are performed in MPEG-4 video compression. DCT coefficients are obtained by quantizer j. The quantized coefficients are rearranged into a 1-D array L by a zigzag scan in each macro block.

재정렬된 1차원 어레이 L 에서 두 개의 0이 아닌 계수들간의 각각의 연속적인 0에 대해서 run length 를 계수(count)한다. 예를 들어, 지그재그 스캔에 의해서 L 이 "5 8 0 4 0 0 0 8 0 0 ... 0 2 0 0 ... 0" 와 같이 구해졌다고 하면 0이 아닌 상수를 (기준점으로 앞에 있는 0의 길이, 0이 아닌 상수의 값)의 형태로 변경하면 "(0,5) (0,8) (1,4) (3,8) (15,0) (8,2) EOB" 와 같이 나타낼 수 있으므로 전체적인 데이터의 양이 줄어든다. 그리고 나서 모든 run length 의 크기(size)의 합을 계산하고 이 값을 Q'z라고 표현한다. 여기서 0이 아닌 수의 크기라는 것은 sign magnitude 로 표현하였을 때 비트의 수를 의미한다.Run length is counted for each successive zero between two nonzero coefficients in a reordered one-dimensional array L. For example, if a zigzag scan yields L as "5 8 0 4 0 0 0 8 0 0 ... 0 2 0 0 ... 0", then a non-zero constant (the Length, the value of a non-zero constant) This reduces the overall amount of data. Then we calculate the sum of the sizes of all run lengths and express this value as Q ' z . Here, the nonzero number size means the number of bits when expressed as sign magnitude.

예를 들어, +17을 이진수로 나타내면, "10000" 이므로 사인(sign) 비트 1비트와 크기(magnitude)를 나타내는 비트 5비트를 합하여 크기(size)를 6비트라고 할 수 있다. 이와 같이 모든 0이 아닌 계수의 크기(size)의 합을 계산할 수 있다.For example, if +17 is represented as a binary number, since it is "10000", the size may be referred to as 6 bits by adding 1 bit of a sign bit and 5 bits indicating a magnitude. In this way, the sum of the sizes of all nonzero coefficients can be calculated.

계산된 프레임의 크기를 M 이라고 하면, 프레임 i 에 대해서 다음과 같이 Qnz와 Qz를 정의할 수 있다. 그리고 ρ(i,j)를 프레임 i 에 있는 양자화된 DCT 계수들에서 0의 비율을 나타낸다.If the calculated frame size is M, then Q nz and Q z can be defined for frame i as follows. And p (i, j) represents the ratio of zero in the quantized DCT coefficients in frame i.

도 3a 내지 도 3b는 양자화시 할당되는 비트를 결정하는데 사용되는 계수 ρ를 계산하는 과정을 설명하기 위한 도면이다.3A to 3B are diagrams for explaining a process of calculating a coefficient ρ used to determine bits allocated in quantization.

도 3을 참조하여 ρ(i,j)를 계산하는 방법에 대하여 상세히 설명한다. 도 3a와 같이 QCIF(Quadrature Common Intermediated Format)의 영상이 입력되었다고 가정한다. QCIF 는 CIF 의 1/4 크기이므로 한 프레임에 존재하는 화소의 수는 176x144 이다. 첫번째 매크로블록1(310)에 대하여 DCT를 수행한 결과 도 3b와 같은 DCT 계수가 얻어졌다고 가정하면 첫번째 매크로 블록1(310)에 대한 ρ는 다음 수학식 4에 의해서 계산된다. 예를 들어 만일 A1에 존재하는 0의 갯수가 5 개라고 하면 5/(176x144)가 된다.A method of calculating ρ (i, j) will be described in detail with reference to FIG. 3. It is assumed that an image of a Quadrature Common Intermediated Format (QCIF) is input as shown in FIG. 3A. Since QCIF is 1/4 the size of CIF, the number of pixels in one frame is 176x144. Assuming that a DCT coefficient as shown in FIG. 3B is obtained as a result of performing DCT on the first macroblock 1 310, p for the first macroblock 1 310 is calculated by the following equation (4). For example, if the number of zeros in A 1 is five, then 5 / (176x144).

다음으로 매크로 블록2(320)에 대해서도 DCT를 수행하여 DCT 계수 A2가 얻어졌고, 만일 A2에 존재하는 DCT 계수중에서 0의 갯수가 10 개라면 (5+10)/(176x144)와 같이 계산된다. 이렇게 모든 매크로 블록에 대하여 DCT 계수중의 0의 갯수를 누적하여 계산한 결과가 ρ(i,j) 이다. 이렇게 얻어진 계수 ρ(i,j) 를 이용하여 양자화 비트수를 결정한다. 즉 ρ(i,j) 값이 작으면 양자화 수행시 할당하는 비트의 수를 늘리고, ρ(i,j) 값이 크면 양자화 수행시 할당하는 비트의 수를 줄인다.Calculated as in the following as the macro block 2 was carried out the DCT about 320 to obtain a DCT coefficient A 2, if the number of 0 to 10 among the DCT coefficients present in manil A 2 (5 + 10) / (176x144) do. Thus, the result of accumulating the number of zeros in the DCT coefficients for all macroblocks is ρ (i, j). The number of quantization bits is determined using the coefficient p (i, j) thus obtained. In other words, if the value of ρ (i, j) is small, the number of bits allocated for quantization is increased. If the value of ρ (i, j) is large, the number of bits allocated for quantization is reduced.

ρ(i,j) 값이 작다는 것은 DCT 계수들 중 0의 갯수가 적다는 것이므로 인코딩하여야 할 성분이 많다는 것을 의미하고, ρ(i,j) 값이 크다는 것은 DCT 계수들 중 0의 갯수가 많다는 것이므로 인코딩하여야 할 성분이 적다는 것을 의미하므로, 인코딩할 데이터량에 따라서 양자화시 사용되는 비트를 적응적으로 조절한다.The smaller the value of ρ (i, j) means that there are fewer zeros in the DCT coefficients, and the larger the value of ρ (i, j) means that the greater the number of zeros in the DCT coefficients. Since it means that there are few components to be encoded, the bits used in quantization are adaptively adjusted according to the amount of data to be encoded.

그리고, 이렇게 계산된 ρ(i,j) 값을 이용하여 θ(i, j)를 다음 수학식 5에 의해서 계산하고, 최종적으로 양자화기 j를 가지고 인코딩된 프레임 i 에 대한 최종할당 비트 T(i,j)를 수학식 6에 의해서 계산한다.Then, θ (i, j) is calculated by the following Equation 5 using the calculated value of ρ (i, j), and finally the final allocation bit T (i for the frame i encoded with the quantizer j , j) is calculated by the equation (6).

T(i, j) = k(i, j) * rho(i, j) + c(i, j)T (i, j) = k (i, j) * rho (i, j) + c (i, j)

이때 k(j, j)와 c(i, j)는 j 값의 범위에 따라서 수학식 7, 8 및 9와 같이 주어진다. 다시 말하면 1≤j≤5 인 경우에는 수학식 7이, 6≤j≤18 인 경우에는 수학식 8이, 19≤j≤31 인 경우에는 수학식 9가 적용되어 k(j, j)와 c(i, j)가 계산된다.Where k (j, j) and c (i, j) are given by Equations 7, 8 and 9 according to the range of j values. In other words, in the case of 1 ≦ j ≦ 5, equation 7 is applied, in the case of 6 ≦ j ≦ 18, equation 8 is applied, and in case of 19 ≦ j ≦ 31, equation 9 is applied to k (j, j) and c. (i, j) is calculated.

도 4는 상술한 본 발명의 비트할당 방법의 흐름도이다.4 is a flowchart of the bit allocation method of the present invention described above.

입력된 하나의 영상 프레임의 하나의 매크로 블록에 대한 DCT 계수를 입력받는다(S410). 그리고 나서 입력받은 매크로 블록내의 DCT 계수 중에서 0의 갯수를 카운트하여 ρ(i,j) 값을 계산한다(S420). ρ(i,j) 값은 상술한 수학식 4에 의해서 계산된다. 하나의 영상 프레임의 모든 매크로 블록에 대해서 ρ(i,j) 값이 계산되었는지 판단하여(S430), 아직 입력받을 매크로 블록이 남아 있으며 다음 매크로 블록을 입력받고, 모든 매크로 블록을 입력받아 ρ(i,j) 값의 계산이 완료되었으면, 계산된 ρ(i,j) 값을 이용하여 선형화시켜서 소정의 비트할당을 수행한다(S440). 이때 ρ(i,j) 값이 크면 비트할당을 적게 하고, ρ(i,j) 값이 작으면 비트할당을 많이 한다.In operation S410, a DCT coefficient of one macroblock of an input image frame is received. Then, the number of 0s in the DCT coefficients in the input macro block is counted to calculate the value of ρ (i, j) (S420). The value of ρ (i, j) is calculated by the above equation (4). It is determined whether the value of ρ (i, j) has been calculated for all the macroblocks of one image frame (S430), and there is still a macroblock to be input, the next macroblock is received, and all the macroblocks are received and the ρ (i , j) When the calculation of the value is completed, linearization is performed using the calculated value of ρ (i, j) to perform a predetermined bit allocation (S440). If the value of ρ (i, j) is large, the bit allocation is small. If the value of ρ (i, j) is small, the bit allocation is large.

도 4에서 설명한 비트할당 방법을 요약하면, 매크로 블록에 대한 DCT 계수내에 존재하는 0의 갯수를 카운트하고, 카운트한 0의 갯수가 많으면 양자화시 할당할 비트의 수를 적게 하고, 카운트한 0의 갯수가 적으면 양자화시 할당할 비트의 수를 많게 하는 것임을 알 수 있다.Summarizing the bit allocation method described in FIG. 4, the number of zeros present in the DCT coefficients for the macroblock is counted. If the number of counted zeros is large, the number of bits to be allocated during quantization is reduced, and the number of counted zeros is counted. It can be seen that less is to increase the number of bits to allocate during quantization.

도 5는 상술한 본 발명의 비트할당 방법이 적용되는 비트할당 장치의 블록도이다.5 is a block diagram of a bit allocation apparatus to which the bit allocation method of the present invention described above is applied.

영상 입력부(510)는 하나의 영상 프레임의 하나의 매크로 블록에 대한 DCT 계수를 매크로 블록단위로 순차적으로 입력받는다. 계수부(520)는 입력된 매크로 블록내의 DCT 계수의 0의 갯수를 카운트한다. 그리고 중간값 계산부(530)는 상술한 수학식 4를 이용하여 ρ(i,j) 값을 계산한다. 할당비트 결정부(540)는 중간값 계산부(530)에서 계산된 ρ(i,j) 값을 이용하여 선형화시켜서 양자화시 사용될 비트를 결정한다.The image input unit 510 sequentially receives DCT coefficients of one macro block of one image frame in macroblock units. The counting unit 520 counts the number of zeros of the DCT coefficients in the input macro block. The median value calculator 530 calculates a value of ρ (i, j) using Equation 4 described above. The allocation bit determiner 540 linearizes the value of ρ (i, j) calculated by the intermediate value calculator 530 to determine a bit to be used during quantization.

도 6은 본 발명의 비트할당 방법을 사용한 경우에 계산된 비트수와 실제 사용된 비트수와의 관계를 도시한 그래프이다.6 is a graph showing the relationship between the number of bits calculated when the bit allocation method of the present invention is used and the number of bits actually used.

실험에 사용된 이미지는 QCIF 크기의 100 프레임의 "foreman"이라는 제목의 이미지이다. 도 6을 참조하면 본 발명의 비트할당 방법을 사용한 경우의 비트수와실제 사용된 비트수와 거의 일치하는 것을 알 수 있다. 도 6에서 о로 표시한 것은 실제 사용된 비트 수를 나타내고, * 로 표신한 것은 본 발명의 비트할당 방법을 사용한 경우의 계산된 비트 수를 나타낸다.The image used in the experiment is an image titled "foreman" of 100 frames of QCIF size. Referring to FIG. 6, it can be seen that the number of bits in the case of using the bit allocation method of the present invention is almost identical to the number of bits actually used. 6 denotes the number of bits actually used, and denoted by * denotes the calculated number of bits when the bit allocation method of the present invention is used.

도 7은 QCIF 크기의 "mobile" 이라는 제목의 이미지를 입력한 경우의 실험결과 그래프이다. 도 7을 참조하면, 다른 테스트 이미지를 입력하여 실험한 경우에도 비슷한 결과를 얻을 수 있음을 알 수 있다.7 is a graph of experimental results when an image titled "mobile" having a QCIF size is input. Referring to FIG. 7, it can be seen that similar results can be obtained when an experiment is performed by inputting another test image.

본 발명은 또한 컴퓨터로 읽을 수 있는 기록매체에 컴퓨터가 읽을 수 있는 코드로서 구현하는 것이 가능하다. 컴퓨터가 읽을 수 있는 기록매체는 컴퓨터 시스템에 의하여 읽혀질 수 있는 데이터가 저장되는 모든 종류의 기록장치를 포함한다. 컴퓨터가 읽을 수 있는 기록매체의 예로는 ROM, RAM, CD-ROM, 자기 테이프, 플로피디스크, 광 데이터 저장장치 등이 있으며, 또한 캐리어 웨이브(예를 들어 인터넷을 통한 전송)의 형태로 구현되는 것도 포함한다. 또한 컴퓨터가 읽을 수 있는 기록매체는 네트워크로 연결된 컴퓨터 시스템에 분산되어, 분산방식으로 컴퓨터가 읽을 수 있는 코드가 저장되고 실행될 수 있다.The invention can also be embodied as computer readable code on a computer readable recording medium. The computer-readable recording medium includes all kinds of recording devices in which data that can be read by a computer system is stored. Examples of computer-readable recording media include ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage, and the like, and may also be implemented in the form of a carrier wave (for example, transmission over the Internet). Include. The computer readable recording medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed fashion.

이제까지 본 발명에 대하여 그 바람직한 실시예들을 중심으로 살펴보았다. 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자는 본 발명이 본 발명의 본질적인 특성에서 벗어나지 않는 범위에서 변형된 형태로 구현될 수 있음을 이해할 수 있을 것이다. 그러므로 개시된 실시예들은 한정적인 관점이 아니라 설명적인 관점에서 고려되어야 한다. 본 발명의 범위는 전술한 설명이 아니라 특허청구범위에 나타나 있으며, 그와 동등한 범위 내에 있는 모든 차이점은 본 발명에 포함된 것으로 해석되어야 할 것이다.So far I looked at the center of the preferred embodiment for the present invention. Those skilled in the art will appreciate that the present invention can be implemented in a modified form without departing from the essential features of the present invention. Therefore, the disclosed embodiments should be considered in descriptive sense only and not for purposes of limitation. The scope of the present invention is shown in the claims rather than the foregoing description, and all differences within the scope will be construed as being included in the present invention.

상술한 바와 같이 본 발명은 오브젝트들간의 선형 관계가 주어지므로 계산이 간단하고, 장면의 변화가 발생하더라도 높은 정확도를 유지할 수 있는 효과가 있다.As described above, since the linear relationship between the objects is given, the calculation is simple, and even when a change in the scene occurs, high accuracy can be maintained.

Claims (11)

(a) 매크로 블록에 대한 DCT 계수내에 존재하는 0의 갯수를 카운트하는 단계; 및(a) counting the number of zeros present in the DCT coefficients for the macro block; And (b) 상기 카운트한 0의 갯수가 많으면 양자화시 할당될 비트의 수를 적게 하고, 상기 카운트한 0의 갯수가 적으면 양자화시 할당될 비트의 수를 많게 하는 단계를 포함하는 것을 특징으로 하는 양자화 수행시에 사용되는 비트의 할당방법.(b) if the number of counted zeros is large, reducing the number of bits to be allocated in quantization, and if the number of counted zeros is small, increasing the number of bits to be allocated in quantization. Bit allocation method used in execution. 제1항에 있어서, 상기 양자화의 수행은The method of claim 1, wherein performing quantization is performed. 엠펙-2 또는 엠펙-4에서 사용되는 것을 특징으로 하는 양자화 수행시에 사용되는 비트의 할당방법.A method of allocating bits used in performing quantization, characterized in that used in MPEG-2 or MPEG-4. (a) 매크로 블록에 대한 DCT 계수를 입력받는 단계;(a) receiving a DCT coefficient for the macro block; (b) 상기 입력받은 매크로 블록내의 DCT 계수들 중에서 0의 갯수를 카운트하여 0의 갯수의 비율 ρ(i,j) 값을 계산하는 단계;(b) counting the number of zeros among DCT coefficients in the input macroblock and calculating a ratio ρ (i, j) value of the number of zeros; (c) 하나의 영상 프레임의 모든 매크로 블록에 대해서 상기 ρ(i,j) 값이 계산되었는지 판단하는 단계; 및(c) determining whether the value of ρ (i, j) is calculated for all macroblocks of one image frame; And (d) 상기 판단결과 아직 입력받을 매크로 블록이 남아 있으며 다음 매크로 블록을 입력받고, 모든 매크로 블록을 입력받은 경우에는 상기 ρ(i,j) 값을 이용하여 소정의 비트할당을 수행하는 단계를 포함하는 것을 특징으로 하는 양자화 수행시에 사용되는 비트의 할당방법.(d) if the macroblock to be input remains as a result of the determination and receives the next macroblock, and if all macroblocks are received, performing a predetermined bit allocation using the value of ρ (i, j). And a bit allocation method used for performing quantization. 제3항에 있어서,The method of claim 3, 상기 ρ(i,j) 값은 다음의 수학식에 의해서 계산되는 것을 특징으로 하는 양자화 수행시에 사용되는 비트의 할당방법.And the value of ρ (i, j) is calculated by the following equation. 여기서 Nzero(A)는 하나의 매크로 블록내에서 DCT 계수값이 0인 경우의 갯수, N(A)은 상기 하나의 영상 프레임내의 DCT 계수의 전체 갯수이다.Here, N zero (A) is the number of cases where the DCT coefficient value is 0 in one macroblock, and N (A) is the total number of DCT coefficients in the one image frame. 제3항에 있어서, 상기 (d) 단계는The method of claim 3, wherein step (d) 상기 ρ(i,j) 값이 크면 할당되는 비트수를 적게 하고, 상기 ρ(i,j) 값이 작으면 할당되는 비트수를 많게 하는 것을 특징으로 하는 양자화 수행시에 사용되는 비트의 할당방법.If the value of ρ (i, j) is large, the number of bits allocated is small. If the value of ρ (i, j) is small, the number of bits allocated is large. . 제3항에 있어서, 상기 양자화의 수행은4. The method of claim 3, wherein performing quantization is 엠펙-2 또는 엠펙-4에서 사용되는 것을 특징으로 하는 양자화 수행시에 사용되는 비트의 할당방법.A method of allocating bits used in performing quantization, characterized in that used in MPEG-2 or MPEG-4. 하나의 영상 프레임의 하나의 매크로 블록에 대한 DCT 계수를 매크로 블록단위로 순차적으로 입력하는 영상 입력부;An image input unit configured to sequentially input DCT coefficients of one macro block of one image frame in macroblock units; 상기 입력된 매크로 블록내의 DCT 계수의 0의 갯수를 카운트하는 계수부;A counting unit for counting a number of zeros of DCT coefficients in the input macro block; 상기 계수부에서 카운트한 0의 갯수의 비율 ρ(i,j) 값을 계산하는 중간값 계산부; 및An intermediate value calculator for calculating a ratio p (i, j) of the number of zeros counted by the counter; And 상기 중간값 계산부에서 계산된 ρ(i,j) 값을 이용하여 선형화시켜서 양자화시 사용될 비트를 결정하는 할당비트 결정부를 포함하는 것을 특징으로 하는 양자화 수행시에 사용되는 비트의 할당장치.And an allocating bit determining unit for linearizing using a value of ρ (i, j) calculated by the intermediate value calculating unit to determine bits to be used for quantization. 제7항에 있어서,The method of claim 7, wherein 상기 ρ(i,j) 값은 다음의 수학식에 의해서 계산되는 것을 특징으로 하는 양자화 수행시에 사용되는 비트의 할당장치.And the value of ρ (i, j) is calculated by the following equation. 여기서 Nzero(A)는 하나의 매크로 블록내에서 DCT 계수값이 0인 경우의 갯수, N(A)은 상기 하나의 영상 프레임내의 DCT 계수의 전체 갯수이다.Here, N zero (A) is the number of cases where the DCT coefficient value is 0 in one macroblock, and N (A) is the total number of DCT coefficients in the one image frame. 제7항에 있어서, 상기 할당비트 결정부는The method of claim 7, wherein the allocation bit determining unit 상기 ρ(i,j) 값이 크면 할당되는 비트수를 적게 하고, 상기 ρ(i,j) 값이 작으면 할당되는 비트수를 많게 하는 것을 특징으로 하는 양자화 수행시에 사용되는 비트의 할당장치.If the value of ρ (i, j) is large, the number of bits allocated is small. If the value of ρ (i, j) is small, the number of bits allocated is large. . 제7항에 있어서, 상기 양자화의 수행은8. The method of claim 7, wherein performing quantization is 엠펙-2 또는 엠펙-4에서 사용되는 것을 특징으로 하는 양자화 수행시에 사용되는 비트의 할당장치.An apparatus for allocating bits for use in performing quantization, characterized in that used in MPEG-2 or MPEG-4. 제1항 내지 제6항 중 어느 한 항에 기재된 방법을 컴퓨터에서 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체.A computer-readable recording medium having recorded thereon a program for executing the method according to any one of claims 1 to 6.
KR1020030004255A 2003-01-22 2003-01-22 Method of bit allocation in quantizer, and apparatus thereof KR20040067239A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020030004255A KR20040067239A (en) 2003-01-22 2003-01-22 Method of bit allocation in quantizer, and apparatus thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020030004255A KR20040067239A (en) 2003-01-22 2003-01-22 Method of bit allocation in quantizer, and apparatus thereof

Publications (1)

Publication Number Publication Date
KR20040067239A true KR20040067239A (en) 2004-07-30

Family

ID=37356798

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020030004255A KR20040067239A (en) 2003-01-22 2003-01-22 Method of bit allocation in quantizer, and apparatus thereof

Country Status (1)

Country Link
KR (1) KR20040067239A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100793781B1 (en) * 2005-01-14 2008-01-11 엘지전자 주식회사 Apparatus and method for encoding of real-time moving image

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100793781B1 (en) * 2005-01-14 2008-01-11 엘지전자 주식회사 Apparatus and method for encoding of real-time moving image

Similar Documents

Publication Publication Date Title
US8509556B2 (en) Image coding apparatus and image coding method to generate a targeted amount of code
KR100604702B1 (en) Apparatus for encoding an image sequence and method for generating a quantizer scale to quantize an image signals
US7653129B2 (en) Method and apparatus for providing intra coding frame bit budget
JP4256574B2 (en) Image signal encoding method and image signal encoding apparatus
US7206453B2 (en) Dynamic filtering for lossy compression
KR100756596B1 (en) Video data encoder and video data encoding method
KR100335080B1 (en) Method for treating non-zero quantized transform coefficients as zeros during video compression processing
EP1445958A1 (en) Quantization method and system, for instance for video MPEG applications, and computer program product therefor
US5933532A (en) Video data compression apparatus and method of same
KR100846769B1 (en) Method for encoding motion image having fixed computational complexity and apparatus thereof
US11356672B2 (en) System and method for controlling video coding at frame level
JP2006211152A (en) Device and method for coding image and decoding image, and programs for coding and decoding image
WO2010041488A1 (en) Dynamic image encoding device
US11134250B2 (en) System and method for controlling video coding within image frame
JP2002209215A (en) Code quantity control device and method, and image information conversion device and method
JP3846424B2 (en) Image signal quantization apparatus and method
JP5345797B2 (en) Video signal conversion method and apparatus
JPH10108184A (en) Image data processing unit and its method
JPH07203430A (en) Image coding device
JP3858520B2 (en) Video encoding apparatus and method
KR20040067239A (en) Method of bit allocation in quantizer, and apparatus thereof
JP3765129B2 (en) Encoding apparatus and encoding method
JP3765130B2 (en) Encoding apparatus and encoding method
JP4007398B2 (en) Quantization control apparatus and method
JP4127006B2 (en) Image signal encoding apparatus and encoding method

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E601 Decision to refuse application