Re: [FFmpeg-devel] [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows

2018-08-31 Thread Kagami Hiiragi
On 31/08/18 18:18, James Almer wrote:
> On 8/31/2018 11:52 AM, Kagami Hiiragi wrote:
>> On 31/08/18 02:58, James Almer wrote:
>>> On 8/20/2018 2:56 PM, Kagami Hiiragi wrote:
>>>> These options are required for multithreaded encoding, because they set
>>>> to zero by default in av1_cx_iface.c.
>>>>
>>>> Signed-off-by: Kagami Hiiragi 
>>>>
>>>> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
>>>> index 9431179886..55cb7ff72e 100644
>>>> --- a/libavcodec/libaomenc.c
>>>> +++ b/libavcodec/libaomenc.c
>>>> @@ -68,6 +68,8 @@ typedef struct AOMEncoderContext {
>>>>  int static_thresh;
>>>>  int drop_threshold;
>>>>  int noise_sensitivity;
>>>> +int tile_columns;
>>>> +int tile_rows;
>>>>  } AOMContext;
>>>>  
>>>>  static const char *const ctlidstr[] = {
>>>> @@ -75,6 +77,8 @@ static const char *const ctlidstr[] = {
>>>>  [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
>>>>  [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
>>>>  [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
>>>> +[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
>>>> +[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
>>>>  [AV1E_SET_COLOR_RANGE]  = "AV1E_SET_COLOR_RANGE",
>>>>  [AV1E_SET_COLOR_PRIMARIES]  = "AV1E_SET_COLOR_PRIMARIES",
>>>>  [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
>>>> @@ -449,6 +453,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
>>>>  if (ctx->crf >= 0)
>>>>  codecctl_int(avctx, AOME_SET_CQ_LEVEL,  ctx->crf);
>>>>  
>>>> +if (ctx->tile_columns >= 0)
>>>> +codecctl_int(avctx, AV1E_SET_TILE_COLUMNS, ctx->tile_columns);
>>>> +if (ctx->tile_rows >= 0)
>>>> +codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows);
>>>> +
>>>>  codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries);
>>>>  codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);
>>>>  codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, 
>>>> avctx->color_trc);
>>>> @@ -746,6 +755,8 @@ static const AVOption options[] = {
>>>>  { "static-thresh","A change threshold on blocks below which they 
>>>> will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { 
>>>> .i64 = 0 }, 0, INT_MAX, VE },
>>>>  { "drop-threshold",   "Frame drop threshold", offsetof(AOMContext, 
>>>> drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
>>>>  { "noise-sensitivity", "Noise sensitivity", 
>>>> OFFSET(noise_sensitivity), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE},
>>>> +{ "tile-columns", "Number of tile columns to use, log2", 
>>>> OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
>>>
>>> Why 6? The libaom API doesn't mention a limit, just says the argument
>>> should be in log2 unit, and that it will be capped based on the image size.
>>
>> https://aomedia.googlesource.com/aom/+/1742b043e2269dc1927afe428fbf5a46493e741e/av1/av1_cx_iface.c#298
>>  
>>>> +{ "tile-rows", "Number of tile rows to use, log2", OFFSET(tile_rows), 
>>>> AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
>>>
>>> And for this one it says the range is [0-2].
>>
>> Who says it? I can pass --tile-rows=6 to aomenc.
> 
> The doxy in the public header:
> https://aomedia.googlesource.com/aom/+/master/aom/aomcx.h#312

I guess it wasn't fixed after
https://aomedia.googlesource.com/aom/+/492c545fad1e1f980d23d79d0372857c60d31458^!/#F1

I don't think ffmpeg should deal with libaom documentation issues...
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows

2018-08-31 Thread Kagami Hiiragi
On 31/08/18 02:58, James Almer wrote:
> On 8/20/2018 2:56 PM, Kagami Hiiragi wrote:
>> These options are required for multithreaded encoding, because they set
>> to zero by default in av1_cx_iface.c.
>>
>> Signed-off-by: Kagami Hiiragi 
>>
>> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
>> index 9431179886..55cb7ff72e 100644
>> --- a/libavcodec/libaomenc.c
>> +++ b/libavcodec/libaomenc.c
>> @@ -68,6 +68,8 @@ typedef struct AOMEncoderContext {
>>  int static_thresh;
>>  int drop_threshold;
>>  int noise_sensitivity;
>> +int tile_columns;
>> +int tile_rows;
>>  } AOMContext;
>>  
>>  static const char *const ctlidstr[] = {
>> @@ -75,6 +77,8 @@ static const char *const ctlidstr[] = {
>>  [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
>>  [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
>>  [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
>> +[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
>> +[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
>>  [AV1E_SET_COLOR_RANGE]  = "AV1E_SET_COLOR_RANGE",
>>  [AV1E_SET_COLOR_PRIMARIES]  = "AV1E_SET_COLOR_PRIMARIES",
>>  [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
>> @@ -449,6 +453,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
>>  if (ctx->crf >= 0)
>>  codecctl_int(avctx, AOME_SET_CQ_LEVEL,  ctx->crf);
>>  
>> +if (ctx->tile_columns >= 0)
>> +codecctl_int(avctx, AV1E_SET_TILE_COLUMNS, ctx->tile_columns);
>> +if (ctx->tile_rows >= 0)
>> +codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows);
>> +
>>  codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries);
>>  codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);
>>  codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, 
>> avctx->color_trc);
>> @@ -746,6 +755,8 @@ static const AVOption options[] = {
>>  { "static-thresh","A change threshold on blocks below which they 
>> will be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { 
>> .i64 = 0 }, 0, INT_MAX, VE },
>>  { "drop-threshold",   "Frame drop threshold", offsetof(AOMContext, 
>> drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
>>  { "noise-sensitivity", "Noise sensitivity", OFFSET(noise_sensitivity), 
>> AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, VE},
>> +{ "tile-columns", "Number of tile columns to use, log2", 
>> OFFSET(tile_columns), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
> 
> Why 6? The libaom API doesn't mention a limit, just says the argument
> should be in log2 unit, and that it will be capped based on the image size.

https://aomedia.googlesource.com/aom/+/1742b043e2269dc1927afe428fbf5a46493e741e/av1/av1_cx_iface.c#298
 
>> +{ "tile-rows", "Number of tile rows to use, log2", OFFSET(tile_rows), 
>> AV_OPT_TYPE_INT, {.i64 = -1}, -1, 6, VE},
> 
> And for this one it says the range is [0-2].

Who says it? I can pass --tile-rows=6 to aomenc.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc/libaomenc: Add -tile-columns/-tile-rows

2018-08-20 Thread Kagami Hiiragi
These options are required for multithreaded encoding, because they set
to zero by default in av1_cx_iface.c.

Signed-off-by: Kagami Hiiragi 

diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 9431179886..55cb7ff72e 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -68,6 +68,8 @@ typedef struct AOMEncoderContext {
 int static_thresh;
 int drop_threshold;
 int noise_sensitivity;
+int tile_columns;
+int tile_rows;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -75,6 +77,8 @@ static const char *const ctlidstr[] = {
 [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL",
 [AOME_SET_ENABLEAUTOALTREF] = "AOME_SET_ENABLEAUTOALTREF",
 [AOME_SET_STATIC_THRESHOLD] = "AOME_SET_STATIC_THRESHOLD",
+[AV1E_SET_TILE_COLUMNS] = "AV1E_SET_TILE_COLUMNS",
+[AV1E_SET_TILE_ROWS]= "AV1E_SET_TILE_ROWS",
 [AV1E_SET_COLOR_RANGE]  = "AV1E_SET_COLOR_RANGE",
 [AV1E_SET_COLOR_PRIMARIES]  = "AV1E_SET_COLOR_PRIMARIES",
 [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS",
@@ -449,6 +453,11 @@ static av_cold int aom_init(AVCodecContext *avctx,
 if (ctx->crf >= 0)
 codecctl_int(avctx, AOME_SET_CQ_LEVEL,  ctx->crf);
 
+if (ctx->tile_columns >= 0)
+codecctl_int(avctx, AV1E_SET_TILE_COLUMNS, ctx->tile_columns);
+if (ctx->tile_rows >= 0)
+codecctl_int(avctx, AV1E_SET_TILE_ROWS, ctx->tile_rows);
+
 codecctl_int(avctx, AV1E_SET_COLOR_PRIMARIES, avctx->color_primaries);
 codecctl_int(avctx, AV1E_SET_MATRIX_COEFFICIENTS, avctx->colorspace);
 codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, avctx->color_trc);
@@ -746,6 +755,8 @@ static const AVOption options[] = {
 { "static-thresh","A change threshold on blocks below which they will 
be skipped by the encoder", OFFSET(static_thresh), AV_OPT_TYPE_INT, { .i64 = 0 
}, 0, INT_MAX, VE },
 { "drop-threshold",   "Frame drop threshold", offsetof(AOMContext, 
drop_threshold), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, VE },
 { "noise-sensitivity", "Noise sensitivity", OFFSET(noise_sensitivity), 
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 4, 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, 6, VE},
 { NULL }
 };
 
-- 
2.18.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavf/matroska: Allow AV1 in WebM

2018-08-20 Thread Kagami Hiiragi
Nothing prevents it to work except this check. AV1 is already supported
by Matroska muxer and aomenc produces WebM/AV1 files as well.

Signed-off-by: Kagami Hiiragi 

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 09a62e1922..76cb124221 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1296,11 +1296,12 @@ static int mkv_write_track(AVFormatContext *s, 
MatroskaMuxContext *mkv,
 
 if (mkv->mode == MODE_WEBM && !(par->codec_id == AV_CODEC_ID_VP8 ||
 par->codec_id == AV_CODEC_ID_VP9 ||
+par->codec_id == AV_CODEC_ID_AV1 ||
 par->codec_id == AV_CODEC_ID_OPUS ||
 par->codec_id == AV_CODEC_ID_VORBIS ||
 par->codec_id == AV_CODEC_ID_WEBVTT)) {
 av_log(s, AV_LOG_ERROR,
-   "Only VP8 or VP9 video and Vorbis or Opus audio and WebVTT 
subtitles are supported for WebM.\n");
+   "Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and 
WebVTT subtitles are supported for WebM.\n");
 return AVERROR(EINVAL);
 }
 
-- 
2.18.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/libvpxenc: add -row-mt option

2017-03-03 Thread Kagami Hiiragi
On 03/03/17 10:18, James Zern wrote:
> On Thu, Mar 2, 2017 at 11:00 AM, Kagami Hiiragi <kag...@genshiken.org> wrote:
>> From ae3856c302284d60761c3ad122ff49b7b9b68114 Mon Sep 17 00:00:00 2001
>> From: Kagami Hiiragi <kag...@genshiken.org>
>> Date: Thu, 2 Mar 2017 21:19:09 +0300
>> Subject: [PATCH] lavc/libvpxenc: add -row-mt option
>>
>> ---
>>  libavcodec/libvpxenc.c | 11 +++
>>  1 file changed, 11 insertions(+)
>>
>> [...]
>>  [VP9E_SET_TARGET_LEVEL]= "VP9E_SET_TARGET_LEVEL",
>>  [VP9E_GET_LEVEL]   = "VP9E_GET_LEVEL",
>>  #endif
>> +#if VPX_ENCODER_ABI_VERSION >= 13
> 
> Better to use #ifdef VPX_CTRL_VP9E_SET_ROW_MT.
> 
>> [...]
>> +#if VPX_ENCODER_ABI_VERSION >= 13
>> +{"row-mt", "Row based multi-threading", OFFSET(row_mt), 
>> AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VE},
>> +#endif
> 
> We could use -thread_type/-slices here, though this is in line with
> vpxenc. I'll leave this open to comment.

Updated. I don't think -slices would fit logically because -row-mt is boolean 
and -slices is integer.

---
 libavcodec/libvpxenc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index de0d0b6bcb..7c567a0d1d 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -108,6 +108,7 @@ typedef struct VPxEncoderContext {
 int noise_sensitivity;
 int vpx_cs;
 float level;
+int row_mt;
 } VPxContext;
 
 /** String mappings for enum vp8e_enc_control_id */
@@ -139,6 +140,9 @@ static const char *const ctlidstr[] = {
 [VP9E_SET_TARGET_LEVEL]= "VP9E_SET_TARGET_LEVEL",
 [VP9E_GET_LEVEL]   = "VP9E_GET_LEVEL",
 #endif
+#ifdef VPX_CTRL_VP9E_SET_ROW_MT
+[VP9E_SET_ROW_MT]  = "VP9E_SET_ROW_MT",
+#endif
 #endif
 };
 
@@ -720,6 +724,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #if VPX_ENCODER_ABI_VERSION >= 12
 codecctl_int(avctx, VP9E_SET_TARGET_LEVEL, ctx->level < 0 ? 255 : 
lrint(ctx->level * 10));
 #endif
+#ifdef VPX_CTRL_VP9E_SET_ROW_MT
+if (ctx->row_mt >= 0)
+codecctl_int(avctx, VP9E_SET_ROW_MT, ctx->row_mt);
+#endif
 }
 #endif
 
@@ -1132,6 +1140,9 @@ static const AVOption vp9_options[] = {
 #if VPX_ENCODER_ABI_VERSION >= 12
 {"level", "Specify level", OFFSET(level), AV_OPT_TYPE_FLOAT, {.dbl=-1}, 
-1, 6.2, VE},
 #endif
+#ifdef VPX_CTRL_VP9E_SET_ROW_MT
+{"row-mt", "Row based multi-threading", OFFSET(row_mt), AV_OPT_TYPE_BOOL, 
{.i64 = -1}, -1, 1, VE},
+#endif
 LEGACY_OPTIONS
 { NULL }
 };
-- 
2.11.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/libvpxenc: add -row-mt option

2017-03-02 Thread Kagami Hiiragi
On 03/03/17 01:16, Moritz Barsnick wrote:
> On Thu, Mar 02, 2017 at 22:00:36 +0300, Kagami Hiiragi wrote:
>> +{"row-mt", "Row based multi-threading", OFFSET(row_mt), 
>> AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, VE},
>^
> Woudn't a _BOOL type accept exactly the same ranges and defaults, with
> the same behavior, but document itself more nicely?
> 
> It would result in
>  -row-mt  E... Row based multi-threading (default auto)
> instead of
>  -row-mt  E... Row based multi-threading (from -1 to 1) 
> (default -1)
> 
> (Guessing, untested.)
> 
> Moritz

I copied description of "lossless" flag, but "frame-parallel" and other
encoders seems to prefer BOOL, you are right.

I'm leaving it up to commiter, it's just s/_INT/_BOOL/.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc/libvpxenc: add -row-mt option

2017-03-02 Thread Kagami Hiiragi
From ae3856c302284d60761c3ad122ff49b7b9b68114 Mon Sep 17 00:00:00 2001
From: Kagami Hiiragi <kag...@genshiken.org>
Date: Thu, 2 Mar 2017 21:19:09 +0300
Subject: [PATCH] lavc/libvpxenc: add -row-mt option

---
 libavcodec/libvpxenc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index de0d0b6bcb..8eefda5b5b 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -108,6 +108,7 @@ typedef struct VPxEncoderContext {
 int noise_sensitivity;
 int vpx_cs;
 float level;
+int row_mt;
 } VPxContext;
 
 /** String mappings for enum vp8e_enc_control_id */
@@ -139,6 +140,9 @@ static const char *const ctlidstr[] = {
 [VP9E_SET_TARGET_LEVEL]= "VP9E_SET_TARGET_LEVEL",
 [VP9E_GET_LEVEL]   = "VP9E_GET_LEVEL",
 #endif
+#if VPX_ENCODER_ABI_VERSION >= 13
+[VP9E_SET_ROW_MT]  = "VP9E_SET_ROW_MT",
+#endif
 #endif
 };
 
@@ -720,6 +724,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #if VPX_ENCODER_ABI_VERSION >= 12
 codecctl_int(avctx, VP9E_SET_TARGET_LEVEL, ctx->level < 0 ? 255 : 
lrint(ctx->level * 10));
 #endif
+#if VPX_ENCODER_ABI_VERSION >= 13
+if (ctx->row_mt >= 0)
+codecctl_int(avctx, VP9E_SET_ROW_MT, ctx->row_mt);
+#endif
 }
 #endif
 
@@ -1132,6 +1140,9 @@ static const AVOption vp9_options[] = {
 #if VPX_ENCODER_ABI_VERSION >= 12
 {"level", "Specify level", OFFSET(level), AV_OPT_TYPE_FLOAT, {.dbl=-1}, 
-1, 6.2, VE},
 #endif
+#if VPX_ENCODER_ABI_VERSION >= 13
+{"row-mt", "Row based multi-threading", OFFSET(row_mt), AV_OPT_TYPE_INT, 
{.i64 = -1}, -1, 1, VE},
+#endif
 LEGACY_OPTIONS
 { NULL }
 };
-- 
2.11.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/libvpxenc: fix -auto-alt-ref option type

2016-10-21 Thread Kagami Hiiragi
On 22/10/16 01:06, James Zern wrote:
> From: Kagami Hiiragi <kag...@genshiken.org>
> 
> vp9_cx_iface actually allows values in range [0..2].
> This fixes ticket #5894.
> 
> Signed-off-by: Kagami Hiiragi <kag...@genshiken.org>
> ---
>  libavcodec/libvpxenc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 2db87f7..68f25a4 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -621,7 +621,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  if (ctx->flags & VP8F_AUTO_ALT_REF)
>  ctx->auto_alt_ref = 1;
>  if (ctx->auto_alt_ref >= 0)
> -codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref);
> +codecctl_int(avctx, VP8E_SET_ENABLEAUTOALTREF,
> + avctx->codec_id == AV_CODEC_ID_VP8 ? 
> !!ctx->auto_alt_ref : ctx->auto_alt_ref);
>  if (ctx->arnr_max_frames >= 0)
>  codecctl_int(avctx, VP8E_SET_ARNR_MAXFRAMES,   ctx->arnr_max_frames);
>  if (ctx->arnr_strength >= 0)
> @@ -1025,7 +1026,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket 
> *pkt,
>  
>  #define COMMON_OPTIONS \
>  { "auto-alt-ref","Enable use of alternate reference " \
> - "frames (2-pass only)",   
> OFFSET(auto_alt_ref),AV_OPT_TYPE_BOOL, {.i64 = -1}, -1,  1,   
> VE}, \
> + "frames (2-pass only)",   
> OFFSET(auto_alt_ref),AV_OPT_TYPE_INT, {.i64 = -1},  -1,  2,   
> VE}, \
>  { "lag-in-frames",   "Number of frames to look ahead for " \
>   "alternate reference frame selection",
> OFFSET(lag_in_frames),   AV_OPT_TYPE_INT, {.i64 = -1},  -1,  INT_MAX, 
> VE}, \
>  { "arnr-maxframes",  "altref noise reduction max frame count", 
> OFFSET(arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = -1},  -1,  INT_MAX, 
> VE}, \
> 

Thanks, your variant is better.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/libvpxenc: fix -auto-alt-ref option type

2016-10-21 Thread Kagami Hiiragi
On 21/10/16 06:14, James Zern wrote:
> On Thu, Oct 20, 2016 at 8:31 AM, Kagami Hiiragi <kag...@genshiken.org> wrote:
>> vp9_cx_iface actually allows values in range [0..2].
>> This fixes ticket #5894.
>>
>> Signed-off-by: Kagami Hiiragi <kag...@genshiken.org>
>> ---
>>  libavcodec/libvpxenc.c | 7 ++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
> 
> This is all right in the sense that the library exposes the option. In
> practice the feature was never fully developed and will cause failures
> in certain hardware decoders.

vpxenc exposes it, good enough reason to allow that in ffmpeg too.


> The library will report an error (treated as a warning here) which is
> probably enough.

Passing wrong option to encoder should be treated as error in my
opinion. Without that check library will just report warning and
encoding process won't be halted.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc/libvpxenc: fix -auto-alt-ref option type

2016-10-20 Thread Kagami Hiiragi
vp9_cx_iface actually allows values in range [0..2].
This fixes ticket #5894.

Signed-off-by: Kagami Hiiragi <kag...@genshiken.org>
---
 libavcodec/libvpxenc.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 2db87f7..bedaa70 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -615,6 +615,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 }
 
+if (ctx->auto_alt_ref > 1 && avctx->codec_id == AV_CODEC_ID_VP8) {
+av_log(avctx, AV_LOG_ERROR, "auto_alt_ref > 1 is forbidden for 
libvpx-vp8\n");
+return AVERROR(EINVAL);
+}
+
 //codec control failures are currently treated only as warnings
 av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n");
 codecctl_int(avctx, VP8E_SET_CPUUSED,  ctx->cpu_used);
@@ -1025,7 +1030,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket 
*pkt,
 
 #define COMMON_OPTIONS \
 { "auto-alt-ref","Enable use of alternate reference " \
- "frames (2-pass only)",   
OFFSET(auto_alt_ref),AV_OPT_TYPE_BOOL, {.i64 = -1}, -1,  1,   
VE}, \
+ "frames (2-pass only)",   
OFFSET(auto_alt_ref),AV_OPT_TYPE_INT, {.i64 = -1},  -1,  2,   
VE}, \
 { "lag-in-frames",   "Number of frames to look ahead for " \
  "alternate reference frame selection",
OFFSET(lag_in_frames),   AV_OPT_TYPE_INT, {.i64 = -1},  -1,  INT_MAX, 
VE}, \
 { "arnr-maxframes",  "altref noise reduction max frame count", 
OFFSET(arnr_max_frames), AV_OPT_TYPE_INT, {.i64 = -1},  -1,  INT_MAX, 
VE}, \
-- 
2.7.3

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel