Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
3c2ddb59
Commit
3c2ddb59
authored
Aug 08, 2007
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use get_unary from bitstream.h
Originally committed as revision 9996 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
57d473f4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
55 deletions
+9
-55
vc1.c
libavcodec/vc1.c
+9
-55
No files found.
libavcodec/vc1.c
View file @
3c2ddb59
...
@@ -42,52 +42,6 @@
...
@@ -42,52 +42,6 @@
static
const
uint16_t
table_mb_intra
[
64
][
2
];
static
const
uint16_t
table_mb_intra
[
64
][
2
];
/**
* Get unary code of limited length
* @todo FIXME Slow and ugly
* @param gb GetBitContext
* @param[in] stop The bitstop value (unary code of 1's or 0's)
* @param[in] len Maximum length
* @return Unary length/index
*/
static
int
get_prefix
(
GetBitContext
*
gb
,
int
stop
,
int
len
)
{
#if 1
int
i
;
for
(
i
=
0
;
i
<
len
&&
get_bits1
(
gb
)
!=
stop
;
i
++
);
return
i
;
/* int i = 0, tmp = !stop;
while (i != len && tmp != stop)
{
tmp = get_bits(gb, 1);
i++;
}
if (i == len && tmp != stop) return len+1;
return i;*/
#else
unsigned
int
buf
;
int
log
;
OPEN_READER
(
re
,
gb
);
UPDATE_CACHE
(
re
,
gb
);
buf
=
GET_CACHE
(
re
,
gb
);
//Still not sure
if
(
stop
)
buf
=
~
buf
;
log
=
av_log2
(
-
buf
);
//FIXME: -?
if
(
log
<
limit
){
LAST_SKIP_BITS
(
re
,
gb
,
log
+
1
);
CLOSE_READER
(
re
,
gb
);
return
log
;
}
LAST_SKIP_BITS
(
re
,
gb
,
limit
);
CLOSE_READER
(
re
,
gb
);
return
limit
;
#endif
}
static
inline
int
decode210
(
GetBitContext
*
gb
){
static
inline
int
decode210
(
GetBitContext
*
gb
){
if
(
get_bits1
(
gb
))
if
(
get_bits1
(
gb
))
return
0
;
return
0
;
...
@@ -1131,7 +1085,7 @@ static int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
...
@@ -1131,7 +1085,7 @@ static int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
if
(
v
->
quantizer_mode
==
QUANT_FRAME_EXPLICIT
)
if
(
v
->
quantizer_mode
==
QUANT_FRAME_EXPLICIT
)
v
->
pquantizer
=
get_bits
(
gb
,
1
);
v
->
pquantizer
=
get_bits
(
gb
,
1
);
v
->
dquantfrm
=
0
;
v
->
dquantfrm
=
0
;
if
(
v
->
extended_mv
==
1
)
v
->
mvrange
=
get_
prefix
(
gb
,
0
,
3
);
if
(
v
->
extended_mv
==
1
)
v
->
mvrange
=
get_
unary
(
gb
,
0
,
3
);
v
->
k_x
=
v
->
mvrange
+
9
+
(
v
->
mvrange
>>
1
);
//k_x can be 9 10 12 13
v
->
k_x
=
v
->
mvrange
+
9
+
(
v
->
mvrange
>>
1
);
//k_x can be 9 10 12 13
v
->
k_y
=
v
->
mvrange
+
8
;
//k_y can be 8 9 10 11
v
->
k_y
=
v
->
mvrange
+
8
;
//k_y can be 8 9 10 11
v
->
range_x
=
1
<<
(
v
->
k_x
-
1
);
v
->
range_x
=
1
<<
(
v
->
k_x
-
1
);
...
@@ -1158,11 +1112,11 @@ static int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
...
@@ -1158,11 +1112,11 @@ static int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
else
v
->
tt_index
=
2
;
else
v
->
tt_index
=
2
;
lowquant
=
(
v
->
pq
>
12
)
?
0
:
1
;
lowquant
=
(
v
->
pq
>
12
)
?
0
:
1
;
v
->
mv_mode
=
ff_vc1_mv_pmode_table
[
lowquant
][
get_
prefix
(
gb
,
1
,
4
)];
v
->
mv_mode
=
ff_vc1_mv_pmode_table
[
lowquant
][
get_
unary
(
gb
,
1
,
4
)];
if
(
v
->
mv_mode
==
MV_PMODE_INTENSITY_COMP
)
if
(
v
->
mv_mode
==
MV_PMODE_INTENSITY_COMP
)
{
{
int
scale
,
shift
,
i
;
int
scale
,
shift
,
i
;
v
->
mv_mode2
=
ff_vc1_mv_pmode_table2
[
lowquant
][
get_
prefix
(
gb
,
1
,
3
)];
v
->
mv_mode2
=
ff_vc1_mv_pmode_table2
[
lowquant
][
get_
unary
(
gb
,
1
,
3
)];
v
->
lumscale
=
get_bits
(
gb
,
6
);
v
->
lumscale
=
get_bits
(
gb
,
6
);
v
->
lumshift
=
get_bits
(
gb
,
6
);
v
->
lumshift
=
get_bits
(
gb
,
6
);
v
->
use_ic
=
1
;
v
->
use_ic
=
1
;
...
@@ -1305,7 +1259,7 @@ static int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
...
@@ -1305,7 +1259,7 @@ static int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
v
->
fcm
=
decode012
(
gb
);
v
->
fcm
=
decode012
(
gb
);
if
(
v
->
fcm
)
return
-
1
;
// interlaced frames/fields are not implemented
if
(
v
->
fcm
)
return
-
1
;
// interlaced frames/fields are not implemented
}
}
switch
(
get_
prefix
(
gb
,
0
,
4
))
{
switch
(
get_
unary
(
gb
,
0
,
4
))
{
case
0
:
case
0
:
v
->
s
.
pict_type
=
P_TYPE
;
v
->
s
.
pict_type
=
P_TYPE
;
break
;
break
;
...
@@ -1388,7 +1342,7 @@ static int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
...
@@ -1388,7 +1342,7 @@ static int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
case
P_TYPE
:
case
P_TYPE
:
if
(
v
->
postprocflag
)
if
(
v
->
postprocflag
)
v
->
postproc
=
get_bits1
(
gb
);
v
->
postproc
=
get_bits1
(
gb
);
if
(
v
->
extended_mv
)
v
->
mvrange
=
get_
prefix
(
gb
,
0
,
3
);
if
(
v
->
extended_mv
)
v
->
mvrange
=
get_
unary
(
gb
,
0
,
3
);
else
v
->
mvrange
=
0
;
else
v
->
mvrange
=
0
;
v
->
k_x
=
v
->
mvrange
+
9
+
(
v
->
mvrange
>>
1
);
//k_x can be 9 10 12 13
v
->
k_x
=
v
->
mvrange
+
9
+
(
v
->
mvrange
>>
1
);
//k_x can be 9 10 12 13
v
->
k_y
=
v
->
mvrange
+
8
;
//k_y can be 8 9 10 11
v
->
k_y
=
v
->
mvrange
+
8
;
//k_y can be 8 9 10 11
...
@@ -1400,11 +1354,11 @@ static int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
...
@@ -1400,11 +1354,11 @@ static int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
else
v
->
tt_index
=
2
;
else
v
->
tt_index
=
2
;
lowquant
=
(
v
->
pq
>
12
)
?
0
:
1
;
lowquant
=
(
v
->
pq
>
12
)
?
0
:
1
;
v
->
mv_mode
=
ff_vc1_mv_pmode_table
[
lowquant
][
get_
prefix
(
gb
,
1
,
4
)];
v
->
mv_mode
=
ff_vc1_mv_pmode_table
[
lowquant
][
get_
unary
(
gb
,
1
,
4
)];
if
(
v
->
mv_mode
==
MV_PMODE_INTENSITY_COMP
)
if
(
v
->
mv_mode
==
MV_PMODE_INTENSITY_COMP
)
{
{
int
scale
,
shift
,
i
;
int
scale
,
shift
,
i
;
v
->
mv_mode2
=
ff_vc1_mv_pmode_table2
[
lowquant
][
get_
prefix
(
gb
,
1
,
3
)];
v
->
mv_mode2
=
ff_vc1_mv_pmode_table2
[
lowquant
][
get_
unary
(
gb
,
1
,
3
)];
v
->
lumscale
=
get_bits
(
gb
,
6
);
v
->
lumscale
=
get_bits
(
gb
,
6
);
v
->
lumshift
=
get_bits
(
gb
,
6
);
v
->
lumshift
=
get_bits
(
gb
,
6
);
/* fill lookup tables for intensity compensation */
/* fill lookup tables for intensity compensation */
...
@@ -1479,7 +1433,7 @@ static int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
...
@@ -1479,7 +1433,7 @@ static int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
case
B_TYPE
:
case
B_TYPE
:
if
(
v
->
postprocflag
)
if
(
v
->
postprocflag
)
v
->
postproc
=
get_bits1
(
gb
);
v
->
postproc
=
get_bits1
(
gb
);
if
(
v
->
extended_mv
)
v
->
mvrange
=
get_
prefix
(
gb
,
0
,
3
);
if
(
v
->
extended_mv
)
v
->
mvrange
=
get_
unary
(
gb
,
0
,
3
);
else
v
->
mvrange
=
0
;
else
v
->
mvrange
=
0
;
v
->
k_x
=
v
->
mvrange
+
9
+
(
v
->
mvrange
>>
1
);
//k_x can be 9 10 12 13
v
->
k_x
=
v
->
mvrange
+
9
+
(
v
->
mvrange
>>
1
);
//k_x can be 9 10 12 13
v
->
k_y
=
v
->
mvrange
+
8
;
//k_y can be 8 9 10 11
v
->
k_y
=
v
->
mvrange
+
8
;
//k_y can be 8 9 10 11
...
@@ -2350,7 +2304,7 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value,
...
@@ -2350,7 +2304,7 @@ static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value,
if
(
!
v
->
s
.
esc3_level_length
)
if
(
!
v
->
s
.
esc3_level_length
)
v
->
s
.
esc3_level_length
=
get_bits
(
gb
,
2
)
+
8
;
v
->
s
.
esc3_level_length
=
get_bits
(
gb
,
2
)
+
8
;
}
else
{
//table 60
}
else
{
//table 60
v
->
s
.
esc3_level_length
=
get_
prefix
(
gb
,
1
,
6
)
+
2
;
v
->
s
.
esc3_level_length
=
get_
unary
(
gb
,
1
,
6
)
+
2
;
}
}
v
->
s
.
esc3_run_length
=
3
+
get_bits
(
gb
,
2
);
v
->
s
.
esc3_run_length
=
3
+
get_bits
(
gb
,
2
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment