Originally committed as revision 23038 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -2618,8 +2618,8 @@ enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex · 2617 unmodified lines | |||
| 2618 | enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg | 2618 | enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg |
| 2619 | enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg | 2619 | enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg |
| 2620 | enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm && | 2620 | enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm && |
| 2621 | { check_cpp_condition x264.h "X264_BUILD >= 83" || | 2621 | { check_cpp_condition x264.h "X264_BUILD >= 90" || |
| 2622 | die "ERROR: libx264 version must be >= 0.83."; } | 2622 | die "ERROR: libx264 version must be >= 0.90."; } |
| 2623 | enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore | 2623 | enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore |
| 2624 | enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib | 2624 | enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib |
| 2625 | 2625 | ||
| @@ -30,7 +30,7 @@ · 29 unmodified lines | |||
| 30 | #include "libavutil/avutil.h" | 30 | #include "libavutil/avutil.h" |
| 31 | 31 | ||
| 32 | #define LIBAVCODEC_VERSION_MAJOR 52 | 32 | #define LIBAVCODEC_VERSION_MAJOR 52 |
| 33 | #define LIBAVCODEC_VERSION_MINOR 66 | 33 | #define LIBAVCODEC_VERSION_MINOR 67 |
| 34 | #define LIBAVCODEC_VERSION_MICRO 0 | 34 | #define LIBAVCODEC_VERSION_MICRO 0 |
| 35 | 35 | ||
| 36 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 36 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| @@ -597,6 +597,7 @@ typedef struct RcOverride{ · 560 unmodified lines | |||
| 597 | #define CODEC_FLAG2_MBTREE 0x00040000 ///< Use macroblock tree ratecontrol (x264 only) | 597 | #define CODEC_FLAG2_MBTREE 0x00040000 ///< Use macroblock tree ratecontrol (x264 only) |
| 598 | #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations. | 598 | #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations. |
| 599 | #define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding, error[] values are undefined. | 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 | /* Unsupported options : | 602 | /* Unsupported options : |
| 602 | * Syntax Arithmetic coding (SAC) | 603 | * Syntax Arithmetic coding (SAC) |
| @@ -2646,6 +2647,15 @@ typedef struct AVCodecContext { · 2043 unmodified lines | |||
| 2646 | * - decoding: unused | 2647 | * - decoding: unused |
| 2647 | */ | 2648 | */ |
| 2648 | int rc_lookahead; | 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 | } AVCodecContext; | 2659 | } AVCodecContext; |
| 2650 | 2660 | ||
| 2651 | /** | 2661 | /** |
| @@ -156,6 +156,7 @@ static av_cold int X264_init(AVCodecContext *avctx) · 155 unmodified lines | |||
| 156 | x4->params.p_log_private = avctx; | 156 | x4->params.p_log_private = avctx; |
| 157 | 157 | ||
| 158 | x4->params.i_keyint_max = avctx->gop_size; | 158 | x4->params.i_keyint_max = avctx->gop_size; |
| 159 | x4->params.b_intra_refresh = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH; | ||
| 159 | x4->params.rc.i_bitrate = avctx->bit_rate / 1000; | 160 | x4->params.rc.i_bitrate = avctx->bit_rate / 1000; |
| 160 | x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000; | 161 | x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000; |
| 161 | x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000; | 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 | if (avctx->crf) { | 167 | if (avctx->crf) { |
| 167 | x4->params.rc.i_rc_method = X264_RC_CRF; | 168 | x4->params.rc.i_rc_method = X264_RC_CRF; |
| 168 | x4->params.rc.f_rf_constant = avctx->crf; | 169 | x4->params.rc.f_rf_constant = avctx->crf; |
| 170 | x4->params.rc.f_rf_constant_max = avctx->crf_max; | ||
| 169 | } else if (avctx->cqp > -1) { | 171 | } else if (avctx->cqp > -1) { |
| 170 | x4->params.rc.i_rc_method = X264_RC_CQP; | 172 | x4->params.rc.i_rc_method = X264_RC_CQP; |
| 171 | x4->params.rc.i_qp_constant = avctx->cqp; | 173 | x4->params.rc.i_qp_constant = avctx->cqp; |
| @@ -411,6 +411,8 @@ static const AVOption options[]={ · 410 unmodified lines | |||
| 411 | {"aq_strength", "specify aq strength", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, 1.0, 0, FLT_MAX, V|E}, | 411 | {"aq_strength", "specify aq strength", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, 1.0, 0, FLT_MAX, V|E}, |
| 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}, | 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 | {"ssim", "ssim will be calculated during encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_SSIM, INT_MIN, INT_MAX, V|E, "flags2"}, | 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 | {NULL}, | 416 | {NULL}, |
| 415 | }; | 417 | }; |
| 416 | 418 | ||