Originally committed as revision 23038 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavcodec (3 of 4 files). Show all
Unified · Split
| @@ -30,7 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "libavutil/avutil.h" |
| 31 | 31 | |
| 32 | 32 | #define LIBAVCODEC_VERSION_MAJOR 52 |
| 33 | −#define LIBAVCODEC_VERSION_MINOR 66 | |
| 33 | +#define LIBAVCODEC_VERSION_MINOR 67 | |
| 34 | 34 | #define LIBAVCODEC_VERSION_MICRO 0 |
| 35 | 35 | |
| 36 | 36 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| @@ -597,6 +597,7 @@ typedef struct RcOverride{ · 560 unmodified lines | ||
| 597 | 597 | #define CODEC_FLAG2_MBTREE 0x00040000 ///< Use macroblock tree ratecontrol (x264 only) |
| 598 | 598 | #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations. |
| 599 | 599 | #define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding, error[] values are undefined. |
| 600 | +#define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of intra blocks instead of keyframes. | |
| 600 | 601 | |
| 601 | 602 | /* Unsupported options : |
| 602 | 603 | * Syntax Arithmetic coding (SAC) |
| @@ -2646,6 +2647,15 @@ typedef struct AVCodecContext { · 2043 unmodified lines | ||
| 2646 | 2647 | * - decoding: unused |
| 2647 | 2648 | */ |
| 2648 | 2649 | int rc_lookahead; |
| 2650 | + | |
| 2651 | + /** | |
| 2652 | + * Constant rate factor maximum | |
| 2653 | + * With CRF encoding mode and VBV restrictions enabled, prevents quality from being worse | |
| 2654 | + * than crf_max, even if doing so would violate VBV restrictions. | |
| 2655 | + * - encoding: Set by user. | |
| 2656 | + * - decoding: unused | |
| 2657 | + */ | |
| 2658 | + float crf_max; | |
| 2649 | 2659 | } AVCodecContext; |
| 2650 | 2660 | |
| 2651 | 2661 | /** |
| @@ -156,6 +156,7 @@ static av_cold int X264_init(AVCodecContext *avctx) · 155 unmodified lines | ||
| 156 | 156 | x4->params.p_log_private = avctx; |
| 157 | 157 | |
| 158 | 158 | x4->params.i_keyint_max = avctx->gop_size; |
| 159 | + x4->params.b_intra_refresh = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH; | |
| 159 | 160 | x4->params.rc.i_bitrate = avctx->bit_rate / 1000; |
| 160 | 161 | x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000; |
| 161 | 162 | x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000; |
| @@ -166,6 +167,7 @@ static av_cold int X264_init(AVCodecContext *avctx) · 4 unmodified lines | ||
| 166 | 167 | if (avctx->crf) { |
| 167 | 168 | x4->params.rc.i_rc_method = X264_RC_CRF; |
| 168 | 169 | x4->params.rc.f_rf_constant = avctx->crf; |
| 170 | + x4->params.rc.f_rf_constant_max = avctx->crf_max; | |
| 169 | 171 | } else if (avctx->cqp > -1) { |
| 170 | 172 | x4->params.rc.i_rc_method = X264_RC_CQP; |
| 171 | 173 | x4->params.rc.i_qp_constant = avctx->cqp; |
| @@ -411,6 +411,8 @@ static const AVOption options[]={ · 410 unmodified lines | ||
| 411 | 411 | {"aq_strength", "specify aq strength", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, 1.0, 0, FLT_MAX, V|E}, |
| 412 | 412 | {"rc_lookahead", "specify number of frames to look ahead for frametype", OFFSET(rc_lookahead), FF_OPT_TYPE_INT, 40, 0, INT_MAX, V|E}, |
| 413 | 413 | {"ssim", "ssim will be calculated during encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_SSIM, INT_MIN, INT_MAX, V|E, "flags2"}, |
| 414 | +{"intra_refresh", "use periodic insertion of intra blocks instead of keyframes", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_REFRESH, INT_MIN, INT_MAX, V|E, "flags2"}, | |
| 415 | +{"crf_max", "in crf mode, prevents vbv from lowering quality beyond this point", OFFSET(crf_max), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 51, V|E}, | |
| 414 | 416 | {NULL}, |
| 415 | 417 | }; |
| 416 | 418 | |