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
4d69fbc9
Commit
4d69fbc9
authored
Mar 28, 2002
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
force frame type for 2-pass encoding
Originally committed as revision 365 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
649c00c9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
avcodec.h
libavcodec/avcodec.h
+2
-0
mpegvideo.c
libavcodec/mpegvideo.c
+4
-3
mpegvideo.h
libavcodec/mpegvideo.h
+1
-0
No files found.
libavcodec/avcodec.h
View file @
4d69fbc9
...
...
@@ -120,6 +120,8 @@ typedef struct AVCodecContext {
int
qmin
;
/* min qscale */
int
qmax
;
/* max qscale */
int
max_qdiff
;
/* max qscale difference between frames */
int
force_type
;
/* 0= no force, otherwise I_TYPE, P_TYPE, ... */
struct
AVCodec
*
codec
;
void
*
priv_data
;
...
...
libavcodec/mpegvideo.c
View file @
4d69fbc9
...
...
@@ -514,9 +514,10 @@ int MPV_encode_picture(AVCodecContext *avctx,
init_put_bits
(
&
s
->
pb
,
buf
,
buf_size
,
NULL
,
NULL
);
s
->
force_type
=
avctx
->
force_type
;
if
(
!
s
->
intra_only
)
{
/* first picture of GOP is intra */
if
(
s
->
picture_in_gop_number
%
s
->
gop_size
==
0
){
if
(
s
->
picture_in_gop_number
%
s
->
gop_size
==
0
||
s
->
force_type
==
I_TYPE
){
s
->
picture_in_gop_number
=
0
;
s
->
pict_type
=
I_TYPE
;
}
else
...
...
@@ -1313,7 +1314,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
memset
(
s
->
mb_type
,
MB_TYPE_INTRA
,
sizeof
(
UINT8
)
*
s
->
mb_width
*
s
->
mb_height
);
}
if
(
s
->
avg_mb_var
<
s
->
mc_mb_var
&&
s
->
pict_type
!=
B_TYPE
){
//FIXME subtract MV bits
if
(
s
->
avg_mb_var
<
s
->
mc_mb_var
&&
s
->
pict_type
!=
B_TYPE
&&
(
!
s
->
force_type
)
){
//FIXME subtract MV bits
s
->
pict_type
=
I_TYPE
;
s
->
picture_in_gop_number
=
0
;
memset
(
s
->
mb_type
,
MB_TYPE_INTRA
,
sizeof
(
UINT8
)
*
s
->
mb_width
*
s
->
mb_height
);
...
...
@@ -1955,7 +1956,7 @@ static int rate_estimate_qscale(MpegEncContext *s)
double
fps
;
INT64
wanted_bits
;
emms_c
();
fps
=
(
double
)
s
->
frame_rate
/
FRAME_RATE_BASE
;
wanted_bits
=
s
->
bit_rate
*
(
double
)
s
->
picture_number
/
fps
;
...
...
libavcodec/mpegvideo.h
View file @
4d69fbc9
...
...
@@ -66,6 +66,7 @@ typedef struct MpegEncContext {
int
max_qdiff
;
/* max qscale difference between frames */
int
encoding
;
/* true if we are encoding (vs decoding) */
int
flags
;
/* AVCodecContext.flags (HQ, MV4, ...) */
int
force_type
;
/* 0= no force, otherwise I_TYPE, P_TYPE, ... */
/* the following fields are managed internally by the encoder */
/* bit output */
...
...
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