PandA-2024.02
examples
hls_study
motion
optimized
getvlc.c
Go to the documentation of this file.
1
/*
2
+--------------------------------------------------------------------------+
3
| CHStone : a suite of benchmark programs for C-based High-Level Synthesis |
4
| ======================================================================== |
5
| |
6
| * Collected and Modified : Y. Hara, H. Tomiyama, S. Honda, |
7
| H. Takada and K. Ishii |
8
| Nagoya University, Japan |
9
| |
10
| * Remark : |
11
| 1. This source code is modified to unify the formats of the benchmark |
12
| programs in CHStone. |
13
| 2. Test vectors are added for CHStone. |
14
| 3. If "main_result" is 0 at the end of the program, the program is |
15
| correctly executed. |
16
| 4. Please follow the copyright of each benchmark program. |
17
+--------------------------------------------------------------------------+
18
*/
19
/* getvlc.c, variable length decoding */
20
21
/* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */
22
23
/*
24
* Disclaimer of Warranty
25
*
26
* These software programs are available to the user without any license fee or
27
* royalty on an "as is" basis. The MPEG Software Simulation Group disclaims
28
* any and all warranties, whether express, implied, or statuary, including any
29
* implied warranties or merchantability or of fitness for a particular
30
* purpose. In no event shall the copyright-holder be liable for any
31
* incidental, punitive, or consequential damages of any kind whatsoever
32
* arising from the use of these programs.
33
*
34
* This disclaimer of warranty extends to the user of these programs and user's
35
* customers, employees, agents, transferees, successors, and assigns.
36
*
37
* The MPEG Software Simulation Group does not represent or warrant that the
38
* programs furnished hereunder are free of infringement of any third-party
39
* patents.
40
*
41
* Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,
42
* are subject to royalty fees to patent holders. Many of these patents are
43
* general enough such that they are unavoidable regardless of implementation
44
* design.
45
*
46
*/
47
48
int
49
Get_motion_code
()
50
{
51
int
code;
52
53
if
(
Get_Bits1
())
54
{
55
return
0;
56
}
57
58
if
((code =
Show_Bits
(9)) >= 64)
59
{
60
code >>= 6;
61
Flush_Buffer
(
MVtab0
[code][1]);
62
63
return
Get_Bits1
()? -
MVtab0
[code][0] :
MVtab0
[code][0];
64
}
65
66
if
(code >= 24)
67
{
68
code >>= 3;
69
Flush_Buffer
(
MVtab1
[code][1]);
70
71
return
Get_Bits1
()? -
MVtab1
[code][0] :
MVtab1
[code][0];
72
}
73
74
if
((code -= 12) < 0)
75
return
0;
76
77
Flush_Buffer
(
MVtab2
[code][1]);
78
return
Get_Bits1
()? -
MVtab2
[code][0] :
MVtab2
[code][0];
79
}
80
81
/* get differential motion vector (for dual prime prediction) */
82
int
83
Get_dmvector
()
84
{
85
86
if
(
Get_Bits
(1))
87
{
88
return
Get_Bits
(1) ? -1 : 1;
89
}
90
else
91
{
92
return
0;
93
}
94
}
Flush_Buffer
void Flush_Buffer(int N)
Definition:
getbits.c:136
Get_motion_code
int Get_motion_code()
Definition:
getvlc.c:49
Get_Bits
unsigned int Get_Bits(int N)
Definition:
getbits.c:190
MVtab0
const char MVtab0[8][2]
Definition:
getvlc.h:58
Show_Bits
unsigned int Show_Bits(int N)
Definition:
getbits.c:117
Get_dmvector
int Get_dmvector()
Definition:
getvlc.c:83
Get_Bits1
unsigned int Get_Bits1()
Definition:
getbits.c:127
MVtab2
const char MVtab2[12][2]
Definition:
getvlc.h:70
MVtab1
const char MVtab1[8][2]
Definition:
getvlc.h:64
Generated on Mon Feb 12 2024 13:02:49 for PandA-2024.02 by
1.8.13