KR100194205B1 - Improved Hoffman decoding method, decoding time table and its creation method - Google Patents

Improved Hoffman decoding method, decoding time table and its creation method Download PDF

Info

Publication number
KR100194205B1
KR100194205B1 KR1019960054475A KR19960054475A KR100194205B1 KR 100194205 B1 KR100194205 B1 KR 100194205B1 KR 1019960054475 A KR1019960054475 A KR 1019960054475A KR 19960054475 A KR19960054475 A KR 19960054475A KR 100194205 B1 KR100194205 B1 KR 100194205B1
Authority
KR
South Korea
Prior art keywords
item
class
decoding
bit
hoffman
Prior art date
Application number
KR1019960054475A
Other languages
Korean (ko)
Other versions
KR19980036005A (en
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 KR1019960054475A priority Critical patent/KR100194205B1/en
Publication of KR19980036005A publication Critical patent/KR19980036005A/en
Application granted granted Critical
Publication of KR100194205B1 publication Critical patent/KR100194205B1/en

Links

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

본 발명은 호프만 코드의 개선된 디코딩방법에 관한 것으로서, 특히 호프만 코딩된 비트스트림으로부터 L비트의 인덱스 비트를 취하는 단계; 디코딩 타임테이블의 루트서브테이블을 리드하는 단계; 리드된 서브 테이블을 참조하여 상기 취해진 인덱스 비트와 동일한 인덱스정보를 가진 아이템을 서치하는 단계; 서치된 아이템의 속성정보에 의해 아이템의 클래스를 판단하는 단계; 상기 판단에 의해 A 클래스로 판단되면 아이템의 값을 단일의 1비트 호프만 코드워드의 디코딩값으로 출력하는 단계; 상기 판단에 의해 C 클래스로 판단되면 아이템의 값을 연속되는 복수의 1비트 호프만 코드워드들의 디코딩값들로 동시에 출력하는 단계; 상기 판단에 의해 B 클래스로 판단되면 아이템의 속성정보에 의해 상기 비트스트림으로부터 새로운 인덱스 비트를 리드하는 단계; 상기 B 클래스 아이템의 값에 대응하는 서브 테이블을 리드하고 상기 아이템 서치단계로 복귀하는 단계; 및 상기 A 및 C 클래스의 디코딩값 출력후에 상기 속성정보에 의해 인덱스 비트들을 상기 L이하의 소정 비트수 만큼 시프팅시켜서 다음 아이템 서치를 위한 L비트의 인덱스 비트를 형성한 다음에 상기 아이템 서치단계로 복귀하는 단계를 구비하는 것을 특징으로 한다.The present invention relates to an improved decoding method of a Hoffman code, particularly comprising taking L bits of index bits from a Hoffman coded bitstream; Reading the root subtable of the decoding timetable; Searching for an item having the same index information as the taken index bit with reference to the read sub table; Determining the class of the item based on the attribute information of the searched item; Outputting the value of the item as a decoded value of a single 1-bit Hoffman codeword when determined to be Class A by the determination; Simultaneously outputting a value of an item as decoding values of a plurality of consecutive 1-bit Huffman codewords when determined to be a C class by the determination; Reading a new index bit from the bitstream according to the attribute information of the item if it is determined that the class is B by the determination; Reading a sub table corresponding to the value of the class B item and returning to the item search step; And outputting the decoded values of the A and C classes, shifting the index bits by the predetermined number of bits below the L by the attribute information to form the L bits index bits for the next item search, and then proceeding to the item search step. And returning.

Description

개선된 호프만 디코딩방법, 디코딩 타임 테이블 및 그 테이블 작성방법Improved Hoffman decoding method, decoding time table and its creation method

본 발명은 호프만 코드 디코딩 방법에 관한 것으로서, 특히 소프트웨어적으로 실행시 메모리 측면에서 효율적이고, 고속으로 디코딩을 수행할 수 있는 개선된 호프만 디코딩방법, 디코딩 타임 테이블 및 그 테이블 작성방법에 관한 것이다.The present invention relates to a Hoffman code decoding method, and more particularly, to an improved Hoffman decoding method, a decoding time table, and a method for creating the table, which are efficient in terms of memory when executed in software and can perform decoding at high speed.

데이터의 효율적인 부호화를 위하여 발생되는 코드의 발생빈도, 즉 발생확률에 의해 확률이 높은 코드부터 적은 비트수를 할당함으로써 부호화 효율을 높일 수 있는 호프만 코드는 여러 분야에서 널리 사용되고 있다.Huffman codes that can increase coding efficiency by allocating a small number of bits from a code having a high probability according to a frequency of occurrence, that is, a probability of occurrence, are widely used in various fields.

이러한 호프만 코드의 디코딩방법에는 통상적으로 트리 서치(tree searching)방식과 테이블 룩업(table look-up)방식의 두 종류가 있다. 트리 서치방식은 호프만 트리가 메모리에 저장되며, 디코더는 단계적으로 트리의 루트로부터 리프(Leaf)에 도달할 때까지 탐색한다. 이러한 방법은 메모리의 용량면에서는 효과적이나 디코딩속도가 매우 느리다는 단점이 있다.There are two types of decoding methods of the Hoffman code, a tree searching method and a table look-up method. In tree search, the Hoffman tree is stored in memory, and the decoder searches step by step from the root of the tree until it reaches a leaf. This method is effective in terms of memory capacity, but has a disadvantage in that the decoding speed is very slow.

또한, 테이블 룩업방식은 임의의 코드워드가 한 번의 검색으로 디코드될 수 있도록 큰 테이블이 메모리에 저장된다. 그러나 테이블 룩업방식은 테이블 사이즈가 매우 크게 되므로 메모리의 기억장소를 많이 차지하는 단점을 가진다.In addition, the table lookup method stores a large table in memory so that any codeword can be decoded in one search. However, the table lookup method has a disadvantage of occupying a lot of memory because the table size becomes very large.

많은 알고리즘들이 고속 호프만 디코딩 실행을 위하여 제안되고 있다. 그러나, 대부분은 소프트웨어 실행이 적당하지 않고 호프만 테이블이 고정되지 않은 응용분야에서는 더욱 부적당하다.Many algorithms have been proposed for fast Hoffman decoding execution. However, most are more inappropriate for applications where software execution is not adequate and Hoffman tables are not fixed.

1993년에, 새로운 호프만 디코딩 알고리즘이 하드웨어 실행을 위하여 제창되었으나, 그것은 트리 서치방식과 유사하며, 한 번의 서치에 한 비트를 시프트하지 않고, 한 번의 서치에 여러 비트씩, 즉 4비트씩 시프트한다는 차이점이 있다.In 1993, a new Hoffman decoding algorithm was proposed for hardware execution, but it is similar to the tree search method, except that it does not shift one bit in one search, but shifts several bits in one search, that is, four bits. There is this.

그러나, 이 알고리즘의 문제점은However, the problem with this algorithm

1. 자동적인 테이블작성방법이 제공되지 않으므로 소프트웨어실행에 사용할 수 없음.1. It cannot be used to run the software because no automatic table creation method is provided.

2.때때로 충분히 고속이지 않고 개선이 요구된다.2. Sometimes it is not fast enough and improvement is needed.

본 발명의 목적은 이와 같은 종래 기술의 문제점을 해결하기 위하여 소프트웨어 실행시에 메모리 효율성이 뛰어나고 고속 디코딩이 가능한 개선된 호프만 코드 디코딩방법을 제공하는 데 있다.SUMMARY OF THE INVENTION An object of the present invention is to provide an improved Hoffman code decoding method capable of high-speed decoding and excellent memory efficiency in software execution in order to solve the problems of the prior art.

본 발명의 다른 목적은 개선된 디코딩 타임 테이블을 제공하는 데 있다.Another object of the present invention is to provide an improved decoding time table.

본 발명의 또 다른 목적은 개선된 디코딩 타임 테이블을 작성하는 방법을 제공하는 데 있다.It is still another object of the present invention to provide a method for creating an improved decoding time table.

상기 목적을 달성하기 위하여 본 발명의 디코딩 방법은 호프만 코드의 멀티-비트 서치방식을 사용한 디코딩방법에 있어서, 호프만 코딩된 비트스트림으로부터 L비트의 인덱스 비트를 취하는 단계; 디코딩 타임테이블의 루트서브테이블을 리드하는 단계; 리드된 서브 테이블을 참조하여 상기 취해진 인덱스 비트와 동일한 인덱스정보를 가진 아이템을 서치하는 단계; 서치된 아이템의 속성정보에 의해 아이템의 클래스를 판단하는 단계; 상기 판단에 의해 A 클래스로 판단되면 아이템의 값을 단일의 1비트 호프만 코드워드의 디코딩값으로 출력하는 단계; 상기 판단에 의해 C 클래스로 판단되면 아이템의 값을 연속되는 복수의 1비트 호프만 코드워드들의 디코딩값들로 동시에 출력하는 단계; 상기 판단에 의해 B 클래스로 판단되면 아이템의 속성정보에 의해 상기 비트스트림으로부터 새로운 인덱스 비트를 리드하는 단계; 상기 B클래스 아이템의 값에 대응하는 서브 테이블을 리드하고 상기 아이템 서치단계로 복귀하는 단계; 및 상기 A 및 C 클래스의 디코딩값 출력후에 상기 속성정보에 의해 인덱스 비트들을 상기 L이하의 소정 비트수 만큼 시프팅시켜서 다음 아이템 서치를 위한 L비트의 인덱스 비트를 형성한 다음에 상기 아아이템 서치단계로 복귀하는 단계를 구비하는 것을 특징으로 한다.In order to achieve the above object, the decoding method of the present invention provides a decoding method using a multi-bit search method of Hoffman code, comprising: taking L bits of an index bit from a Hoffman coded bitstream; Reading the root subtable of the decoding timetable; Searching for an item having the same index information as the taken index bit with reference to the read sub table; Determining the class of the item based on the attribute information of the searched item; Outputting the value of the item as a decoded value of a single 1-bit Hoffman codeword when determined to be Class A by the determination; Simultaneously outputting a value of an item as decoding values of a plurality of consecutive 1-bit Huffman codewords when determined to be a C class by the determination; Reading a new index bit from the bitstream according to the attribute information of the item if it is determined that the class is B by the determination; Reading a sub table corresponding to a value of the class B item and returning to the item search step; And after outputting the decoding values of the A and C classes, shifting the index bits by the predetermined number of bits below the L by the attribute information to form the L bits index bits for the next item search, and then the item searching step. It characterized in that it comprises the step of returning to.

또한, 본 발명의 디코딩 방법은 호프만 코드의 멀티-비트 서치방식을 사용한 디코딩방법에 있어서, 호프만 코딩된 비트스트림으로부터 L비트의 인덱스 비트를 취하는 단계; 디코딩 타임테이블의 루트서브테이블을 리드하는 단계; 리드된 서브 테이블을 참조하여 상기 취해진 인덱스 비트와 동일한 인덱스정보를 가진 아이템을 서치하는 단계; 서치된 아이템의 속성정보에 의해 아이템의 클래스를 판단하는 단계; 상기 판단에 의해 A 클래스로 판단되면 아이템의 값을 단일의 1비트 호프만 코드워드의 디코딩값으로 출력하는 단계; 상기 판단에 의해 C 클래스로 판단되면 아이템의 값을 연속되는 복수의 1비트 호프만 코드워드들의 디코딩값들로 동시에 출력하는 단계; 상기 판단에 의해 B 클래스로 판단되면 아이템의 속성정보에 의해 상기 비트스트림으로부터 새로운 인덱스 비트를 리드하는 단계; 상기 판단에 의해 D 클래스로 판단되면 호프만 코드 테이블 상에 정의 되지 않은 코드로 인식하여 예외적인 조작을 수행하는 단계; 상기 B클래스 아이템의 값에 대응하는 서브 테이블을 리드하고 상기 아이템 서치단계로 복귀하는 단계; 및 상기 A 및 C 클래스의 디코딩값 출력후에 상기 속성정보에 의해 인덱스 비트들을 상기 L이하의 소정 비트수 만큼 시프팅시켜서 다음 아이템 서치를 위한 L비트의 인덱스 비트를 형성한 다음에 상기 아아이템 서치단계로 복귀하는 단계를 구비하는 것을 특징으로 한다.In addition, the decoding method of the present invention is a decoding method using a multi-bit search method of Hoffman code, comprising: taking L bits of an index bit from a Hoffman coded bitstream; Reading the root subtable of the decoding timetable; Searching for an item having the same index information as the taken index bit with reference to the read sub table; Determining the class of the item based on the attribute information of the searched item; Outputting the value of the item as a decoded value of a single 1-bit Hoffman codeword when determined to be Class A by the determination; Simultaneously outputting a value of an item as decoding values of a plurality of consecutive 1-bit Huffman codewords when determined to be a C class by the determination; Reading a new index bit from the bitstream according to the attribute information of the item if it is determined that the class is B by the determination; Recognizing a code not defined on the Hoffman code table and performing an exceptional operation if it is determined that the class is D; Reading a sub table corresponding to a value of the class B item and returning to the item search step; And after outputting the decoding values of the A and C classes, shifting the index bits by the predetermined number of bits below the L by the attribute information to form the L bits index bits for the next item search, and then the item searching step. It characterized in that it comprises the step of returning to.

상기 다른 목적을 달성하기 위한 본 발명의 개선된 디코딩 타임 테이블은 호프만 코드의 멀티-비트 서치방식에 의한 디코딩시에 사용하는 디코딩타임테이블에 있어서, 상기 디코딩 타임 테이블은 소정 비트수 이하의 복수의 호프만 코드들로 이루어진 코드필드; 상기 복수의 코드들의 배열순서를 표시하는 인덱스필드; 상기 각 호프만 코드들을 분류하는 클래스, 연속되는 동일 코드워드의 수, 서치를 위한 인덱스 비트들의 시프팅 횟수 또는 읽어들일 인덱스 비트수 등의 속성정보를 가지는 속성필드; 상기 각 호프만 코드들에 대응하는 디코딩 값들로 이루어진 값필드를 구비한 것을 특징으로 한다.An improved decoding time table of the present invention for achieving the above another object is a decoding time table for use in decoding by a multi-bit search method of a Hoffman code, wherein the decoding time table includes a plurality of Huffmans having a predetermined number of bits or less. A code field consisting of codes; An index field indicating an arrangement order of the plurality of codes; An attribute field having attribute information such as a class for classifying the Hoffman codes, the number of consecutive identical codewords, the number of shifts of index bits for search, or the number of index bits to be read; And a value field composed of decoding values corresponding to the respective Hoffman codes.

상기 또 다른 목적을 달성하기 위한 테이블 작성방법은 호프만 코드의 멀티-비트 서치방식에서 개선된 디코딩타임테이블을 작성하는 방법에 있어서, 원래의 호프만 테이블을 저장하기 위한 제 1 글로벌 데이터와, 디코딩 타임테이블을 저장하기 위한 제 2 글로벌 데이터를 정의하는 단계; 작성중인 서브 테이블의 레벨을 표시하는 레벨변수와 상기 호프만 코드 테이블에 등록된 코드워드의 수를 나타내는 엔트리변수를 정의 하는 단계; 상기 호프만 코드 테이블을 참조하면서 주어진 테이블 사이즈에 따라 루트 서브 테이블을 작성하는 단계; 작성된 루트서브테이블을 체크하여 어떤 서브 테이블의 확장이 필요한가를 판단하는 단계; 서브테이블의 확장이 필요하면 서브 테이블의 베이스 어드레스를 할당하고 상기 서브 테이블 작성 단계와 판단 단계를 반복적으로 수행하여 서브 테이블을 작성하는 단계; 및 상기 판단단계에서 확장이 필요없다면 리턴하는 단계를 구비하는 것을 특징으로 한다.According to another aspect of the present invention, there is provided a method of creating a decoded time table in the multi-bit search method of a Hoffman code, comprising: first global data for storing an original Hoffman table and a decoding timetable. Defining second global data for storing data; Defining a level variable indicating a level of a sub table being created and an entry variable indicating a number of codewords registered in the Hoffman code table; Creating a root subtable according to a given table size while referring to the Hoffman code table; Checking the created root subtable to determine which subtable needs to be expanded; Creating a subtable by allocating a base address of the subtable and repeatedly performing the subtable creating step and the determining step when the subtable needs to be expanded; And returning if no expansion is necessary in the determining step.

도 1은 원래의 호프만 코드 테이블의 일에를 나타낸 표.1 is a table showing one of the original Hoffman code tables.

도 2는 종래의 멀티비트서치방식의 디코딩 타임 테이블의 루트 서브 테이블의 일예를 나타낸 표.2 is a table showing an example of a root sub table of a decoding time table of a conventional multi-bit search method.

도 3은 종래의 멀티비트서치방식의 디코딩 타임 테이블의 서브 테이블의 일예를 나타낸 표.3 is a table showing an example of a sub table of a decoding time table of a conventional multi-bit search method.

도 4는 본 발명에 의한 개선된 멀티비트서치방식의 디코딩 타임 테이블의 루트 서브 테이블의 일예를 나타낸 표.4 is a table showing an example of the root sub table of the decoding time table of the improved multi-bit search method according to the present invention.

도 5는 본 발명에 의한 서브 테이블의 아이템의 클래스를 설명하기 위한 도면.5 is a diagram for explaining a class of an item of a sub table according to the present invention;

도 6은 본 발명에 의한 개선된 호프만 디코딩 방법을 설명하기위한 플로챠트.6 is a flowchart for explaining an improved Hoffman decoding method according to the present invention.

도 7은 본 발명에 의한 개선된 디코딩 테이블의 작성방법을 설명하기 위한 플로챠트.7 is a flowchart for explaining a method of creating an improved decoding table according to the present invention.

이하, 첨부한 도면을 참조하여 본 발명을 보다 상세하게 설명하고자 한다.Hereinafter, with reference to the accompanying drawings will be described in more detail the present invention.

먼저, 본 발명의 이해를 돕기 위하여 종래의 멀티비트서치방식을 설명하기로 한다.First, the conventional multi-bit search method will be described in order to help understanding of the present invention.

모든 호프만 디코딩 알고리즘은 디코딩 중에 사용하기 편리한 자신의 디코딩 타임 테이블을 가진다. 즉, 트리 서치를 위해서는 호프만 트리가 존재하고, 테이블 룩업을 위해서는 큰 테이블이 존재한다.Every Hoffman decoding algorithm has its own decoding time table which is convenient to use during decoding. That is, a Hoffman tree exists for tree search, and a large table exists for table lookup.

멀티비트 서치 알고리즘에서는 일련의 서브 테이블들로 구성되는 계층적인 테이블이 존재한다. 이들 테이블들은 트리같은 구조로 형성된다.In the multibit search algorithm, there is a hierarchical table consisting of a series of subtables. These tables are formed in a tree-like structure.

제 1 서브트리는 트리의 루트에 위치하는 서브 테이블이다. 따라서, 제 1 서브트리는 루트 서브테이블 또는 테이블 0 이라 칭한다.The first subtree is a sub table located at the root of the tree. Therefore, the first subtree is referred to as the root subtable or table 0.

테이블 0의 엔트리로부터 직접 확장된 모든 서브 테이블들은 레벨 1에 존재하고 이들을 테이블 1X(11, 12, etc.)라고 칭한다. 테이블 1X의 엔트리로부터 확장된 서브테이블은 레벨 2에 존재하고 테이블 2X(21, 22, etc.)라고 칭한다. 이와 같은 방법으로 레벨이 증가함에 따라 서브테이블이 계층적으로 형성되게 된다.All subtables that extend directly from the entry of table 0 are at level 1 and are called table 1X (11, 12, etc.). Subtables that extend from entries in Table 1X exist at level 2 and are called Table 2X (21, 22, etc.). In this way, as the level increases, the subtables are formed hierarchically.

여기에서 각 서브 테이블은 2n의 크기를 가진다( n = L0, L1X, L2X,··· : L0는 테이블 '0'에서 서치를 위하여 사용된 호프만 비트스트림의 비트수이다. L1x, L2x도 마찬가지이며, 이러한 비트들은 인덱스 비트들이라 칭한다.). 서브 테이블 내에서 각 엔트리는 아이템이라 불린다. 그러므로, 만약 L0 = 4 이면 테이블 0의 크기는 24, 즉 16 아이템을 갖는다.Here, each subtable has a size of 2n (n = L0, L1X, L2X, ...): L0 is the number of bits of the Hoffman bitstream used for search in table '0'. The same is true for L1x and L2x. These bits are called index bits). Each entry in a subtable is called an item. Therefore, if L0 = 4, the size of table 0 has 24, i.e. 16 items.

