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
5f194811
Commit
5f194811
authored
Oct 30, 2003
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pts fix and related fixes
Originally committed as revision 2452 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
2a2bbcb0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
31 deletions
+32
-31
h263.c
libavcodec/h263.c
+4
-4
h263dec.c
libavcodec/h263dec.c
+6
-11
mpegvideo.c
libavcodec/mpegvideo.c
+21
-16
mpegvideo.h
libavcodec/mpegvideo.h
+1
-0
No files found.
libavcodec/h263.c
View file @
5f194811
...
...
@@ -1848,8 +1848,8 @@ void ff_mpeg4_stuffing(PutBitContext * pbc)
void
ff_set_mpeg4_time
(
MpegEncContext
*
s
,
int
picture_number
){
int
time_div
,
time_mod
;
if
(
s
->
current_picture
.
pts
)
s
->
time
=
(
s
->
current_picture
.
pts
*
s
->
time_increment_resolution
+
500
*
1000
)
/
(
1000
*
1000
);
if
(
s
->
current_picture
_ptr
->
pts
)
s
->
time
=
(
s
->
current_picture
_ptr
->
pts
*
s
->
time_increment_resolution
+
500
*
1000
)
/
(
1000
*
1000
);
else
s
->
time
=
av_rescale
(
picture_number
*
(
int64_t
)
s
->
avctx
->
frame_rate_base
,
s
->
time_increment_resolution
,
s
->
avctx
->
frame_rate
);
time_div
=
s
->
time
/
s
->
time_increment_resolution
;
...
...
@@ -4994,9 +4994,9 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
-
ROUNDED_DIV
(
s
->
last_non_b_time
-
s
->
pp_time
,
s
->
t_frame
))
*
2
;
}
s
->
current_picture
.
pts
=
s
->
time
*
1000LL
*
1000LL
/
s
->
time_increment_resolution
;
s
->
current_picture
_ptr
->
pts
=
s
->
time
*
1000LL
*
1000LL
/
s
->
time_increment_resolution
;
if
(
s
->
avctx
->
debug
&
FF_DEBUG_PTS
)
printf
(
"MPEG4 PTS: %f
\n
"
,
s
->
current_picture
.
pts
/
(
1000
.
0
*
1000
.
0
));
printf
(
"MPEG4 PTS: %f
\n
"
,
s
->
current_picture
_ptr
->
pts
/
(
1000
.
0
*
1000
.
0
));
check_marker
(
gb
,
"before vop_coded"
);
...
...
libavcodec/h263dec.c
View file @
5f194811
...
...
@@ -28,17 +28,6 @@
//#define DEBUG
//#define PRINT_FRAME_TIME
#ifdef PRINT_FRAME_TIME
static
inline
long
long
rdtsc
()
{
long
long
l
;
asm
volatile
(
"rdtsc
\n\t
"
:
"=A"
(
l
)
);
// printf("%d\n", int(l/1000));
return
l
;
}
#endif
int
ff_h263_decode_init
(
AVCodecContext
*
avctx
)
{
...
...
@@ -446,6 +435,12 @@ retry:
if
(
MPV_common_init
(
s
)
<
0
)
//we need the idct permutaton for reading a custom matrix
return
-
1
;
}
//we need to set current_picture_ptr before reading the header, otherwise we cant store anyting im there
if
(
s
->
current_picture_ptr
==
NULL
||
s
->
current_picture_ptr
->
data
[
0
]){
int
i
=
ff_find_unused_picture
(
s
,
0
);
s
->
current_picture_ptr
=
&
s
->
picture
[
i
];
}
/* let's go :-) */
if
(
s
->
msmpeg4_version
==
5
)
{
...
...
libavcodec/mpegvideo.c
View file @
5f194811
...
...
@@ -1014,32 +1014,33 @@ static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)
}
}
static
int
find_unused_picture
(
MpegEncContext
*
s
,
int
shared
){
int
ff_
find_unused_picture
(
MpegEncContext
*
s
,
int
shared
){
int
i
;
if
(
shared
){
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
){
if
(
s
->
picture
[
i
].
data
[
0
]
==
NULL
&&
s
->
picture
[
i
].
type
==
0
)
break
;
if
(
s
->
picture
[
i
].
data
[
0
]
==
NULL
&&
s
->
picture
[
i
].
type
==
0
)
return
i
;
}
}
else
{
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
){
if
(
s
->
picture
[
i
].
data
[
0
]
==
NULL
&&
s
->
picture
[
i
].
type
!=
0
)
break
;
//FIXME
if
(
s
->
picture
[
i
].
data
[
0
]
==
NULL
&&
s
->
picture
[
i
].
type
!=
0
)
return
i
;
//FIXME
}
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
){
if
(
s
->
picture
[
i
].
data
[
0
]
==
NULL
)
break
;
if
(
s
->
picture
[
i
].
data
[
0
]
==
NULL
)
return
i
;
}
}
assert
(
i
<
MAX_PICTURE_COUNT
);
return
i
;
assert
(
0
);
return
-
1
;
}
/* generic function for encode/decode called before a frame is coded/decoded */
/**
* generic function for encode/decode called after coding/decoding the header and before a frame is coded/decoded
*/
int
MPV_frame_start
(
MpegEncContext
*
s
,
AVCodecContext
*
avctx
)
{
int
i
;
AVFrame
*
pic
;
s
->
mb_skiped
=
0
;
assert
(
s
->
last_picture_ptr
==
NULL
||
s
->
out_format
!=
FMT_H264
||
s
->
codec_id
==
CODEC_ID_SVQ3
);
...
...
@@ -1068,18 +1069,22 @@ alloc:
}
}
i
=
find_unused_picture
(
s
,
0
);
pic
=
(
AVFrame
*
)
&
s
->
picture
[
i
];
if
(
s
->
current_picture_ptr
&&
s
->
current_picture_ptr
->
data
[
0
]
==
NULL
)
pic
=
(
AVFrame
*
)
s
->
current_picture_ptr
;
//we allready have a unused image (maybe it was set before reading the header)
else
{
i
=
ff_find_unused_picture
(
s
,
0
);
pic
=
(
AVFrame
*
)
&
s
->
picture
[
i
];
}
pic
->
reference
=
s
->
pict_type
!=
B_TYPE
?
3
:
0
;
if
(
s
->
current_picture_ptr
)
if
(
s
->
current_picture_ptr
)
//FIXME broken, we need a coded_picture_number in MpegEncContext
pic
->
coded_picture_number
=
s
->
current_picture_ptr
->
coded_picture_number
+
1
;
if
(
alloc_picture
(
s
,
(
Picture
*
)
pic
,
0
)
<
0
)
return
-
1
;
s
->
current_picture_ptr
=
&
s
->
picture
[
i
]
;
s
->
current_picture_ptr
=
(
Picture
*
)
pic
;
}
s
->
current_picture_ptr
->
pict_type
=
s
->
pict_type
;
...
...
@@ -1425,7 +1430,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){
// printf("%d %d %d %d\n",pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize);
if
(
direct
){
i
=
find_unused_picture
(
s
,
1
);
i
=
f
f_f
ind_unused_picture
(
s
,
1
);
pic
=
(
AVFrame
*
)
&
s
->
picture
[
i
];
pic
->
reference
=
3
;
...
...
@@ -1437,7 +1442,7 @@ static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){
alloc_picture
(
s
,
(
Picture
*
)
pic
,
1
);
}
else
{
int
offset
=
16
;
i
=
find_unused_picture
(
s
,
0
);
i
=
f
f_f
ind_unused_picture
(
s
,
0
);
pic
=
(
AVFrame
*
)
&
s
->
picture
[
i
];
pic
->
reference
=
3
;
...
...
@@ -1587,7 +1592,7 @@ static void select_input_picture(MpegEncContext *s){
if
(
s
->
reordered_input_picture
[
0
]
->
type
==
FF_BUFFER_TYPE_SHARED
){
// input is a shared pix, so we cant modifiy it -> alloc a new one & ensure that the shared one is reuseable
int
i
=
find_unused_picture
(
s
,
0
);
int
i
=
f
f_f
ind_unused_picture
(
s
,
0
);
Picture
*
pic
=
&
s
->
picture
[
i
];
/* mark us unused / free shared pic */
...
...
libavcodec/mpegvideo.h
View file @
5f194811
...
...
@@ -718,6 +718,7 @@ int ff_combine_frame( MpegEncContext *s, int next, uint8_t **buf, int *buf_size)
void
ff_mpeg_flush
(
AVCodecContext
*
avctx
);
void
ff_print_debug_info
(
MpegEncContext
*
s
,
Picture
*
pict
);
void
ff_write_quant_matrix
(
PutBitContext
*
pb
,
int16_t
*
matrix
);
int
ff_find_unused_picture
(
MpegEncContext
*
s
,
int
shared
);
void
ff_er_frame_start
(
MpegEncContext
*
s
);
void
ff_er_frame_end
(
MpegEncContext
*
s
);
...
...
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