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
d930ef19
Commit
d930ef19
authored
Aug 02, 2002
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing mpeg4 mpeg quantizers
Originally committed as revision 836 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
fc2bb4f4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
18 deletions
+31
-18
h263.c
libavcodec/h263.c
+18
-11
mpegvideo.c
libavcodec/mpegvideo.c
+12
-7
mpegvideo.h
libavcodec/mpegvideo.h
+1
-0
No files found.
libavcodec/h263.c
View file @
d930ef19
...
...
@@ -1452,9 +1452,11 @@ void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n,
/* left copy */
for
(
i
=
1
;
i
<
8
;
i
++
)
ac_val1
[
i
]
=
block
[
block_permute_op
(
i
*
8
)];
/* top copy */
for
(
i
=
1
;
i
<
8
;
i
++
)
ac_val1
[
8
+
i
]
=
block
[
block_permute_op
(
i
)];
}
static
void
mpeg4_inv_pred_ac
(
MpegEncContext
*
s
,
INT16
*
block
,
int
n
,
...
...
@@ -2641,6 +2643,7 @@ int h263_decode_mb(MpegEncContext *s,
case
0
:
/* direct */
mx
=
h263_decode_motion
(
s
,
0
,
1
);
my
=
h263_decode_motion
(
s
,
0
,
1
);
PRINT_MB_TYPE
(
"S"
);
case
4
:
/* direct with mx=my=0 */
s
->
mv_dir
=
MV_DIR_FORWARD
|
MV_DIR_BACKWARD
|
MV_DIRECT
;
xy
=
s
->
block_index
[
0
];
...
...
@@ -2659,7 +2662,7 @@ int h263_decode_mb(MpegEncContext *s,
s->mv[0][0][1] =
s->mv[1][0][0] =
s->mv[1][0][1] = 1000;*/
PRINT_MB_TYPE
(
"D"
);
if
(
mb_type
==
4
)
PRINT_MB_TYPE
(
"D"
);
break
;
case
1
:
s
->
mv_dir
=
MV_DIR_FORWARD
|
MV_DIR_BACKWARD
;
...
...
@@ -2701,13 +2704,14 @@ int h263_decode_mb(MpegEncContext *s,
dquant
=
cbpc
&
4
;
s
->
mb_intra
=
1
;
intra:
PRINT_MB_TYPE
(
"I"
);
s
->
ac_pred
=
0
;
if
(
s
->
h263_pred
||
s
->
h263_aic
)
{
s
->
ac_pred
=
get_bits1
(
&
s
->
gb
);
if
(
s
->
ac_pred
&&
s
->
h263_aic
)
s
->
h263_aic_dir
=
get_bits1
(
&
s
->
gb
);
}
PRINT_MB_TYPE
(
s
->
ac_pred
?
"A"
:
"I"
);
cbpy
=
get_vlc2
(
&
s
->
gb
,
cbpy_vlc
.
table
,
CBPY_VLC_BITS
,
1
);
if
(
cbpy
<
0
)
return
-
1
;
cbp
=
(
cbpc
&
3
)
|
(
cbpy
<<
2
);
...
...
@@ -2995,10 +2999,16 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
return
0
;
}
rl
=
&
rl_inter
;
rl_vlc
=
rl_inter
.
rl_vlc
[
s
->
qscale
];
scan_table
=
zigzag_direct
;
if
(
s
->
mpeg_quant
){
qmul
=
1
;
qadd
=
0
;
rl_vlc
=
rl_inter
.
rl_vlc
[
0
];
}
else
{
qmul
=
s
->
qscale
<<
1
;
qadd
=
(
s
->
qscale
-
1
)
|
1
;
rl_vlc
=
rl_inter
.
rl_vlc
[
s
->
qscale
];
}
}
{
OPEN_READER
(
re
,
&
s
->
gb
);
...
...
@@ -3615,8 +3625,9 @@ int mpeg4_decode_picture_header(MpegEncContext * s)
// FIXME a bunch of grayscale shape things
if
(
get_bits1
(
&
s
->
gb
)){
/* vol_quant_type */
if
(
(
s
->
mpeg_quant
=
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
];
...
...
@@ -3659,11 +3670,8 @@ int mpeg4_decode_picture_header(MpegEncContext * s)
}
}
s
->
dct_unquantize
=
s
->
dct_unquantize_mpeg2
;
// 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
);
...
...
@@ -3758,7 +3766,6 @@ int mpeg4_decode_picture_header(MpegEncContext * s)
s
->
low_delay
=
0
;
}
// printf("pic: %d, qpel:%d\n", s->pict_type, s->quarter_sample);
//printf("%d", s->pict_type);
time_incr
=
0
;
while
(
get_bits1
(
&
s
->
gb
)
!=
0
)
time_incr
++
;
...
...
libavcodec/mpegvideo.c
View file @
d930ef19
...
...
@@ -137,11 +137,6 @@ int MPV_common_init(MpegEncContext *s)
#ifdef ARCH_ALPHA
MPV_common_init_axp
(
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_mpeg1
;
s
->
mb_width
=
(
s
->
width
+
15
)
/
16
;
s
->
mb_height
=
(
s
->
height
+
15
)
/
16
;
...
...
@@ -671,6 +666,16 @@ void MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
avctx
->
dr_opaque_frame
=
s
->
next_dr_opaque
;
}
}
/* set dequantizer, we cant do it during init as it might change for mpeg4
and we cant do it in the header decode as init isnt called for mpeg4 there yet */
if
(
s
->
out_format
==
FMT_H263
){
if
(
s
->
mpeg_quant
)
s
->
dct_unquantize
=
s
->
dct_unquantize_mpeg2
;
else
s
->
dct_unquantize
=
s
->
dct_unquantize_h263
;
}
else
s
->
dct_unquantize
=
s
->
dct_unquantize_mpeg1
;
}
/* generic function for encode/decode called after a frame has been coded/decoded */
...
...
@@ -1513,7 +1518,7 @@ void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
if
(
s
->
hurry_up
>
1
)
goto
the_end
;
/* add dct residue */
if
(
s
->
encoding
||
!
(
s
->
mpeg2
||
s
->
h263_msmpeg4
||
s
->
codec_id
==
CODEC_ID_MPEG4
)){
if
(
s
->
encoding
||
!
(
s
->
mpeg2
||
s
->
h263_msmpeg4
||
(
s
->
codec_id
==
CODEC_ID_MPEG4
&&
!
s
->
mpeg_quant
)
)){
add_dequant_dct
(
s
,
block
[
0
],
0
,
dest_y
,
dct_linesize
);
add_dequant_dct
(
s
,
block
[
1
],
1
,
dest_y
+
8
,
dct_linesize
);
add_dequant_dct
(
s
,
block
[
2
],
2
,
dest_y
+
dct_offset
,
dct_linesize
);
...
...
libavcodec/mpegvideo.h
View file @
d930ef19
...
...
@@ -361,6 +361,7 @@ typedef struct MpegEncContext {
#define PB_BUFFER_SIZE 1024*256
uint8_t
*
tex_pb_buffer
;
uint8_t
*
pb2_buffer
;
int
mpeg_quant
;
/* divx specific, used to workaround (many) bugs in divx5 */
int
divx_version
;
...
...
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