멀티비트 서치 알고리즘에서는 A 클래스와 B 클래스 두 종류의 아이템이 있다. A 클래스 아이템은 리프(Leaf) 아이템이라 칭한다. 그 이유는 트리 같은 구조의 상층부(top)에 있기 때문이며, 리프 아이템으로부터 더 이상 확장되는 서브 테이블은 없다. 호프만 디코딩 진행에서 리프 아이템을 조우하게 되면, 현재 코드워드의 디코딩은 종료되게 된다. B 클래스 아이템은 또한 서브 루트 아이템이라 칭하는 데, 그것은 트리같은 구조의 상층부에 있지 않기 때문이며, 하나의 서브 테이블 또는 그 것으로부터 확장된 한 서브 트리가 있다. B 클래스 아이템이 비트 스트림에서 조우하게 되면, 현재 코드워드의 디코딩은 종료되지 않고, 더 많은 비트들이 그러한 아이템으로부터 확장된 다음의 서브 테이블을 트레이스하기 위하여 필요하게 될 것이다.In the multibit search algorithm, there are two kinds of items, class A and class B. Class A items are referred to as leaf items. This is because it is at the top of the tree-like structure, and no subtable extends further from the leaf item. If a leaf item is encountered in the Huffman decoding process, decoding of the current codeword is terminated. Class B items are also called subroot items because they are not at the top of the tree-like structure, and there is one subtable or one subtree extending from it. If a Class B item encounters a bit stream, then decoding of the current codeword does not end, and more bits will be needed to trace the next subtable extended from that item.

