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
4e17946f
Commit
4e17946f
authored
Apr 27, 2015
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegvideo: Rework various functions not to use MpegEncContext directly
parent
a3f4c930
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
21 deletions
+22
-21
h263dec.c
libavcodec/h263dec.c
+1
-1
mpegvideo.c
libavcodec/mpegvideo.c
+17
-17
mpegvideo.h
libavcodec/mpegvideo.h
+2
-1
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+2
-2
No files found.
libavcodec/h263dec.c
View file @
4e17946f
...
...
@@ -463,7 +463,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
}
if
(
!
s
->
current_picture_ptr
||
s
->
current_picture_ptr
->
f
->
data
[
0
])
{
int
i
=
ff_find_unused_picture
(
s
,
0
);
int
i
=
ff_find_unused_picture
(
s
->
avctx
,
s
->
picture
,
0
);
if
(
i
<
0
)
return
i
;
s
->
current_picture_ptr
=
&
s
->
picture
[
i
];
...
...
libavcodec/mpegvideo.c
View file @
4e17946f
...
...
@@ -1612,18 +1612,18 @@ av_cold void ff_init_vlc_rl(RLTable *rl)
}
}
static
void
release_unused_pictures
(
MpegEncContext
*
s
)
static
void
release_unused_pictures
(
AVCodecContext
*
avctx
,
Picture
*
picture
)
{
int
i
;
/* release non reference frames */
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
)
{
if
(
!
s
->
picture
[
i
].
reference
)
ff_mpeg_unref_picture
(
s
->
avctx
,
&
s
->
picture
[
i
]);
if
(
!
picture
[
i
].
reference
)
ff_mpeg_unref_picture
(
avctx
,
&
picture
[
i
]);
}
}
static
inline
int
pic_is_unused
(
MpegEncContext
*
s
,
Picture
*
pic
)
static
inline
int
pic_is_unused
(
Picture
*
pic
)
{
if
(
!
pic
->
f
->
buf
[
0
])
return
1
;
...
...
@@ -1632,18 +1632,18 @@ static inline int pic_is_unused(MpegEncContext *s, Picture *pic)
return
0
;
}
static
int
find_unused_picture
(
MpegEncContext
*
s
,
int
shared
)
static
int
find_unused_picture
(
Picture
*
picture
,
int
shared
)
{
int
i
;
if
(
shared
)
{
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
)
{
if
(
!
s
->
picture
[
i
].
f
->
buf
[
0
])
if
(
!
picture
[
i
].
f
->
buf
[
0
])
return
i
;
}
}
else
{
for
(
i
=
0
;
i
<
MAX_PICTURE_COUNT
;
i
++
)
{
if
(
pic_is_unused
(
s
,
&
s
->
picture
[
i
]))
if
(
pic_is_unused
(
&
picture
[
i
]))
return
i
;
}
}
...
...
@@ -1651,15 +1651,15 @@ static int find_unused_picture(MpegEncContext *s, int shared)
return
AVERROR_INVALIDDATA
;
}
int
ff_find_unused_picture
(
MpegEncContext
*
s
,
int
shared
)
int
ff_find_unused_picture
(
AVCodecContext
*
avctx
,
Picture
*
picture
,
int
shared
)
{
int
ret
=
find_unused_picture
(
s
,
shared
);
int
ret
=
find_unused_picture
(
picture
,
shared
);
if
(
ret
>=
0
&&
ret
<
MAX_PICTURE_COUNT
)
{
if
(
s
->
picture
[
ret
].
needs_realloc
)
{
s
->
picture
[
ret
].
needs_realloc
=
0
;
ff_free_picture_tables
(
&
s
->
picture
[
ret
]);
ff_mpeg_unref_picture
(
s
->
avctx
,
&
s
->
picture
[
ret
]);
if
(
picture
[
ret
].
needs_realloc
)
{
picture
[
ret
].
needs_realloc
=
0
;
ff_free_picture_tables
(
&
picture
[
ret
]);
ff_mpeg_unref_picture
(
avctx
,
&
picture
[
ret
]);
}
}
return
ret
;
...
...
@@ -1697,14 +1697,14 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
ff_mpeg_unref_picture
(
s
->
avctx
,
&
s
->
current_picture
);
release_unused_pictures
(
s
);
release_unused_pictures
(
s
->
avctx
,
s
->
picture
);
if
(
s
->
current_picture_ptr
&&
!
s
->
current_picture_ptr
->
f
->
buf
[
0
])
{
// we already have a unused image
// (maybe it was set before reading the header)
pic
=
s
->
current_picture_ptr
;
}
else
{
i
=
ff_find_unused_picture
(
s
,
0
);
i
=
ff_find_unused_picture
(
s
->
avctx
,
s
->
picture
,
0
);
if
(
i
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"no frame buffer available
\n
"
);
return
i
;
...
...
@@ -1771,7 +1771,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
"allocate dummy last picture for field based first keyframe
\n
"
);
/* Allocate a dummy frame */
i
=
ff_find_unused_picture
(
s
,
0
);
i
=
ff_find_unused_picture
(
s
->
avctx
,
s
->
picture
,
0
);
if
(
i
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"no frame buffer available
\n
"
);
return
i
;
...
...
@@ -1801,7 +1801,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
if
((
!
s
->
next_picture_ptr
||
!
s
->
next_picture_ptr
->
f
->
buf
[
0
])
&&
s
->
pict_type
==
AV_PICTURE_TYPE_B
)
{
/* Allocate a dummy frame */
i
=
ff_find_unused_picture
(
s
,
0
);
i
=
ff_find_unused_picture
(
s
->
avctx
,
s
->
picture
,
0
);
if
(
i
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"no frame buffer available
\n
"
);
return
i
;
...
...
libavcodec/mpegvideo.h
View file @
4e17946f
...
...
@@ -742,7 +742,8 @@ void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h);
void
ff_mpeg_flush
(
AVCodecContext
*
avctx
);
void
ff_print_debug_info
(
MpegEncContext
*
s
,
Picture
*
p
);
void
ff_write_quant_matrix
(
PutBitContext
*
pb
,
uint16_t
*
matrix
);
int
ff_find_unused_picture
(
MpegEncContext
*
s
,
int
shared
);
int
ff_find_unused_picture
(
AVCodecContext
*
avctx
,
Picture
*
picture
,
int
shared
);
int
ff_update_duplicate_context
(
MpegEncContext
*
dst
,
MpegEncContext
*
src
);
int
ff_mpeg_update_thread_context
(
AVCodecContext
*
dst
,
const
AVCodecContext
*
src
);
void
ff_set_qscale
(
MpegEncContext
*
s
,
int
qscale
);
...
...
libavcodec/mpegvideo_enc.c
View file @
4e17946f
...
...
@@ -994,7 +994,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
ff_dlog
(
s
->
avctx
,
"%d %d %td %td
\n
"
,
pic_arg
->
linesize
[
0
],
pic_arg
->
linesize
[
1
],
s
->
linesize
,
s
->
uvlinesize
);
i
=
ff_find_unused_picture
(
s
,
direct
);
i
=
ff_find_unused_picture
(
s
->
avctx
,
s
->
picture
,
direct
);
if
(
i
<
0
)
return
i
;
...
...
@@ -1379,7 +1379,7 @@ no_output_pic:
// one & ensure that the shared one is reuseable
Picture
*
pic
;
int
i
=
ff_find_unused_picture
(
s
,
0
);
int
i
=
ff_find_unused_picture
(
s
->
avctx
,
s
->
picture
,
0
);
if
(
i
<
0
)
return
i
;
pic
=
&
s
->
picture
[
i
];
...
...
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