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
a990a308
Commit
a990a308
authored
Sep 11, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ratecontrol: correct predictor in case of stuffing
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
2fe8fd39
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
1 deletion
+4
-1
mpegvideo.h
libavcodec/mpegvideo.h
+1
-0
mpegvideo_enc.c
libavcodec/mpegvideo_enc.c
+1
-0
ratecontrol.c
libavcodec/ratecontrol.c
+2
-1
No files found.
libavcodec/mpegvideo.h
View file @
a990a308
...
@@ -469,6 +469,7 @@ typedef struct MpegEncContext {
...
@@ -469,6 +469,7 @@ typedef struct MpegEncContext {
/* bit rate control */
/* bit rate control */
int64_t
total_bits
;
int64_t
total_bits
;
int
frame_bits
;
///< bits used for the current frame
int
frame_bits
;
///< bits used for the current frame
int
stuffing_bits
;
///< bits used for stuffing
int
next_lambda
;
///< next lambda used for retrying to encode a frame
int
next_lambda
;
///< next lambda used for retrying to encode a frame
RateControlContext
rc_context
;
///< contains stuff only accessed in ratecontrol.c
RateControlContext
rc_context
;
///< contains stuff only accessed in ratecontrol.c
...
...
libavcodec/mpegvideo_enc.c
View file @
a990a308
...
@@ -1579,6 +1579,7 @@ vbv_retry:
...
@@ -1579,6 +1579,7 @@ vbv_retry:
s
->
frame_bits
=
put_bits_count
(
&
s
->
pb
);
s
->
frame_bits
=
put_bits_count
(
&
s
->
pb
);
stuffing_count
=
ff_vbv_update
(
s
,
s
->
frame_bits
);
stuffing_count
=
ff_vbv_update
(
s
,
s
->
frame_bits
);
s
->
stuffing_bits
=
8
*
stuffing_count
;
if
(
stuffing_count
)
{
if
(
stuffing_count
)
{
if
(
s
->
pb
.
buf_end
-
s
->
pb
.
buf
-
(
put_bits_count
(
&
s
->
pb
)
>>
3
)
<
if
(
s
->
pb
.
buf_end
-
s
->
pb
.
buf
-
(
put_bits_count
(
&
s
->
pb
)
>>
3
)
<
stuffing_count
+
50
)
{
stuffing_count
+
50
)
{
...
...
libavcodec/ratecontrol.c
View file @
a990a308
...
@@ -679,7 +679,8 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
...
@@ -679,7 +679,8 @@ float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
/* update predictors */
/* update predictors */
if
(
picture_number
>
2
&&
!
dry_run
){
if
(
picture_number
>
2
&&
!
dry_run
){
const
int
last_var
=
s
->
last_pict_type
==
AV_PICTURE_TYPE_I
?
rcc
->
last_mb_var_sum
:
rcc
->
last_mc_mb_var_sum
;
const
int
last_var
=
s
->
last_pict_type
==
AV_PICTURE_TYPE_I
?
rcc
->
last_mb_var_sum
:
rcc
->
last_mc_mb_var_sum
;
update_predictor
(
&
rcc
->
pred
[
s
->
last_pict_type
],
rcc
->
last_qscale
,
sqrt
(
last_var
),
s
->
frame_bits
);
av_assert1
(
s
->
frame_bits
>=
s
->
stuffing_bits
);
update_predictor
(
&
rcc
->
pred
[
s
->
last_pict_type
],
rcc
->
last_qscale
,
sqrt
(
last_var
),
s
->
frame_bits
-
s
->
stuffing_bits
);
}
}
if
(
s
->
flags
&
CODEC_FLAG_PASS2
){
if
(
s
->
flags
&
CODEC_FLAG_PASS2
){
...
...
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