여기에서 각 아이템은 두 개의 필드를 가지며, 두 필드 중 하나는 속성필드라 칭하며, 이 속성필드의 한 비트는 아이템의 A 또는 B 클래스를 나타내기 위하여 사용된다. A 클래스의 아이템에서 속성필드의 다른 3비트들은 시프트 아웃되는 인덱스 비트수를 나타내기 위하여 사용된다. B 클래스 아이템에서는 모든 인덱스 비트들이 시프트 아웃된다. 이들 3비트들은 얼마나 많은 인덱스 비트들이 다음 서치를 위하여 리드되는 지를 나타는 데에 사용된다. 속성필드의 인덱스 비트들(3비트)이 시프트 아웃 될 것이고, 이러한 3 비트들은 다음을 서치하는 동안 읽게 될 인덱스 비트들을 나타내기 위하여 사용한다. A 클래스 아이템에서, 다른 하나의 필드는 인코드된 값을 저장하기 위해 사용되며, B 클래스 아이템의 다른 하나의 필드는 확장된 서브 테이블의 번지를 저장하기 위하여 사용된다.Here, each item has two fields, one of the two fields is called an attribute field, and one bit of this attribute field is used to indicate an A or B class of the item. The other three bits of the attribute field in items of class A are used to indicate the number of index bits to be shifted out. In the class B item, all index bits are shifted out. These three bits are used to indicate how many index bits are read for the next search. The index bits (3 bits) of the attribute field will be shifted out, and these 3 bits are used to indicate the index bits to be read during the next search. In class A items, the other field is used to store the encoded value, and the other field of the class B item is used to store the address of the extended subtable.

멀티비트서치 알고리즘에서 사용하는 호프만 테이블 구조를 예를 들어 설명하면 다음과 같다.For example, the Hoffman table structure used in the multi-bit search algorithm is described below.

호프만 코드 테이블이 0,10,110,1110,11110, 11111 6개의 코드워드를 가진다고 가정하자. 원래 호프만 테이블은 다음과 같은 프로그램의 수행에 의해 어레이 구조로 저장된다.Assume that the Hoffman code table has six codewords: 0, 10, 110, 1110, 11110, and 11111. The original Hoffman table is stored in an array structure by executing the following program.

struct table{ char length; /*length of the codeword*/struct table {char length; / * length of the codeword * /

(type) codeword; /*the codeword itself*/(type) codeword; / * the codeword itself * /

(type) value; } /*the encoded value*/(type) value; } / * the encoded value * /

상기 코드워드필드와 인코드된 값의 형태(type)은 응용분야에 종속된다. 도 1은 원래의 호프만코드 테이블을 저장하기 위해 사용된 6개의 코드워드 구조를 나타낸다. 16비트 정수가 코드워드 저장에 사용된다. 유효 코드워드 비트는 16비트 정수의 MSB로부터 채워진다. 부호값의 형태는 한 개의 char가 될 수 있다.The type of the codeword field and the encoded value depends on the application. Figure 1 shows the six codeword structures used to store the original Hoffman code table. 16-bit integers are used for codeword storage. The valid codeword bits are filled from the MSB of 16 bit integers. The sign type can be a char.

디코딩타임 테이블에서 각 아이템은 다음 프로그램의 수행에 의해 저장된다.Each item in the decoding time table is stored by execution of the next program.

struct tab { char attribute;struct tab {char attribute;

(type) value; }(type) value; }

여기서, 값필드의 형태는 8비트 char이다. dl 프로그램에 의해 작성된 디코딩 타임 테이블의 루트서브테이블은 도 2에 도시되어 있다.Here, the value field is an 8-bit char. The root subtable of the decoding time table created by the dl program is shown in FIG.

도 2에서 'cod'는 코드워드 비트('1111'은 호프만 코드워드 '11111'과 '11110'의 MSB로부터의 4비트이다.)이고, 'idx'는 테이블내에서 탐색하는 데 사용되는 인덱스 비트이고, 'attr'는 아이템의 속성필드이고, 'val'필드는 아이템의 값필드이다.In FIG. 2, 'cod' is a codeword bit ('1111' is 4 bits from the MSB of Hoffman codewords '11111' and '11110'), and 'idx' is an index bit used to search within the table. 'Attr' is the item's attribute field, and 'val' field is the item's value field.

도 3에는 테이블 0에서 확장된 크기 2의 테이블 11을 나타낸다.3 shows Table 11 of size 2 extended from Table 0. FIG.

가장 긴 호프만 코드워드가 5-비트이므로 LO = 4를 취할 수 있고, 따라서, 테이블 0은 16 아이템을 가진다. 속성필드에서, LSB부터 3비트는 코드워드가 디코딩된 후에 몇 개의 인덱스 비트들이 시프트 아웃되었는지 나타내는 데 사용된다. MSB는 이 아이템의 형태를 표시하는데 사용될 수 있는데, '0'은 리프 아이템( A 클래스 아이템)을 나타내고, '1'은 서브-루트 아이템(B 클래스 아이템)을 나타낸다. 테이블 0의 마지막 아이템에서, 부호값 필드는 16이 되는데, 그것은 테이블 0과 테이블 11은 하나의 커다란 어레이로써 저장이 되기 때문이고, 테이블 11의 기준 번지는 전체 테이블의 시작부터 오프 셋 16을 가진다.Since the longest Hoffman codeword is 5-bit, we can take LO = 4, so Table 0 has 16 items. In the attribute field, three bits from the LSB are used to indicate how many index bits are shifted out after the codeword is decoded. The MSB can be used to indicate the type of this item, where '0' represents a leaf item (Class A item) and '1' represents a sub-root item (Class B item). In the last item of table 0, the signed value field is 16, because table 0 and table 11 are stored as one large array, and the reference address of table 11 has offset 16 from the beginning of the entire table.

MSB로부터 4비트의 코드워드들의 각각은 테이블 0의 16번째 아이템에 대응하는 리프 아이템을 가진다. 11110 과 11111들은 테이블 0의 아이템 1111로부터 확장된 서브-테이블에 속한다. 테이블 11의 크기는 2이다.Each of the four bits of codewords from the MSB has a leaf item corresponding to the sixteenth item of table zero. 11110 and 11111 belong to a sub-table extended from item 1111 of table 0. The size of table 11 is two.

테이블 0에서 처음 8 아이템들은 모두 동일한 코드워드 '0' 와 일치하고, 이들의 인덱스 비트들은 0, 1, 10, 100, 101 ,110, 111이다. LO = 4 이기 때문에 호프만 디코딩의 초기에는 4 비트가 읽혀질 것이고, 이들 4 비트는 테이블 0를 서치하기 위한 인덱스 비트들로서 사용될 것이다. 처음 비트가 0 이면, 다른 3 비트에 관계없이 초기 코드워드는 0 이므로, 상기 8 아이템들은 모두 리프 아이템이 되고, 모두 동일한 코드워드 0으로 대응한다. 그러므로, 이들 코드워드가 디코딩된 후에는 속성필드에 의해, 시프트 아웃되는 인덱스 비트의 수가 1임을 알 수 있다. 그런 다음에 처음 비트가 시프트 아웃되고 또 다른 1 비트가 다음 코드워드의 디코딩을 위한 4비트 인덱스를 형성하기 위해 읽어들여진다.The first 8 items in table 0 all match the same codeword '0', and their index bits are 0, 1, 10, 100, 101, 110, 111. Since LO = 4, four bits will be read at the beginning of Huffman decoding, and these four bits will be used as index bits for searching Table 0. If the first bit is 0, the initial codeword is 0 regardless of the other 3 bits, so all 8 items are leaf items and all correspond to the same codeword 0. Therefore, after these codewords are decoded, it can be seen that the number of index bits shifted out by the attribute field is one. The first bit is then shifted out and another one bit is read to form a four bit index for decoding the next codeword.

예컨대, 비트 스트림이 01111010......이라 가정하면, 처음 4비트가 리드되고 리드된 4비트에 의해 테이블 0에서 아이템 111이 서치되고 부호값 '0'을 얻음으로써, 처음 코드워드의 디코딩은 종료된다. 아이템 111에서의 속성필드가 '1'이므로 비트스트림의 처음 '0'만 시프트 아웃되면 1111을 얻는다. 1111을 인덱스로 사용하여 테이블 0에서 서치하면 서브루트 아이템인 1111이 서치되게 된다. 이 코드워드의 디코딩은 종료될수 없으므로, 4비트를 모두 시프트 아웃시킨다. 테이블 0의 속성필드에서, 다음 서치를 위해 읽혀지는 비트의 수가 '1'임을 알 수 있다. 읽혀지는 1 비트는 비트스트림의 6번째 비트인 0이다. 이것을 테이블 11의 인덱스로 사용하여 대응하는 아이템을 서치하면 디코딩값 '-2'를 얻는다. 이것은 리프 아이템이므로 이 코드워드의 디코딩 또한 종료된다. 그리고, 읽혀진 1 비트는 시프트 아웃되고, 또 다른 L0(=4)의 비트들이 읽혀지며, 다른 코드워드의 디코딩이 시작된다. 통상적으로, 16보다 작은 크기의 서브-테이블에 속하는 모든 아이템은 리프 아이템이다.For example, assuming that the bit stream is 01111010 ......, decoding the first codeword by searching for item 111 in table 0 and obtaining the sign value '0' by the first four bits being read and the four bits read. Ends. Since the attribute field in item 111 is '1', if only the first '0' of the bitstream is shifted out, 1111 is obtained. Searching on table 0 using 1111 as an index results in a search for the subroot item 1111. The decoding of this codeword cannot be terminated, thus shifting out all four bits. In the attribute field of Table 0, you can see that the number of bits read for the next search is '1'. One bit read is 0, the sixth bit of the bitstream. Use this as an index in Table 11 to search for the corresponding item to get the decoding value '-2'. Since this is a leaf item, the decoding of this codeword is also terminated. Then, one read bit is shifted out, another L0 (= 4) bits are read, and decoding of another codeword is started. Typically, all items belonging to sub-tables of size less than 16 are leaf items.

L0, L1x, L2x의 각 값은 서브-테이블의 길이로 불리우며, 통상적으로 이들값은 작다. 이들의 대표적인 값은 L0 = 4, L1x ≤ 4, L2x ≤ 4, ...이다. 4 마만의 길이를 갖는 각 서브-테이블은 자신으로부터 확장되는 서브-테이블은 갖지 못한다. 서브-테이블의 길이가 대표적인 값을 가지면, 전체 디코딩 타임 테이블의 크기는 호프만 트리에 필적할 만하다.Each value of L0, L1x, L2x is called the length of the sub-table, and these values are typically small. Typical values of these are L0 = 4, L1x <4, L2x <4, ... Each sub-table with a length of 40,000 does not have a sub-table extending from it. If the length of the sub-table has a representative value, the size of the entire decoding time table is comparable to the Hoffman tree.

