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
3bf43d42
Commit
3bf43d42
authored
Apr 07, 2002
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpeg4 mpeg quantizer support
Originally committed as revision 381 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
e1a9dbff
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
18 deletions
+99
-18
dsputil.c
libavcodec/dsputil.c
+4
-0
h263.c
libavcodec/h263.c
+55
-8
mpegvideo_mmx.c
libavcodec/i386/mpegvideo_mmx.c
+3
-5
mpeg4data.h
libavcodec/mpeg4data.h
+24
-0
mpegvideo.c
libavcodec/mpegvideo.c
+8
-4
mpegvideo.h
libavcodec/mpegvideo.h
+5
-1
No files found.
libavcodec/dsputil.c
View file @
3bf43d42
...
...
@@ -47,6 +47,8 @@ UINT32 squareTbl[512];
extern
UINT16
default_intra_matrix
[
64
];
extern
UINT16
default_non_intra_matrix
[
64
];
extern
UINT16
ff_mpeg4_default_intra_matrix
[
64
];
extern
UINT16
ff_mpeg4_default_non_intra_matrix
[
64
];
UINT8
zigzag_direct
[
64
]
=
{
0
,
1
,
8
,
16
,
9
,
2
,
3
,
10
,
...
...
@@ -953,6 +955,8 @@ void dsputil_init(void)
}
block_permute
(
default_intra_matrix
);
block_permute
(
default_non_intra_matrix
);
block_permute
(
ff_mpeg4_default_intra_matrix
);
block_permute
(
ff_mpeg4_default_non_intra_matrix
);
}
build_zigzag_end
();
...
...
libavcodec/h263.c
View file @
3bf43d42
...
...
@@ -624,17 +624,14 @@ static void h263_encode_motion(MpegEncContext * s, int val)
}
if
(
val
>=
0
)
{
val
--
;
code
=
(
val
>>
bit_size
)
+
1
;
bits
=
val
&
(
range
-
1
);
sign
=
0
;
}
else
{
val
=
-
val
;
val
--
;
code
=
(
val
>>
bit_size
)
+
1
;
bits
=
val
&
(
range
-
1
);
sign
=
1
;
}
val
--
;
code
=
(
val
>>
bit_size
)
+
1
;
bits
=
val
&
(
range
-
1
);
put_bits
(
&
s
->
pb
,
mvtab
[
code
][
1
]
+
1
,
(
mvtab
[
code
][
0
]
<<
1
)
|
sign
);
if
(
bit_size
>
0
)
{
...
...
@@ -728,7 +725,7 @@ static void init_uni_dc_tab()
{
int
level
,
uni_code
,
uni_len
;
for
(
level
=-
25
5
;
level
<
256
;
level
++
){
for
(
level
=-
25
6
;
level
<
256
;
level
++
){
int
size
,
v
,
l
;
/* find number of bits */
size
=
0
;
...
...
@@ -2509,7 +2506,57 @@ int mpeg4_decode_picture_header(MpegEncContext * s)
}
// FIXME a bunch of grayscale shape things
if
(
get_bits1
(
&
s
->
gb
))
printf
(
"Quant-Type not supported
\n
"
);
/* vol_quant_type */
//FIXME
if
(
get_bits1
(
&
s
->
gb
)){
/* vol_quant_type */
int
i
,
j
,
v
;
/* load default matrixes */
for
(
i
=
0
;
i
<
64
;
i
++
){
v
=
ff_mpeg4_default_intra_matrix
[
i
];
s
->
intra_matrix
[
i
]
=
v
;
s
->
chroma_intra_matrix
[
i
]
=
v
;
v
=
ff_mpeg4_default_non_intra_matrix
[
i
];
s
->
non_intra_matrix
[
i
]
=
v
;
s
->
chroma_non_intra_matrix
[
i
]
=
v
;
}
/* load custom intra matrix */
if
(
get_bits1
(
&
s
->
gb
)){
for
(
i
=
0
;
i
<
64
;
i
++
){
v
=
get_bits
(
&
s
->
gb
,
8
);
if
(
v
==
0
)
break
;
j
=
zigzag_direct
[
i
];
s
->
intra_matrix
[
j
]
=
v
;
s
->
chroma_intra_matrix
[
j
]
=
v
;
}
}
/* load custom non intra matrix */
if
(
get_bits1
(
&
s
->
gb
)){
for
(
i
=
0
;
i
<
64
;
i
++
){
v
=
get_bits
(
&
s
->
gb
,
8
);
if
(
v
==
0
)
break
;
j
=
zigzag_direct
[
i
];
s
->
non_intra_matrix
[
j
]
=
v
;
s
->
chroma_non_intra_matrix
[
j
]
=
v
;
}
/* replicate last value */
for
(;
i
<
64
;
i
++
){
j
=
zigzag_direct
[
i
];
s
->
non_intra_matrix
[
j
]
=
v
;
s
->
chroma_non_intra_matrix
[
j
]
=
v
;
}
}
s
->
dct_unquantize
=
s
->
dct_unquantize_mpeg
;
// FIXME a bunch of grayscale shape things
}
else
s
->
dct_unquantize
=
s
->
dct_unquantize_h263
;
if
(
vo_ver_id
!=
1
)
s
->
quarter_sample
=
get_bits1
(
&
s
->
gb
);
else
s
->
quarter_sample
=
0
;
...
...
libavcodec/i386/mpegvideo_mmx.c
View file @
3bf43d42
...
...
@@ -440,11 +440,9 @@ void unused_var_warning_killer(){
void
MPV_common_init_mmx
(
MpegEncContext
*
s
)
{
if
(
mm_flags
&
MM_MMX
)
{
if
(
s
->
out_format
==
FMT_H263
)
s
->
dct_unquantize
=
dct_unquantize_h263_mmx
;
else
s
->
dct_unquantize
=
dct_unquantize_mpeg1_mmx
;
s
->
dct_unquantize_h263
=
dct_unquantize_h263_mmx
;
s
->
dct_unquantize_mpeg
=
dct_unquantize_mpeg1_mmx
;
draw_edges
=
draw_edges_mmx
;
if
(
mm_flags
&
MM_MMXEXT
){
...
...
libavcodec/mpeg4data.h
View file @
3bf43d42
...
...
@@ -122,3 +122,27 @@ static const UINT16 pixel_aspect[16][2]={
{
0
,
0
},
{
0
,
0
},
};
/* these matrixes will be permuted for the idct */
INT16
ff_mpeg4_default_intra_matrix
[
64
]
=
{
8
,
17
,
18
,
19
,
21
,
23
,
25
,
27
,
17
,
18
,
19
,
21
,
23
,
25
,
27
,
28
,
20
,
21
,
22
,
23
,
24
,
26
,
28
,
30
,
21
,
22
,
23
,
24
,
26
,
28
,
30
,
32
,
22
,
23
,
24
,
26
,
28
,
30
,
32
,
35
,
23
,
24
,
26
,
28
,
30
,
32
,
35
,
38
,
25
,
26
,
28
,
30
,
32
,
35
,
38
,
41
,
27
,
28
,
30
,
32
,
35
,
38
,
41
,
45
,
};
INT16
ff_mpeg4_default_non_intra_matrix
[
64
]
=
{
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
,
19
,
20
,
21
,
22
,
23
,
24
,
26
,
27
,
20
,
21
,
22
,
23
,
25
,
26
,
27
,
28
,
21
,
22
,
23
,
24
,
26
,
27
,
28
,
30
,
22
,
23
,
24
,
26
,
27
,
28
,
30
,
31
,
23
,
24
,
25
,
27
,
28
,
30
,
31
,
33
,
};
libavcodec/mpegvideo.c
View file @
3bf43d42
...
...
@@ -110,14 +110,18 @@ int MPV_common_init(MpegEncContext *s)
int
c_size
,
i
;
UINT8
*
pict
;
if
(
s
->
out_format
==
FMT_H263
)
s
->
dct_unquantize
=
dct_unquantize_h263_c
;
else
s
->
dct_unquantize
=
dct_unquantize_mpeg1_c
;
s
->
dct_unquantize_h263
=
dct_unquantize_h263_c
;
s
->
dct_unquantize_mpeg
=
dct_unquantize_mpeg1_c
;
#ifdef HAVE_MMX
MPV_common_init_mmx
(
s
);
#endif
//setup default unquantizers (mpeg4 might change it later)
if
(
s
->
out_format
==
FMT_H263
)
s
->
dct_unquantize
=
s
->
dct_unquantize_h263
;
else
s
->
dct_unquantize
=
s
->
dct_unquantize_mpeg
;
s
->
mb_width
=
(
s
->
width
+
15
)
/
16
;
s
->
mb_height
=
(
s
->
height
+
15
)
/
16
;
s
->
mb_num
=
s
->
mb_width
*
s
->
mb_height
;
...
...
libavcodec/mpegvideo.h
View file @
3bf43d42
...
...
@@ -309,7 +309,11 @@ typedef struct MpegEncContext {
DCTELEM
intra_block
[
6
][
64
]
__align8
;
DCTELEM
inter_block
[
6
][
64
]
__align8
;
DCTELEM
inter4v_block
[
6
][
64
]
__align8
;
void
(
*
dct_unquantize
)(
struct
MpegEncContext
*
s
,
void
(
*
dct_unquantize_mpeg
)(
struct
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
,
int
qscale
);
void
(
*
dct_unquantize_h263
)(
struct
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
,
int
qscale
);
void
(
*
dct_unquantize
)(
struct
MpegEncContext
*
s
,
// unquantizer to use (mpeg4 can use both)
DCTELEM
*
block
,
int
n
,
int
qscale
);
}
MpegEncContext
;
...
...
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