History

Fix broken vbv_buffer_init handling in libx264.c

Due to being pants-on-head retarded, libavcodec defaults this to zero, which results in broken output. This didn't affect ffmpeg.c, which sets it itself, but caused problems for other calling apps using VBV. (cherry picked from commit f7f8120fb9a06b5d7fbf5add48a0d8464319a332)

Jason Garrett-Glaser committed 15 years ago

Commit 2c855ce1 parent a1b0a3c1 file · +2 −3Browse files

Unified · Split

libavcodec/libx264.c+2−3
@@ -277,12 +277,11 @@ static av_cold int X264_init(AVCodecContext *avctx) · 276 unmodified lines
277 if (avctx->level > 0)277 if (avctx->level > 0)
278 x4->params.i_level_idc = avctx->level;278 x4->params.i_level_idc = avctx->level;
279 279
280 if ((avctx->rc_buffer_size != 0) &&280 if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy &&
281 (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {281 (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {
282 x4->params.rc.f_vbv_buffer_init =282 x4->params.rc.f_vbv_buffer_init =
283 (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;283 (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
284 } else284 }
285 x4->params.rc.f_vbv_buffer_init = 0.9;
286 285
287 x4->params.rc.b_mb_tree = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);286 x4->params.rc.b_mb_tree = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
288 x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);287 x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t