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
2a164b25
Commit
2a164b25
authored
Mar 25, 2002
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimizing mpeg4_encode_dc
Originally committed as revision 361 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
9c15096e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
1 deletion
+69
-1
h263.c
libavcodec/h263.c
+69
-1
No files found.
libavcodec/h263.c
View file @
2a164b25
...
...
@@ -57,6 +57,9 @@ static UINT16 mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
static
UINT8
fcode_tab
[
MAX_MV
*
2
+
1
];
static
UINT8
umv_fcode_tab
[
MAX_MV
*
2
+
1
];
static
UINT16
uni_DCtab_lum
[
512
][
2
];
static
UINT16
uni_DCtab_chrom
[
512
][
2
];
int
h263_get_picture_format
(
int
width
,
int
height
)
{
int
format
;
...
...
@@ -706,12 +709,67 @@ static void init_mv_penalty_and_fcode(MpegEncContext *s)
}
}
static
void
init_uni_dc_tab
()
{
int
level
,
uni_code
,
uni_len
;
for
(
level
=-
255
;
level
<
256
;
level
++
){
int
size
,
v
,
l
;
/* find number of bits */
size
=
0
;
v
=
abs
(
level
);
while
(
v
)
{
v
>>=
1
;
size
++
;
}
if
(
level
<
0
)
l
=
(
-
level
)
^
((
1
<<
size
)
-
1
);
else
l
=
level
;
/* luminance */
uni_code
=
DCtab_lum
[
size
][
0
];
uni_len
=
DCtab_lum
[
size
][
1
];
if
(
size
>
0
)
{
uni_code
<<=
size
;
uni_code
|=
l
;
uni_len
+=
size
;
if
(
size
>
8
){
uni_code
<<=
1
;
uni_code
|=
1
;
uni_len
++
;
}
}
uni_DCtab_lum
[
level
+
256
][
0
]
=
uni_code
;
uni_DCtab_lum
[
level
+
256
][
1
]
=
uni_len
;
/* chrominance */
uni_code
=
DCtab_chrom
[
size
][
0
];
uni_len
=
DCtab_chrom
[
size
][
1
];
if
(
size
>
0
)
{
uni_code
<<=
size
;
uni_code
|=
l
;
uni_len
+=
size
;
if
(
size
>
8
){
uni_code
<<=
1
;
uni_code
|=
1
;
uni_len
++
;
}
}
uni_DCtab_chrom
[
level
+
256
][
0
]
=
uni_code
;
uni_DCtab_chrom
[
level
+
256
][
1
]
=
uni_len
;
}
}
void
h263_encode_init
(
MpegEncContext
*
s
)
{
static
int
done
=
0
;
if
(
!
done
)
{
done
=
1
;
init_uni_dc_tab
();
init_rl
(
&
rl_inter
);
init_rl
(
&
rl_intra
);
...
...
@@ -1033,9 +1091,18 @@ static void mpeg4_inv_pred_ac(MpegEncContext * s, INT16 *block, int n,
}
}
static
inline
void
mpeg4_encode_dc
(
MpegEncContext
*
s
,
int
level
,
int
n
)
{
#if 1
level
+=
256
;
if
(
n
<
4
)
{
/* luminance */
put_bits
(
&
s
->
pb
,
uni_DCtab_lum
[
level
][
1
],
uni_DCtab_lum
[
level
][
0
]);
}
else
{
/* chrominance */
put_bits
(
&
s
->
pb
,
uni_DCtab_chrom
[
level
][
1
],
uni_DCtab_chrom
[
level
][
0
]);
}
#else
int
size
,
v
;
/* find number of bits */
size
=
0
;
...
...
@@ -1061,6 +1128,7 @@ static inline void mpeg4_encode_dc(MpegEncContext * s, int level, int n)
if
(
size
>
8
)
put_bits
(
&
s
->
pb
,
1
,
1
);
}
#endif
}
static
void
mpeg4_encode_block
(
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
,
int
intra_dc
,
UINT8
*
scan_table
)
...
...
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