diff options
author | James Zern <jzern@google.com> | 2013-11-03 00:20:19 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-03 00:35:15 +0100 |
commit | 517afd72c6772f69671d913f03f4be89dd1dd665 (patch) | |
tree | d3a0fcd50419d3a247d9f6593c26b9d21ac15c69 | |
parent | e87043bb1fbc707e9d057a1d5b12792a20a6e59d (diff) | |
download | ffmpeg-517afd72c6772f69671d913f03f4be89dd1dd665.tar.gz |
libvpxenc: add VP9 options
same as their vpxenc equivalents:
-lossless
-tile-columns
-tile-rows
-frame-parallel
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/libvpxenc.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 69eef1b0e1..23736ea815 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -89,6 +89,12 @@ typedef struct VP8EncoderContext { int error_resilient; int crf; int max_intra_rate; + + // VP9-only + int lossless; + int tile_columns; + int tile_rows; + int frame_parallel; } VP8Context; /** String mappings for enum vp8e_enc_control_id */ @@ -111,6 +117,12 @@ static const char *const ctlidstr[] = { [VP8E_SET_ARNR_TYPE] = "VP8E_SET_ARNR_TYPE", [VP8E_SET_CQ_LEVEL] = "VP8E_SET_CQ_LEVEL", [VP8E_SET_MAX_INTRA_BITRATE_PCT] = "VP8E_SET_MAX_INTRA_BITRATE_PCT", +#if CONFIG_LIBVPX_VP9_ENCODER + [VP9E_SET_LOSSLESS] = "VP9E_SET_LOSSLESS", + [VP9E_SET_TILE_COLUMNS] = "VP9E_SET_TILE_COLUMNS", + [VP9E_SET_TILE_ROWS] = "VP9E_SET_TILE_ROWS", + [VP9E_SET_FRAME_PARALLEL_DECODING] = "VP9E_SET_FRAME_PARALLEL_DECODING", +#endif }; static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) @@ -421,6 +433,19 @@ static av_cold int vpx_init(AVCodecContext *avctx, if (ctx->max_intra_rate >= 0) codecctl_int(avctx, VP8E_SET_MAX_INTRA_BITRATE_PCT, ctx->max_intra_rate); +#if CONFIG_LIBVPX_VP9_ENCODER + if (avctx->codec_id == AV_CODEC_ID_VP9) { + if (ctx->lossless >= 0) + codecctl_int(avctx, VP9E_SET_LOSSLESS, ctx->lossless); + if (ctx->tile_columns >= 0) + codecctl_int(avctx, VP9E_SET_TILE_COLUMNS, ctx->tile_columns); + if (ctx->tile_rows >= 0) + codecctl_int(avctx, VP9E_SET_TILE_ROWS, ctx->tile_rows); + if (ctx->frame_parallel >= 0) + codecctl_int(avctx, VP9E_SET_FRAME_PARALLEL_DECODING, ctx->frame_parallel); + } +#endif + av_log(avctx, AV_LOG_DEBUG, "Using deadline: %d\n", ctx->deadline); //provide dummy value to initialize wrapper, values will be updated each _encode() @@ -771,6 +796,10 @@ static const AVOption vp8_options[] = { #if CONFIG_LIBVPX_VP9_ENCODER static const AVOption vp9_options[] = { COMMON_OPTIONS + { "lossless", "Lossless mode", OFFSET(lossless), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VE}, + { "tile-columns", "Number of tile columns to use, log2", OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE}, + { "tile-rows", "Number of tile rows to use, log2", OFFSET(tile_rows), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 2, VE}, + { "frame-parallel", "Enable frame parallel decodability features", OFFSET(frame_parallel), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VE}, LEGACY_OPTIONS { NULL } }; |