멀티플 비트 서치 알고리즘은 한 번에 1 비트이상, 통상적으로 4비트를 시프트 아웃시킬 수 있는 장점이 있다. 그러므로, 각 검색에 필요한 동작이 트리서치에 비해 더 복잡할지라도, 트리 서치보다는 더욱 빠르다. 그러나, 항상 그런 것은 아니며, 알려진 바와 같이, 호프만 비트 스트림에서는 짧은 코드워드가 긴 코드워드보다 더 자주 발생한다. 즉, 평균길이가 매우 작을 때, 멀티플 비트 서치 알고리즘은 뚜렷한 잇점이 있다고 볼 수 없다. 그러나, 하드웨어로 구현된다면, 트리검색보다는 항상 더 빠르지만 소프트웨어로 구현시에는 트리검색보다 더 느릴 때도 있다.Multiple bit search algorithms have the advantage of being able to shift out more than one bit, typically four bits at a time. Therefore, although the operation required for each search is more complicated than tree search, it is faster than tree search. However, this is not always the case, and as is known, short codewords occur more often than long codewords in the Hoffman bit stream. In other words, when the average length is very small, the multiple bit search algorithm cannot be seen as a distinct advantage. However, if implemented in hardware, it is always faster than tree search, but sometimes slower than tree search in software.

예를 들면, 호프만 테이블이 1 비트 또는 2 비트 코드워드(이 코드워드는 비트 스트리임에서 종종 나타난다)를 포함하고 있으면, 멀티플 비트 서치 알고리즘의 성능은 매우 열악하다. 호프만 비트스트림에서, 이러한 경우가 가금 발생되므로 이러한 문제의 개선이 요구되었다.For example, if the Hoffman table contains a 1-bit or 2-bit codeword (this codeword often appears in the bit stream), the performance of the multiple bit search algorithm is very poor. In the Hoffman bitstream, this case is poultry-prone, requiring improvement of this problem.

1비트 또는 2비트 코드워드가 존재한다면, 처음 서브 테이블에서 많은 리던던시가 있게 된다. 상술한 바와 같이, 1비트에 대응하는 8개의 리프 아이템들, '0000', '0001', '0010', '0011', '0100', '0101', '0110', '0111'들이 존재하게 된다.If there is a 1-bit or 2-bit codeword, there is a lot of redundancy in the first subtable. As described above, eight leaf items corresponding to one bit, '0000', '0001', '0010', '0011', '0100', '0101', '0110', and '0111' exist. do.

따라서, 본 발명에서는 서브 테이블 내에 C 클래스 아이템을 부여하고자 한다. C 클래스 아이템은 또한 멀티플 리프 아이템으로 칭한다. 호프만 디코딩 절차에서, 이런 종류의 아이템을 조우하게 되면 여러 코드워드가 동시에 디코드될 수 있다. 이런 코드워드들은 모두 동일하고 연속적으로 두 번 이상 나타난다. 예로써, 0, 1, 10, 11은 C 클래스 아이템이 될 것이다.Therefore, the present invention intends to assign a C class item in a sub table. C class items are also referred to as multiple leaf items. In the Hoffman decoding procedure, encountering this kind of item allows multiple codewords to be decoded simultaneously. These codewords are all the same and appear more than once in succession. For example, 0, 1, 10, 11 would be C class items.

클래스 C 아이템에서, 부호값 필드는 A 클래스의 부호값 필드와 동일하지만 속성필드는 다르다. 2 비트가 형태를 표시하는데 사용되며 (현재 두 종류 이상의 아이템이 존재한다) 다른 3 비트는 코드워드 수를 나타낸다. 0에 대해서는 4를, 1인 경우에는 3을 나타내게 된다. 다른 3 비트는 몇 개의 인덱스비트가 시프트 아웃될 수 있는지 표시하는 데 사용된다. 1 비트 코드워드는 코드워드에 대해서는, 코드워드 수와 같고, 2 비트 코드워드에 대해서는 코드워드 수의 2배한 것과 같다.In class C items, the sign value field is the same as the sign value field of class A, but the attribute field is different. Two bits are used to indicate the form (currently there are more than one kind of item) and the other three bits represent the number of codewords. 4 represents 0, and 3 represents 1. The other three bits are used to indicate how many index bits can be shifted out. The one-bit codeword is equal to the number of codewords for the codeword and twice the number of codewords for the two-bit codeword.

디코딩 타임 테이블에 C 클래스 아이템을 소개한 후에 본 발명의 알고리즘이 트리탐색 방법보다 더욱 빠름을 확인시킬 수 있다.After introducing the C class item in the decoding time table, it can be confirmed that the algorithm of the present invention is faster than the tree search method.

이론적으로, 모든 호프만 코드 테이블은 완전한 트리구조이어야 하나, 때때로 몇몇 특이한 이유로 어떤 호프만 테이블은 완전한 트리구조로 만들어 질 수 없게 된다. 이러한 경우, 존재하지 않는 리프들이 또한 몇몇 아이템에 상응할 수 있기 때문에 다른 종류의 아이템, 즉, D 클래스 아이템을 소개한다. D 클래스 아이템은 노매치(no match) 아이템으로 칭한다. 이것은 비트스트리임의 패턴이 호프만 코드 테이블과 매칭되지 않음을 의미한다. 만일 디코딩 프로그램이 이러한 종류의 아이템과 마주치면, 그 디코딩 진행는 멈추게되고, 예외적인 조작진행이 시행되게 된다.In theory, every Hoffman code table should be a complete tree structure, but sometimes for some unusual reason some Hoffman tables cannot be made a complete tree structure. In this case, we introduce another kind of item, namely a class D item, because non-existent riffs may also correspond to some items. Class D items are referred to as no match items. This means that the pattern of the bitstream does not match the Hoffman code table. If the decoding program encounters this kind of item, the decoding process stops, and an exceptional operation progresses.

상술한 예에 대해 변형 디코딩 타임 테이블을 적용하면 도 4와 같이 나타난다.When the modified decoding time table is applied to the above-described example, it appears as shown in FIG. 4.

도 4의 속성필드에서, LSB의 3 비트는 시프트 아웃되는 인덱스비트의 수를 표시하는 데 사용되며(A 클래스 및 C 클래스 아이템) 또는 다음 탐색을 위해 읽혀지는 비트의 수를 표시하는 데 사용된다(B 클래스 아이템). 도 5에 도시한 바와 같이, MSB로부터의 2 비트는 클래스 타입을 표시하는 데 사용되는 바, 00--A 클래스, 10--B 클래스, 01-- C 클래스, 11--D 클래스로 표시된다. 그 외 3 비트는 C 클래스에서 코드워드의 수를 표시하는 데 사용된다.In the attribute field of FIG. 4, the 3 bits of the LSB are used to indicate the number of index bits shifted out (class A and C class items) or to indicate the number of bits read for the next search ( B class items). As shown in Fig. 5, two bits from the MSB are used to indicate the class type, which is represented by 00--A class, 10--B class, 01--C class, and 11--D class. . The other three bits are used to indicate the number of codewords in the C class.

테이블 11은 이 경우 변경되지 않는다.Table 11 does not change in this case.

도 6을 참조하면, 본 발명에 의한 디코딩 방법은 호프만 코딩된 비트스트림으로부터 L비트의 인덱스 비트를 취하고(10단계), 디코딩 타임테이블의 루트서브테이블을 리드한다(12단계). 리드된 서브 테이블을 참조하여 상기 취해진 인덱스 비트와 동일한 인덱스정보를 가진 아이템을 서치한다(14단계). 서치된 아이템의 속성정보에 의해 아이템의 클래스가 A클래스인지(18단계), B클래스인지(20단계), C 클래스인지(22단계), 아니면 D 클래스인지를 판단한다. 상기 판단에 의해 A 클래스로 판단되면 아이템의 값을 단일의 1비트 호프만 코드워드의 디코딩값으로 출력한다(26단계). 상기 판단에 의해 C 클래스로 판단되면 아이템의 값을 연속되는 복수의 1비트 호프만 코드워드들의 디코딩값들로 동시에 출력한다(28단계). 상기 판단에 의해 B 클래스로 판단되면 아이템의 속성정보에 의해 상기 비트스트림으로부터 새로운 인덱스 비트를 리드한다(32단계). 상기 판단에 의해 D 클래스로 판단되면 호프만 코드 테이블 상에 정의 되지 않은 코드로 인식하여 예외적인 조작을 수행한다(24단계). 상기 B 클래스 아이템의 값에 대응하는 서브 테이블을 리드하고 상기 아이템 서치단계로 복귀한다(34단계). 상기 A 및 C 클래스의 디코딩값 출력후에 상기 속성정보에 의해 인덱스 비트들을 상기 L이하의 소정 비트수 만큼 시프팅시켜서 다음 아이템 서치를 위한 L비트의 인덱스 비트를 형성한 다음에 상기 아아이템 서치단계로 복귀한다(30단계).Referring to FIG. 6, the decoding method according to the present invention takes L bit index bits from the Huffman coded bitstream (step 10) and reads the root subtable of the decoding time table (step 12). The item having the same index information as the taken index bit is searched for by referring to the read sub table (step 14). The attribute information of the searched item determines whether the item class is A class (step 18), B class (step 20), C class (step 22), or D class. If it is determined that the class A is determined by the determination, the value of the item is output as a decoding value of a single 1-bit Hoffman codeword (step 26). If it is determined that the class C is determined by the determination, the value of the item is simultaneously output as decoding values of a plurality of consecutive 1-bit Huffman codewords (step 28). If it is determined that the class is B, the new index bit is read from the bitstream according to the attribute information of the item (step 32). If it is determined that the class D is determined by the determination, the Huffman code table is recognized as an undefined code and an exceptional operation is performed (step 24). The sub table corresponding to the value of the class B item is read and the process returns to the item search step (step 34). After outputting the decoding values of the A and C classes, the index bits are shifted by a predetermined number of bits below the L by the attribute information to form L bit index bits for the next item search, and then the item searching step is performed. Return (step 30).

본 발명에 의한 변경 멀티비트 서치방식에 의한 디코딩 동작을 살명하기 위하여 간단한 예를 들어 설명하면 다음과 같다.To explain the decoding operation by the modified multi-bit search method according to the present invention, a simple example will be described.

비트스트리임이 '000101111100...'으로 시작하면 L0 = 4이므로, 처음 4비트가 읽혀지고, 이 인덱스는 '0001'이며, 도 4의 테이블 0에서 대응하는 인덱스의 속성필드를 참조하면 '91'(십진수) 또는 '10-111-011'(이진수)임을 알 수 있다. MSB 2 비트는 C 클래스 아이템임을 표시하고, 다음 3 비트는 계속해서 나타나는 코드워드 3개가 있음을 표시한다. 따라서, 부호값 필드에서 대응하는 디코딩값을 '0'을 읽고, 3개의 '0'이 디코딩 출력된다. 마지막 3 비트는 3 비트가 시프트 아웃된다는 것을 표시한다. 따라서, 비트스트림의 또 다른 3 비트가 리드되어 현재 인덱스는 '1011'이 됨을 알 수 있다. 이 인덱스에 대응하는 아이템의 속성필드를 참조하면, 그 디코딩값은 '2'임을 알 수 있고, 따라서, 이 아이템은 리프아이템이며, 두 비트가 시프트 아웃되어야 한다. 또한, 디코딩값 필드의 대응하는 부호값은 '1' 이다. 이어서, 두 비트가 시프트 아웃되어 비트스트림의 새로운 2비트가 읽혀져서 인덱스는 '1111'이 된다. 이 인덱스의 아이템은 서브 루트 아이템이므로 상술한 바와 같이 테이블 11을 참조하는 방식으로 디코딩과정이 진행되게 된다.If the bitstream starts with '000101111100 ...', L0 = 4, so the first 4 bits are read, and this index is '0001', and referring to the attribute field of the corresponding index in table 0 of FIG. (Decimal) or '10 -111-011 '(binary). The MSB 2 bits indicate that it is a C class item, and the next 3 bits indicate that there are three codewords that appear continuously. Therefore, the corresponding decoding value '0' is read from the code value field, and three '0's are decoded and output. The last 3 bits indicate that 3 bits are shifted out. Accordingly, it can be seen that another 3 bits of the bitstream are read so that the current index becomes '1011'. Referring to the attribute field of the item corresponding to this index, it can be seen that the decoding value is '2', so this item is a leaf item, and two bits should be shifted out. Also, the corresponding code value of the decoding value field is '1'. Subsequently, two bits are shifted out so that a new two bits of the bitstream are read so that the index is '1111'. Since the item of the index is a sub-root item, the decoding process is performed by referring to Table 11 as described above.

C 클래스 아이템과 D 클래스 아이템의 도입에 의한 멀티 비트 서치 알고리즘의 성능이 많이 개선되었다. 그러나, 테이블 빌딩 알고리즘은 소프트웨어 실행과 호프만 테이블이 고정되지 않은 그런 경우를 위하여 적절하게 형성될 필요가 있다.The performance of the multi-bit search algorithm has been greatly improved by introducing C class items and D class items. However, the table building algorithm needs to be properly formed for software execution and for those cases where the Hoffman table is not fixed.

순환 절차는 디코딩 타임 테이블의 작성을 위하여 개발되어 왔다.Cyclic procedures have been developed for the preparation of decoding time tables.

이러한 알고리즘을 의사(Pseudo) C 언어에 사용한 것을 나타낼 것이다.This algorithm will be used in the pseudo C language.

도 7을 참조하면, 먼저 테이블 작성을 위하여 필요한 두 개의 글로벌 데이터 구조를 정의한다(40단계). 두 개의 글러벌 데이터 구조 중 하나는 원래 호프만 테이블의 저장에 관한 것이다.Referring to FIG. 7, first, two global data structures necessary for creating a table are defined (step 40). One of the two global data structures concerns the storage of the original Hoffman table.

struct table { char length; /* length of this codeword */struct table {char length; / * length of this codeword * /

(type) codeword; / * the codeword itself */(type) codeword; / * the codeword itself * /

(type) value; } /* the encoded value */(type) value; } / * the encoded value * /

코드워드필드와 부호값필드의 형태는 응용분야에 의존한다.The type of codeword field and sign value field depends on the application.

다른 하나는 디코딩 타임 테이블의 저장에 관한 것이다.The other relates to the storage of the decoding time table.

struct tab { char attribute;struct tab {char attribute;

(type) value; }(type) value; }

또 다른 두 개의 글로벌 변수가 필요하다(42단계).Another two global variables are needed (step 42).

level: 작성되는 현재 서브 테이블의 레벨을 나타내고, 상기 루트 서브 테이블의 레벨값은 0 이며, 루트 서브 테이블로부터 확장된 서브 테이블의 레벨값은 하나의 같은 값을 가진다.level: represents the level of the current subtable to be created, the level value of the root subtable is 0, and the level value of the subtable extended from the root subtable has one and the same value.

entry: 호프만 코드 테이블의 코드워드의 수:entry: Number of codewords in Hoffman code table:

함수는 Build- table(int root, int tab)이다. 여기서, root는 서브테이블이 확장된 비트스트림을 정의 한다. 또한, tabl은 서브테이블의 길이를 정의 한다.The function is a Build-table (int root, int tab). Here, root defines the bitstream in which the subtable is extended. Tabl also defines the length of the subtable.

매번 이 함수는 실행되어 하나의 서브테이블이 작성된다. 호프만 트리의 뿌리로부터 시작되어 루트 서브 테이블(level=0, root=0, tabl=4)을 만들어진다(44단계). 먼저, 이 서브 테이블이 만들어진 후, 서브 테이블로부터 다른 서브 테이블의 확장이 필요한지를 체크하기 위하여 서브 테이블을 스캔하게 된다(46단계). 만약, 필요하다면, 이 서브 테이블의 베이스 어드레스가 할당되고, 순환적인 콜에 의해 작성되게 된다. 확장될 서브테이블이 없다면 리턴하게 된다.Each time this function is executed, a subtable is created. Starting from the root of the Hoffman tree, a root subtable (level = 0, root = 0, tabl = 4) is created (step 44). First, after the sub table is created, the sub table is scanned to check whether another sub table needs to be expanded from the sub table (step 46). If necessary, the base address of this subtable is assigned and written by a recursive call. If there is no subtable to be extended, it will return.

각 테이블 작성에서, 처음부터 끝까지 원래의 호프만 테이블을 스캔한다. 각 호프만 코드워드에서, 레벨값을 체킹하는 것과 독립변수 root를 사용하는 것에 의해, 디코딩 타임 테이블로 이미 놓여 있는지를 체크할 것이고, 없다면 이 서브 테이블에 속하는지를 체크할 것이다.In each table creation, the original Hoffman table is scanned from beginning to end. In each Hoffman codeword, by checking the level value and using the independent variable root, it will check if it is already placed in the decoding time table, and if it does not belong to this subtable.

코드워드가 이 서브 테이블에 속하면 리프가 되는지 또는 더 확장되어야 하는지를 결정할 것이며, 리프가 된다면 모든 리프 아이템은 그것에 일치하도록 만들고, 마크(set table[i]. length to 128)를 만든다. 만약 리프 아이템이 아니면 일치하는 서브 루트 아이템을 만든다.(단지 속성필드를 만들고, 다음 필드는 후에 지정될 것이다).If the codeword belongs to this subtable, it will determine whether it is a leaf or should be expanded further, and if it is a leaf, all leaf items are matched to it and a mark (set table [i] .length to 128) is made. If it is not a leaf item, it creates a matching subroot item (just create an attribute field, the next field will be specified later).

작성-테이블 함수는 다음과 같다.The create-table function looks like this:

Build-table( int root, int tabl)Build-table (int root, int tabl)

