Commit b6a0b8bc authored by Deb Mukherjee's avatar Deb Mukherjee Committed by James Almer

Adds support for setting aq_mode in libvpx encoder

Reviewed-by: 's avatarJames Zern <jzern@google.com>
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 8c1b942a
...@@ -1330,7 +1330,7 @@ ffmpeg -i INPUT -codec:v libtheora -b:v 1000k OUTPUT.ogg ...@@ -1330,7 +1330,7 @@ ffmpeg -i INPUT -codec:v libtheora -b:v 1000k OUTPUT.ogg
@section libvpx @section libvpx
VP8 format supported through libvpx. VP8/VP9 format supported through libvpx.
Requires the presence of the libvpx headers and library during configuration. Requires the presence of the libvpx headers and library during configuration.
You need to explicitly configure the build with @code{--enable-libvpx}. You need to explicitly configure the build with @code{--enable-libvpx}.
...@@ -1442,6 +1442,9 @@ g_lag_in_frames ...@@ -1442,6 +1442,9 @@ g_lag_in_frames
@item vp8flags error_resilient @item vp8flags error_resilient
g_error_resilient g_error_resilient
@item aq_mode
@code{VP9E_SET_AQ_MODE}
@end table @end table
For more information about libvpx see: For more information about libvpx see:
......
...@@ -96,6 +96,7 @@ typedef struct VP8EncoderContext { ...@@ -96,6 +96,7 @@ typedef struct VP8EncoderContext {
int tile_columns; int tile_columns;
int tile_rows; int tile_rows;
int frame_parallel; int frame_parallel;
int aq_mode;
} VP8Context; } VP8Context;
/** String mappings for enum vp8e_enc_control_id */ /** String mappings for enum vp8e_enc_control_id */
...@@ -123,6 +124,7 @@ static const char *const ctlidstr[] = { ...@@ -123,6 +124,7 @@ static const char *const ctlidstr[] = {
[VP9E_SET_TILE_COLUMNS] = "VP9E_SET_TILE_COLUMNS", [VP9E_SET_TILE_COLUMNS] = "VP9E_SET_TILE_COLUMNS",
[VP9E_SET_TILE_ROWS] = "VP9E_SET_TILE_ROWS", [VP9E_SET_TILE_ROWS] = "VP9E_SET_TILE_ROWS",
[VP9E_SET_FRAME_PARALLEL_DECODING] = "VP9E_SET_FRAME_PARALLEL_DECODING", [VP9E_SET_FRAME_PARALLEL_DECODING] = "VP9E_SET_FRAME_PARALLEL_DECODING",
[VP9E_SET_AQ_MODE] = "VP9E_SET_AQ_MODE",
#endif #endif
}; };
...@@ -444,6 +446,8 @@ static av_cold int vpx_init(AVCodecContext *avctx, ...@@ -444,6 +446,8 @@ static av_cold int vpx_init(AVCodecContext *avctx,
codecctl_int(avctx, VP9E_SET_TILE_ROWS, ctx->tile_rows); codecctl_int(avctx, VP9E_SET_TILE_ROWS, ctx->tile_rows);
if (ctx->frame_parallel >= 0) if (ctx->frame_parallel >= 0)
codecctl_int(avctx, VP9E_SET_FRAME_PARALLEL_DECODING, ctx->frame_parallel); codecctl_int(avctx, VP9E_SET_FRAME_PARALLEL_DECODING, ctx->frame_parallel);
if (ctx->aq_mode >= 0)
codecctl_int(avctx, VP9E_SET_AQ_MODE, ctx->aq_mode);
} }
#endif #endif
...@@ -803,6 +807,11 @@ static const AVOption vp9_options[] = { ...@@ -803,6 +807,11 @@ static const AVOption vp9_options[] = {
{ "tile-columns", "Number of tile columns to use, log2", OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, 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}, { "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}, { "frame-parallel", "Enable frame parallel decodability features", OFFSET(frame_parallel), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VE},
{ "aq-mode", "adaptive quantization mode", OFFSET(aq_mode), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 3, VE, "aq_mode"},
{ "none", "Aq not used", 0, AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 0, VE, "aq_mode" }, \
{ "variance", "Variance based Aq", 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 0, VE, "aq_mode" }, \
{ "complexity", "Complexity based Aq", 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 0, VE, "aq_mode" }, \
{ "cyclic", "Cyclic Refresh Aq", 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, VE, "aq_mode" }, \
LEGACY_OPTIONS LEGACY_OPTIONS
{ NULL } { NULL }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment