Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
4704097a
Commit
4704097a
authored
May 13, 2003
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimizations
Originally committed as revision 1867 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
f138f883
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
138 additions
and
37 deletions
+138
-37
golomb.c
libavcodec/golomb.c
+57
-0
golomb.h
libavcodec/golomb.h
+42
-20
h264.c
libavcodec/h264.c
+32
-17
svq3.c
libavcodec/svq3.c
+7
-0
No files found.
libavcodec/golomb.c
View file @
4704097a
...
...
@@ -95,3 +95,60 @@ const uint8_t ff_ue_golomb_len[256]={
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
15
,
17
,
};
const
uint8_t
ff_interleaved_golomb_vlc_len
[
256
]
=
{
9
,
9
,
7
,
7
,
9
,
9
,
7
,
7
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
9
,
9
,
7
,
7
,
9
,
9
,
7
,
7
,
5
,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
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
};
libavcodec/golomb.h
View file @
4704097a
...
...
@@ -32,6 +32,10 @@ extern const uint8_t ff_ue_golomb_vlc_code[512];
extern
const
int8_t
ff_se_golomb_vlc_code
[
512
];
extern
const
uint8_t
ff_ue_golomb_len
[
256
];
extern
const
uint8_t
ff_interleaved_golomb_vlc_len
[
256
];
extern
const
uint8_t
ff_interleaved_ue_golomb_vlc_code
[
256
];
extern
const
int8_t
ff_interleaved_se_golomb_vlc_code
[
256
];
/**
* read unsigned exp golomb code.
...
...
@@ -62,24 +66,33 @@ static inline int get_ue_golomb(GetBitContext *gb){
}
static
inline
int
svq3_get_ue_golomb
(
GetBitContext
*
gb
){
u
nsigned
in
t
buf
;
u
int32_
t
buf
;
int
log
;
OPEN_READER
(
re
,
gb
);
UPDATE_CACHE
(
re
,
gb
);
buf
=
GET_CACHE
(
re
,
gb
)
|
1
;
if
((
buf
&
0xAAAAAAAA
)
==
0
)
return
INVALID_VLC
;
buf
=
GET_CACHE
(
re
,
gb
);
if
(
buf
&
0xAA800000
){
buf
>>=
32
-
8
;
LAST_SKIP_BITS
(
re
,
gb
,
ff_interleaved_golomb_vlc_len
[
buf
]);
CLOSE_READER
(
re
,
gb
);
return
ff_interleaved_ue_golomb_vlc_code
[
buf
];
}
else
{
buf
|=
1
;
if
((
buf
&
0xAAAAAAAA
)
==
0
)
return
INVALID_VLC
;
for
(
log
=
31
;
(
buf
&
0x80000000
)
==
0
;
log
--
){
buf
=
(
buf
<<
2
)
-
((
buf
<<
log
)
>>
(
log
-
1
))
+
(
buf
>>
30
);
}
for
(
log
=
31
;
(
buf
&
0x80000000
)
==
0
;
log
--
){
buf
=
(
buf
<<
2
)
-
((
buf
<<
log
)
>>
(
log
-
1
))
+
(
buf
>>
30
);
}
LAST_SKIP_BITS
(
re
,
gb
,
63
-
2
*
log
);
CLOSE_READER
(
re
,
gb
);
LAST_SKIP_BITS
(
re
,
gb
,
63
-
2
*
log
);
CLOSE_READER
(
re
,
gb
);
return
((
buf
<<
log
)
>>
log
)
-
1
;
return
((
buf
<<
log
)
>>
log
)
-
1
;
}
}
/**
...
...
@@ -141,19 +154,28 @@ static inline int svq3_get_se_golomb(GetBitContext *gb){
OPEN_READER
(
re
,
gb
);
UPDATE_CACHE
(
re
,
gb
);
buf
=
GET_CACHE
(
re
,
gb
)
|
1
;
buf
=
GET_CACHE
(
re
,
gb
);
if
((
buf
&
0xAAAAAAAA
)
==
0
)
return
INVALID_VLC
;
if
(
buf
&
0xAA800000
){
buf
>>=
32
-
8
;
LAST_SKIP_BITS
(
re
,
gb
,
ff_interleaved_golomb_vlc_len
[
buf
]);
CLOSE_READER
(
re
,
gb
);
return
ff_interleaved_se_golomb_vlc_code
[
buf
];
}
else
{
buf
|=
1
;
if
((
buf
&
0xAAAAAAAA
)
==
0
)
return
INVALID_VLC
;
for
(
log
=
31
;
(
buf
&
0x80000000
)
==
0
;
log
--
){
buf
=
(
buf
<<
2
)
-
((
buf
<<
log
)
>>
(
log
-
1
))
+
(
buf
>>
30
);
}
for
(
log
=
31
;
(
buf
&
0x80000000
)
==
0
;
log
--
){
buf
=
(
buf
<<
2
)
-
((
buf
<<
log
)
>>
(
log
-
1
))
+
(
buf
>>
30
);
}
LAST_SKIP_BITS
(
re
,
gb
,
63
-
2
*
log
);
CLOSE_READER
(
re
,
gb
);
LAST_SKIP_BITS
(
re
,
gb
,
63
-
2
*
log
);
CLOSE_READER
(
re
,
gb
);
return
(
signed
)
(((((
buf
<<
log
)
>>
log
)
-
1
)
^
-
(
buf
&
0x1
))
+
1
)
>>
1
;
return
(
signed
)
(((((
buf
<<
log
)
>>
log
)
-
1
)
^
-
(
buf
&
0x1
))
+
1
)
>>
1
;
}
}
#ifdef TRACE
...
...
libavcodec/h264.c
View file @
4704097a
...
...
@@ -2278,13 +2278,19 @@ static void hl_decode_mb(H264Context *h){
if
(
!
IS_INTRA4x4
(
mb_type
)){
for
(
i
=
0
;
i
<
16
;
i
++
){
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]
]
||
h
->
mb
[
i
*
16
]){
//FIXME benchmark weird rule, & below
uint8_t
*
const
ptr
=
dest_y
+
h
->
block_offset
[
i
];
if
(
s
->
codec_id
==
CODEC_ID_H264
)
if
(
s
->
codec_id
==
CODEC_ID_H264
){
for
(
i
=
0
;
i
<
16
;
i
++
){
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]
]
||
h
->
mb
[
i
*
16
]){
//FIXME benchmark weird rule, & below
uint8_t
*
const
ptr
=
dest_y
+
h
->
block_offset
[
i
];
h264_add_idct_c
(
ptr
,
h
->
mb
+
i
*
16
,
linesize
);
else
}
}
}
else
{
for
(
i
=
0
;
i
<
16
;
i
++
){
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]
]
||
h
->
mb
[
i
*
16
]){
//FIXME benchmark weird rule, & below
uint8_t
*
const
ptr
=
dest_y
+
h
->
block_offset
[
i
];
svq3_add_idct_c
(
ptr
,
h
->
mb
+
i
*
16
,
linesize
,
s
->
qscale
,
IS_INTRA
(
mb_type
)
?
1
:
0
);
}
}
}
}
...
...
@@ -2292,22 +2298,31 @@ static void hl_decode_mb(H264Context *h){
if
(
!
(
s
->
flags
&
CODEC_FLAG_GRAY
)){
chroma_dc_dequant_idct_c
(
h
->
mb
+
16
*
16
,
h
->
chroma_qp
);
chroma_dc_dequant_idct_c
(
h
->
mb
+
16
*
16
+
4
*
16
,
h
->
chroma_qp
);
for
(
i
=
16
;
i
<
16
+
4
;
i
++
){
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]
]
||
h
->
mb
[
i
*
16
]
){
uint8_t
*
const
ptr
=
dest_cb
+
h
->
block_offset
[
i
];
if
(
s
->
codec_id
==
CODEC_ID_H264
)
if
(
s
->
codec_id
==
CODEC_ID_H264
){
for
(
i
=
16
;
i
<
16
+
4
;
i
++
){
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]
]
||
h
->
mb
[
i
*
16
]){
uint8_t
*
const
ptr
=
dest_cb
+
h
->
block_offset
[
i
];
h264_add_idct_c
(
ptr
,
h
->
mb
+
i
*
16
,
uvlinesize
);
else
svq3_add_idct_c
(
ptr
,
h
->
mb
+
i
*
16
,
uvlinesize
,
chroma_qp
[
s
->
qscale
+
12
]
-
12
,
2
);
}
}
}
for
(
i
=
20
;
i
<
20
+
4
;
i
++
){
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]
]
||
h
->
mb
[
i
*
16
]){
uint8_t
*
const
ptr
=
dest_cr
+
h
->
block_offset
[
i
];
if
(
s
->
codec_id
==
CODEC_ID_H264
)
for
(
i
=
20
;
i
<
20
+
4
;
i
++
){
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]
]
||
h
->
mb
[
i
*
16
]){
uint8_t
*
const
ptr
=
dest_cr
+
h
->
block_offset
[
i
];
h264_add_idct_c
(
ptr
,
h
->
mb
+
i
*
16
,
uvlinesize
);
else
}
}
}
else
{
for
(
i
=
16
;
i
<
16
+
4
;
i
++
){
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]
]
||
h
->
mb
[
i
*
16
]){
uint8_t
*
const
ptr
=
dest_cb
+
h
->
block_offset
[
i
];
svq3_add_idct_c
(
ptr
,
h
->
mb
+
i
*
16
,
uvlinesize
,
chroma_qp
[
s
->
qscale
+
12
]
-
12
,
2
);
}
}
for
(
i
=
20
;
i
<
20
+
4
;
i
++
){
if
(
h
->
non_zero_count_cache
[
scan8
[
i
]
]
||
h
->
mb
[
i
*
16
]){
uint8_t
*
const
ptr
=
dest_cr
+
h
->
block_offset
[
i
];
svq3_add_idct_c
(
ptr
,
h
->
mb
+
i
*
16
,
uvlinesize
,
chroma_qp
[
s
->
qscale
+
12
]
-
12
,
2
);
}
}
}
}
...
...
libavcodec/svq3.c
View file @
4704097a
...
...
@@ -729,6 +729,13 @@ static int svq3_decode_frame (AVCodecContext *avctx,
while
(
get_bits
(
&
s
->
gb
,
1
))
{
get_bits
(
&
s
->
gb
,
8
);
}
if
(
avctx
->
debug
&
FF_DEBUG_PICT_INFO
){
printf
(
"%c hpel:%d, tpel:%d aqp:%d qp:%d
\n
"
,
ff_get_pict_type_char
(
s
->
pict_type
),
h
->
halfpel_flag
,
h
->
thirdpel_flag
,
s
->
adaptive_quant
,
s
->
qscale
);
}
/* B-frames are not supported */
if
(
s
->
pict_type
==
B_TYPE
/* && avctx->hurry_up*/
)
...
...
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