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
ae60927a
Commit
ae60927a
authored
Aug 20, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libx264: only use ABR mode when the user explicitly set bitrate.
parent
03eff2bf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
libx264.c
libavcodec/libx264.c
+11
-6
No files found.
libavcodec/libx264.c
View file @
ae60927a
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "libavutil/opt.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "avcodec.h"
#include "internal.h"
#include <x264.h>
#include <x264.h>
#include <math.h>
#include <math.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -263,7 +264,10 @@ static av_cold int X264_init(AVCodecContext *avctx)
...
@@ -263,7 +264,10 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4
->
params
.
i_log_level
=
X264_LOG_DEBUG
;
x4
->
params
.
i_log_level
=
X264_LOG_DEBUG
;
x4
->
params
.
b_intra_refresh
=
avctx
->
flags2
&
CODEC_FLAG2_INTRA_REFRESH
;
x4
->
params
.
b_intra_refresh
=
avctx
->
flags2
&
CODEC_FLAG2_INTRA_REFRESH
;
if
(
avctx
->
bit_rate
)
{
x4
->
params
.
rc
.
i_bitrate
=
avctx
->
bit_rate
/
1000
;
x4
->
params
.
rc
.
i_bitrate
=
avctx
->
bit_rate
/
1000
;
x4
->
params
.
rc
.
i_rc_method
=
X264_RC_ABR
;
}
x4
->
params
.
rc
.
i_vbv_buffer_size
=
avctx
->
rc_buffer_size
/
1000
;
x4
->
params
.
rc
.
i_vbv_buffer_size
=
avctx
->
rc_buffer_size
/
1000
;
x4
->
params
.
rc
.
i_vbv_max_bitrate
=
avctx
->
rc_max_rate
/
1000
;
x4
->
params
.
rc
.
i_vbv_max_bitrate
=
avctx
->
rc_max_rate
/
1000
;
x4
->
params
.
rc
.
b_stat_write
=
avctx
->
flags
&
CODEC_FLAG_PASS1
;
x4
->
params
.
rc
.
b_stat_write
=
avctx
->
flags
&
CODEC_FLAG_PASS1
;
...
@@ -280,11 +284,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
...
@@ -280,11 +284,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
}
}
}
}
// if neither crf nor cqp modes are selected we have to enable the RC
// we do it this way because we cannot check if the bitrate has been set
if
(
!
(
avctx
->
crf
||
(
avctx
->
cqp
>
-
1
)))
x4
->
params
.
rc
.
i_rc_method
=
X264_RC_ABR
;
if
(
avctx
->
rc_buffer_size
&&
avctx
->
rc_initial_buffer_occupancy
&&
if
(
avctx
->
rc_buffer_size
&&
avctx
->
rc_initial_buffer_occupancy
&&
(
avctx
->
rc_initial_buffer_occupancy
<=
avctx
->
rc_buffer_size
))
{
(
avctx
->
rc_initial_buffer_occupancy
<=
avctx
->
rc_buffer_size
))
{
x4
->
params
.
rc
.
f_vbv_buffer_init
=
x4
->
params
.
rc
.
f_vbv_buffer_init
=
...
@@ -376,6 +375,11 @@ static const AVClass class = {
...
@@ -376,6 +375,11 @@ static const AVClass class = {
.
version
=
LIBAVUTIL_VERSION_INT
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
};
static
const
AVCodecDefault
x264_defaults
[]
=
{
{
"b"
,
"0"
},
{
NULL
},
};
AVCodec
ff_libx264_encoder
=
{
AVCodec
ff_libx264_encoder
=
{
.
name
=
"libx264"
,
.
name
=
"libx264"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
...
@@ -388,4 +392,5 @@ AVCodec ff_libx264_encoder = {
...
@@ -388,4 +392,5 @@ AVCodec ff_libx264_encoder = {
.
pix_fmts
=
(
const
enum
PixelFormat
[])
{
PIX_FMT_YUV420P
,
PIX_FMT_YUVJ420P
,
PIX_FMT_NONE
},
.
pix_fmts
=
(
const
enum
PixelFormat
[])
{
PIX_FMT_YUV420P
,
PIX_FMT_YUVJ420P
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"
),
.
priv_class
=
&
class
,
.
priv_class
=
&
class
,
.
defaults
=
x264_defaults
,
};
};
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