{int i, clen, flag, tbl;{int i, clen, flag, tbl;

if (level = 0) root = 0;if (level = 0) root = 0;

for(i=0; ientry; i++)for (i = 0; ientry; i ++)

{ flag = (table[i]. codeword (level1*4-4)) 12;{flag = (table [i] .codeword (level1 * 4-4)) 12;

/* assume 16 bits are used for codeword field of the table structure, otherwise 12 should be changed *// * assume 16 bits are used for codeword field of the table structure, otherwise 12 should be changed * /

if (level = 0){flag = 0;}if (level = 0) {flag = 0;}

if (table[i]. length!=128 (table[i].length 5)=level flag=root)if (table [i] .length! = 128 (table [i] .length 5) = level flag = root)

{clen = tab[i].length 0xlf;{clen = tab [i] .length 0xlf;

if (clen tabl) {make leaf items;if (clen tabl) {make leaf items;

table[i].length = 128;}table [i] .length = 128;}

else{if(clen8) attribute = 128 + 4;else {if (clen8) attribute = 128 + 4;

else { if(clen-4 attribute)attribute=128 + clen-4;else {if (clen-4 attribute) attribute = 128 + clen-4;

table[i].length = table[i].length - tabl;table [i] .length = table [i] .length-tabl;

table[i].length += 32; }table [i] .length + = 32; }

}}

for(i=0; i(1tabl); I++)for (i = 0; i (1tabl); I ++)

{ if i th item is a subroot item{if i th item is a subroot item

{ tbl = attribute 15;{tbl = attribute 15;

assign a value for the second field of this item;assign a value for the second field of this item;

level = level + 1;level = level + 1;

Build-table(i,tbl);}Build-table (i, tbl);}

}}

level -= 1;level-= 1;

return;return;

}}

작성-테이블 0이 실행된 후에는, D 클래스 아이템을 추가하기 위하여 전 테이블에 대해 스캔이 수행된다. 또 다른 스캔이 C 클래스를 추가하기 위하여 루트서브테이블상에 수행된다.After create-table 0 is run, a scan is performed on all tables to add class D items. Another scan is performed on the root subtable to add the C class.

이상과 같이 본 발명에서는 멀티비트서치방식의 문제점을 개선하기 위하여 동일한 1비트 코드들이 연속하여 존재한다는 정보를 각 아이템에 작성하여 C클래스 아이템을 형성하고, 호프만 코드 테이블에 존배하지 않는 패턴은 D 클래스 아이템으로 형성함으로써, 디코딩시 동작속도를 향상시킬 수 있고 메모리 사용의 효율성을 향상시킬 수 있다.As described above, in the present invention, in order to improve the problem of the multi-bit search method, information indicating that the same 1-bit codes are continuously formed is formed in each item to form a C class item, and a pattern that does not exist in the Hoffman code table is a D class. By forming the item, it is possible to improve the operation speed during decoding and improve the efficiency of memory usage.

또한, 디코딩 테이블의 작성방법을 제공함으로써, 호프만 테이블이 고정되지 않은 응용분야에서도 소프트웨어적으로 사용이 가능하다.In addition, by providing a method of creating a decoding table, it can be used in software even in applications where the Hoffman table is not fixed.

Claims (5)

호프만 코드의 멀티-비트 서치방식에 의한 디코딩시에 사용하는 디코딩타임테이블에 있어서, 상기 디코딩 타임 테이블은 소정 비트수 이하의 복수의 호프만 코드들로 이루어진 코드필드;상기 복수의 코드들의 배열순서를 표시하는 인덱스필드;상기 각 호프만 코드들을 분류하는 클래스, 연속되는 동일 코드워드의 수, 서치를 위한 인덱스 비트들의 시프팅 횟수 또는 읽어들일 인덱스 비트수 등의 속성정보를 가지는 속성필드;상기 각 호프만 코드들에 대응하는 디코딩 값들로 이루어진 값필드를 구비한 것을 특징으로 하는 디코딩 타임 테이블.A decoding time table for use in decoding a Hoffman code by a multi-bit search method, the decoding time table comprising: a code field comprising a plurality of Hoffman codes having a predetermined number of bits or less; indicating an arrangement order of the plurality of codes An attribute field having attribute information such as a class for classifying the Hoffman codes, the number of consecutive identical codewords, the number of shifting of the index bits for search, or the number of index bits to be read; And a value field consisting of decoding values corresponding to the decoding time table. 호프만 코드의 멀티-비트 서치방식을 사용한 디코딩방법에 있어서,In the decoding method using the multi-bit search method of Hoffman code, 호프만 코딩된 비트스트림으로부터 L비트의 인덱스 비트를 취하는 단계;Taking L bits of index bits from the Hoffman coded bitstream; 디코딩 타임테이블의 루트서브테이블을 리드하는 단계;Reading the root subtable of the decoding timetable; 리드된 서브 테이블을 참조하여 상기 취해진 인덱스 비트와 동일한 인덱스정보를 가진 아이템을 서치하는 단계;Searching for an item having the same index information as the taken index bit with reference to the read sub table; 서치된 아이템의 속성정보에 의해 아이템의 클래스를 판단하는 단계;Determining the class of the item based on the attribute information of the searched item; 상기 판단에 의해 A 클래스로 판단되면 아이템의 값을 단일의 1비트 호프만 코드워드의 디코딩값으로 출력하는 단계;Outputting the value of the item as a decoded value of a single 1-bit Hoffman codeword when determined to be Class A by the determination; 상기 판단에 의해 C 클래스로 판단되면 아이템의 값을 연속되는 복수의 1비트 호프만 코드워드들의 디코딩값들로 동시에 출력하는 단계;Simultaneously outputting a value of an item as decoding values of a plurality of consecutive 1-bit Huffman codewords when determined to be a C class by the determination; 상기 판단에 의해 B 클래스로 판단되면 아이템의 속성정보에 의해 상기 비트스트림으로부터 새로운 인덱스 비트를 리드하는 단계;Reading a new index bit from the bitstream according to the attribute information of the item if it is determined that the class is B by the determination; 상기 B클래스 아이템의 값에 대응하는 서브 테이블을 리드하고 상기 아이템 서치단계로 복귀하는 단계; 및Reading a sub table corresponding to a value of the class B item and returning to the item search step; And 상기 A 및 C 클래스의 디코딩값 출력후에 상기 속성정보에 의해 인덱스 비트들을 상기 L이하의 소정 비트수 만큼 시프팅시켜서 다음 아이템 서치를 위한 L비트의 인덱스 비트를 형성한 다음에 상기 아아이템 서치단계로 복귀하는 단계를 구비하는 것을 특징으로 하는 호프만 코드의 개선된 디코딩방법.After outputting the decoding values of the A and C classes, the index bits are shifted by a predetermined number of bits below the L by the attribute information to form L bit index bits for the next item search, and then the item searching step is performed. And returning the Hoffman code. 호프만 코드의 멀티-비트 서치방식을 사용한 디코딩방법에 있어서,In the decoding method using the multi-bit search method of Hoffman code, 호프만 코딩된 비트스트림으로부터 L비트의 인덱스 비트를 취하는 단계;Taking L bits of index bits from the Hoffman coded bitstream; 디코딩 타임테이블의 루트서브테이블을 리드하는 단계;Reading the root subtable of the decoding timetable; 리드된 서브 테이블을 참조하여 상기 취해진 인덱스 비트와 동일한 인덱스정보를 가진 아이템을 서치하는 단계;Searching for an item having the same index information as the taken index bit with reference to the read sub table; 서치된 아이템의 속성정보에 의해 아이템의 클래스를 판단하는 단계;Determining the class of the item based on the attribute information of the searched item; 상기 판단에 의해 A 클래스로 판단되면 아이템의 값을 단일의 1비트 호프만 코드워드의 디코딩값으로 출력하는 단계;Outputting the value of the item as a decoded value of a single 1-bit Hoffman codeword when determined to be Class A by the determination; 상기 판단에 의해 C 클래스로 판단되면 아이템의 값을 연속되는 복수의 1비트 호프만 코드워드들의 디코딩값들로 동시에 출력하는 단계;Simultaneously outputting a value of an item as decoding values of a plurality of consecutive 1-bit Huffman codewords when determined to be a C class by the determination; 상기 판단에 의해 B 클래스로 판단되면 아이템의 속성정보에 의해 상기 비트스트림으로부터 새로운 인덱스 비트를 리드하는 단계;Reading a new index bit from the bitstream according to the attribute information of the item if it is determined that the class is B by the determination; 상기 판단에 의해 D 클래스로 판단되면 호프만 코드 테이블 상에 정의 되지 않은 코드로 인식하여 예외적인 조작을 수행하는 단계;Recognizing a code not defined on the Hoffman code table and performing an exceptional operation if it is determined that the class is D; 상기 B클래스 아이템의 값에 대응하는 서브 테이블을 리드하고 상기 아이템 서치단계로 복귀하는 단계; 및Reading a sub table corresponding to a value of the class B item and returning to the item search step; And 상기 A 및 C 클래스의 디코딩값 출력후에 상기 속성정보에 의해 인덱스 비트들을 상기 L이하의 소정 비트수 만큼 시프팅시켜서 다음 아이템 서치를 위한 L비트의 인덱스 비트를 형성한 다음에 상기 아아이템 서치단계로 복귀하는 단계를 구비하는 것을 특징으로 하는 호프만 코드의 개선된 디코딩방법.After outputting the decoding values of the A and C classes, the index bits are shifted by a predetermined number of bits below the L by the attribute information to form L bit index bits for the next item search, and then the item searching step is performed. And returning the Hoffman code. 호프만 코드의 멀티-비트 서치방식에서 개선된 디코딩타임테이블을 작성하는 방법에 있어서,A method of creating an improved decoding time table in a multi-bit search method of Hoffman code, 원래의 호프만 테이블을 저장하기 위한 제 1 글로벌 데이터와, 디코딩 타임테이블을 저장하기 위한 제 2 글로벌 데이터를 정의하는 단계;Defining first global data for storing the original Hoffman table and second global data for storing the decoding timetable; 작성중인 서브 테이블의 레벨을 표시하는 레벨변수와 상기 호프만 코드 테이블에 등록된 코드워드의 수를 나타내는 엔트리변수를 정의 하는 단계;Defining a level variable indicating a level of a sub table being created and an entry variable indicating a number of codewords registered in the Hoffman code table; 상기 호프만 코드 테이블을 참조하면서 주어진 테이블 사이즈에 따라 루트 서브 테이블을 작성하는 단계;Creating a root subtable according to a given table size while referring to the Hoffman code table; 작성된 루트서브테이블을 체크하여 어떤 서브 테이블의 확장이 필요한가를 판단하는 단계;Checking the created root subtable to determine which subtable needs to be expanded; 서브테이블의 확장이 필요하면 서브 테이블의 베이스 어드레스를 할당하고 상기 서브 테이블 작성 단계와 판단 단계를 반복적으로 수행하여 서브 테이블을 작성하는 단계; 및Creating a subtable by allocating a base address of the subtable and repeatedly performing the subtable creating step and the determining step when the subtable needs to be expanded; And 상기 판단단계에서 확장이 필요없다면 리턴하는 단계를 구비하는 것을 특징으로 하는 개선된 디코딩 타임 테이블 작성방법.And returning if no expansion is necessary in the determining step. 제 4 항에 있어서, 상기 루트 서브테이블의 작성단계에서 D 클래스 아이템을 추가하기 위하여 전 테이블에 대해 스캔이 수행되고, 이어서, C 클래스를 추가하기 위하여 루트서브테이블상에 도 다른 스캔을 수행하는 것을 특징으로 하는 개선된 디코딩 타임 테이블 작성방법.5. The method of claim 4, wherein in the step of creating the root subtable, a scan is performed on all tables to add a D class item, and then another scan is performed on a root subtable to add a C class. An improved decoding time table creation method.
KR1019960054475A 1996-11-15 1996-11-15 Improved Hoffman decoding method, decoding time table and its creation method KR100194205B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1019960054475A KR100194205B1 (en) 1996-11-15 1996-11-15 Improved Hoffman decoding method, decoding time table and its creation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1019960054475A KR100194205B1 (en) 1996-11-15 1996-11-15 Improved Hoffman decoding method, decoding time table and its creation method

Publications (2)

Publication Number Publication Date
KR19980036005A KR19980036005A (en) 1998-08-05
KR100194205B1 true KR100194205B1 (en) 1999-06-15

Family

ID=66320969

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1019960054475A KR100194205B1 (en) 1996-11-15 1996-11-15 Improved Hoffman decoding method, decoding time table and its creation method

Country Status (1)

Country Link
KR (1) KR100194205B1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8674857B2 (en) 2012-03-05 2014-03-18 Samsung Electronics Co., Ltd. Apparatus and method for decoding

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101030726B1 (en) * 2009-11-26 2011-04-26 명지대학교 산학협력단 Memory efficient multimedia huffman decoding method and apparatus for adapting huffman table based on symbol from probability table

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8674857B2 (en) 2012-03-05 2014-03-18 Samsung Electronics Co., Ltd. Apparatus and method for decoding

Also Published As

Publication number Publication date
KR19980036005A (en) 1998-08-05

Similar Documents

Publication Publication Date Title
Brisaboa et al. (S, C)-dense coding: An optimized compression code for natural language text databases
KR100950607B1 (en) Huffman coding
Brisaboa et al. An efficient compression code for text databases
US4814746A (en) Data compression method
US6563956B1 (en) Method and apparatus for compressing data string
US5572206A (en) Data compression method and system
KR100959532B1 (en) Decoding method of CAVLC
Fraenkel et al. Novel compression of sparse bit-strings—preliminary report
US6563439B1 (en) Method of performing Huffman decoding
Fraenkel et al. Bidirectional huffman coding
Ferragina et al. The myriad virtues of wavelet trees
US5216423A (en) Method and apparatus for multiple bit encoding and decoding of data through use of tree-based codes
US6987469B2 (en) Method of generating Huffman code length information
US5617089A (en) Huffman code decoding circuit
KR100194205B1 (en) Improved Hoffman decoding method, decoding time table and its creation method
Ahlswede et al. Universal coding of integers and unbounded search trees
US6919827B2 (en) Method and apparatus for effectively decoding Huffman code
Chen et al. E cient Lossless Compression of Trees and Graphs
JP3199292B2 (en) Run-length extraction method, Huffman code conversion method, and MH coding processing method in Huffman code coding
Jamieson et al. Construction of constrained codes for state-independent decoding
JP3350385B2 (en) Code generation method and coding method
Sugiura et al. General Form of Almost Instantaneous Fixed-to-Variable-Length Codes
Salomon et al. Advanced VL Codes
KR950008487B1 (en) Vlc decoding device and method
Salomon Advanced Codes

Legal Events

Date Code Title Description
A201 Request for examination
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20080201

Year of fee payment: 10

LAPS Lapse due to unpaid annual fee