* [FFmpeg-devel] [PATCH] Add unmet target level warning to libaom encoding.
@ 2022-04-18 19:59 Bohan Li
2022-04-19 17:03 ` [FFmpeg-devel] [PATCH] avcodec/libaomenc: Add unmet target level warning Bohan Li
0 siblings, 1 reply; 9+ messages in thread
From: Bohan Li @ 2022-04-18 19:59 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Bohan Li
When target levels are set, this patch checks whether they are
satisfied by libaom. If not, a warning is shown. Otherwise the output
levels are also logged.
This patch applies basically the same approach used for libvpx.
Signed-off-by: Bohan Li <bohanli@google.com>
---
libavcodec/libaomenc.c | 64 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 054903e6e2..402bcb5198 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -198,6 +198,12 @@ static const char *const ctlidstr[] = {
[AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
[AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
#endif
+#ifdef AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX
+ [AV1E_GET_SEQ_LEVEL_IDX] = "AV1E_GET_SEQ_LEVEL_IDX",
+#endif
+#ifdef AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX
+ [AV1E_GET_TARGET_SEQ_LEVEL_IDX] = "AV1E_GET_TARGET_SEQ_LEVEL_IDX",
+#endif
};
static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -323,10 +329,68 @@ static av_cold int codecctl_int(AVCodecContext *avctx,
return 0;
}
+#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
+ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
+static av_cold int codecctl_intp(AVCodecContext *avctx,
+#ifdef UENUM1BYTE
+ aome_enc_control_id id,
+#else
+ enum aome_enc_control_id id,
+#endif
+ int* ptr)
+{
+ AOMContext *ctx = avctx->priv_data;
+ char buf[80];
+ int width = -30;
+ int res;
+
+ snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]);
+ av_log(avctx, AV_LOG_DEBUG, " %*s%d\n", width, buf, *ptr);
+
+ res = aom_codec_control(&ctx->encoder, id, ptr);
+ if (res != AOM_CODEC_OK) {
+ snprintf(buf, sizeof(buf), "Failed to set %s codec control",
+ ctlidstr[id]);
+ log_encoder_error(avctx, buf);
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+#endif
+
static av_cold int aom_free(AVCodecContext *avctx)
{
AOMContext *ctx = avctx->priv_data;
+#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
+ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
+ if (!(avctx->flags & AV_CODEC_FLAG_PASS1)) {
+ int levels[32] = { 0 };
+ int target_levels[32] = { 0 };
+
+ if (!codecctl_intp(avctx, AV1E_GET_SEQ_LEVEL_IDX, levels) &&
+ !codecctl_intp(avctx, AV1E_GET_TARGET_SEQ_LEVEL_IDX,
+ target_levels)) {
+ for (int i = 0; i < 32; i++) {
+ if (levels[i] > target_levels[i]) {
+ // Warn when the target level was not met
+ av_log(avctx, AV_LOG_WARNING,
+ "Could not encode to target level %d.%d for "
+ "operating point %d. The output level is %d.%d.",
+ 2 + (target_levels[i] >> 2), target_levels[i] & 3,
+ i, 2 + (levels[i] >> 2), levels[i] & 3);
+ } else if (target_levels[i] < 31) {
+ // Log the encoded level if a target level was given
+ av_log(avctx, AV_LOG_INFO,
+ "Output level for operating point %d is %d.%d.",
+ i, 2 + (levels[i] >> 2), levels[i] & 3);
+ }
+ }
+ }
+ }
+#endif
+
aom_codec_destroy(&ctx->encoder);
av_freep(&ctx->twopass_stats.buf);
av_freep(&avctx->stats_out);
--
2.36.0.rc0.470.gd361397f0d-goog
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH] avcodec/libaomenc: Add unmet target level warning
2022-04-18 19:59 [FFmpeg-devel] [PATCH] Add unmet target level warning to libaom encoding Bohan Li
@ 2022-04-19 17:03 ` Bohan Li
2022-04-19 18:18 ` [FFmpeg-devel] [PATCH v2] " Bohan Li
0 siblings, 1 reply; 9+ messages in thread
From: Bohan Li @ 2022-04-19 17:03 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Bohan Li
When target levels are set, this patch checks whether they are
satisfied by libaom. If not, a warning is shown. Otherwise the output
levels are also logged.
This patch applies basically the same approach used for libvpx.
Signed-off-by: Bohan Li <bohanli@google.com>
---
libavcodec/libaomenc.c | 64 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 054903e6e2..402bcb5198 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -198,6 +198,12 @@ static const char *const ctlidstr[] = {
[AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
[AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
#endif
+#ifdef AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX
+ [AV1E_GET_SEQ_LEVEL_IDX] = "AV1E_GET_SEQ_LEVEL_IDX",
+#endif
+#ifdef AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX
+ [AV1E_GET_TARGET_SEQ_LEVEL_IDX] = "AV1E_GET_TARGET_SEQ_LEVEL_IDX",
+#endif
};
static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -323,10 +329,68 @@ static av_cold int codecctl_int(AVCodecContext *avctx,
return 0;
}
+#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
+ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
+static av_cold int codecctl_intp(AVCodecContext *avctx,
+#ifdef UENUM1BYTE
+ aome_enc_control_id id,
+#else
+ enum aome_enc_control_id id,
+#endif
+ int* ptr)
+{
+ AOMContext *ctx = avctx->priv_data;
+ char buf[80];
+ int width = -30;
+ int res;
+
+ snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]);
+ av_log(avctx, AV_LOG_DEBUG, " %*s%d\n", width, buf, *ptr);
+
+ res = aom_codec_control(&ctx->encoder, id, ptr);
+ if (res != AOM_CODEC_OK) {
+ snprintf(buf, sizeof(buf), "Failed to set %s codec control",
+ ctlidstr[id]);
+ log_encoder_error(avctx, buf);
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+#endif
+
static av_cold int aom_free(AVCodecContext *avctx)
{
AOMContext *ctx = avctx->priv_data;
+#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
+ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
+ if (!(avctx->flags & AV_CODEC_FLAG_PASS1)) {
+ int levels[32] = { 0 };
+ int target_levels[32] = { 0 };
+
+ if (!codecctl_intp(avctx, AV1E_GET_SEQ_LEVEL_IDX, levels) &&
+ !codecctl_intp(avctx, AV1E_GET_TARGET_SEQ_LEVEL_IDX,
+ target_levels)) {
+ for (int i = 0; i < 32; i++) {
+ if (levels[i] > target_levels[i]) {
+ // Warn when the target level was not met
+ av_log(avctx, AV_LOG_WARNING,
+ "Could not encode to target level %d.%d for "
+ "operating point %d. The output level is %d.%d.",
+ 2 + (target_levels[i] >> 2), target_levels[i] & 3,
+ i, 2 + (levels[i] >> 2), levels[i] & 3);
+ } else if (target_levels[i] < 31) {
+ // Log the encoded level if a target level was given
+ av_log(avctx, AV_LOG_INFO,
+ "Output level for operating point %d is %d.%d.",
+ i, 2 + (levels[i] >> 2), levels[i] & 3);
+ }
+ }
+ }
+ }
+#endif
+
aom_codec_destroy(&ctx->encoder);
av_freep(&ctx->twopass_stats.buf);
av_freep(&avctx->stats_out);
--
2.36.0.rc0.470.gd361397f0d-goog
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2] avcodec/libaomenc: Add unmet target level warning
2022-04-19 17:03 ` [FFmpeg-devel] [PATCH] avcodec/libaomenc: Add unmet target level warning Bohan Li
@ 2022-04-19 18:18 ` Bohan Li
2022-04-29 21:46 ` Bohan Li
2022-05-17 19:45 ` James Zern
0 siblings, 2 replies; 9+ messages in thread
From: Bohan Li @ 2022-04-19 18:18 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Bohan Li
When target levels are set, this patch checks whether they are
satisfied by libaom. If not, a warning is shown. Otherwise the output
levels are also logged.
This patch applies basically the same approach used for libvpx.
Signed-off-by: Bohan Li <bohanli@google.com>
---
libavcodec/libaomenc.c | 64 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index 054903e6e2..77be56fa51 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -198,6 +198,12 @@ static const char *const ctlidstr[] = {
[AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
[AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
#endif
+#ifdef AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX
+ [AV1E_GET_SEQ_LEVEL_IDX] = "AV1E_GET_SEQ_LEVEL_IDX",
+#endif
+#ifdef AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX
+ [AV1E_GET_TARGET_SEQ_LEVEL_IDX] = "AV1E_GET_TARGET_SEQ_LEVEL_IDX",
+#endif
};
static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
@@ -323,10 +329,68 @@ static av_cold int codecctl_int(AVCodecContext *avctx,
return 0;
}
+#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
+ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
+static av_cold int codecctl_intp(AVCodecContext *avctx,
+#ifdef UENUM1BYTE
+ aome_enc_control_id id,
+#else
+ enum aome_enc_control_id id,
+#endif
+ int* ptr)
+{
+ AOMContext *ctx = avctx->priv_data;
+ char buf[80];
+ int width = -30;
+ int res;
+
+ snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]);
+ av_log(avctx, AV_LOG_DEBUG, " %*s%d\n", width, buf, *ptr);
+
+ res = aom_codec_control(&ctx->encoder, id, ptr);
+ if (res != AOM_CODEC_OK) {
+ snprintf(buf, sizeof(buf), "Failed to set %s codec control",
+ ctlidstr[id]);
+ log_encoder_error(avctx, buf);
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+#endif
+
static av_cold int aom_free(AVCodecContext *avctx)
{
AOMContext *ctx = avctx->priv_data;
+#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
+ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
+ if (!(avctx->flags & AV_CODEC_FLAG_PASS1)) {
+ int levels[32] = { 0 };
+ int target_levels[32] = { 0 };
+
+ if (!codecctl_intp(avctx, AV1E_GET_SEQ_LEVEL_IDX, levels) &&
+ !codecctl_intp(avctx, AV1E_GET_TARGET_SEQ_LEVEL_IDX,
+ target_levels)) {
+ for (int i = 0; i < 32; i++) {
+ if (levels[i] > target_levels[i]) {
+ // Warn when the target level was not met
+ av_log(avctx, AV_LOG_WARNING,
+ "Could not encode to target level %d.%d for "
+ "operating point %d. The output level is %d.%d.\n",
+ 2 + (target_levels[i] >> 2), target_levels[i] & 3,
+ i, 2 + (levels[i] >> 2), levels[i] & 3);
+ } else if (target_levels[i] < 31) {
+ // Log the encoded level if a target level was given
+ av_log(avctx, AV_LOG_INFO,
+ "Output level for operating point %d is %d.%d.\n",
+ i, 2 + (levels[i] >> 2), levels[i] & 3);
+ }
+ }
+ }
+ }
+#endif
+
aom_codec_destroy(&ctx->encoder);
av_freep(&ctx->twopass_stats.buf);
av_freep(&avctx->stats_out);
--
2.36.0.rc0.470.gd361397f0d-goog
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avcodec/libaomenc: Add unmet target level warning
2022-04-19 18:18 ` [FFmpeg-devel] [PATCH v2] " Bohan Li
@ 2022-04-29 21:46 ` Bohan Li
2022-05-16 20:48 ` Bohan Li
2022-05-17 19:45 ` James Zern
1 sibling, 1 reply; 9+ messages in thread
From: Bohan Li @ 2022-04-29 21:46 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Gentle ping on this :)
On Tue, Apr 19, 2022 at 11:20 AM Bohan Li <bohanli@google.com> wrote:
> When target levels are set, this patch checks whether they are
> satisfied by libaom. If not, a warning is shown. Otherwise the output
> levels are also logged.
>
> This patch applies basically the same approach used for libvpx.
>
> Signed-off-by: Bohan Li <bohanli@google.com>
> ---
> libavcodec/libaomenc.c | 64 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 64 insertions(+)
>
> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> index 054903e6e2..77be56fa51 100644
> --- a/libavcodec/libaomenc.c
> +++ b/libavcodec/libaomenc.c
> @@ -198,6 +198,12 @@ static const char *const ctlidstr[] = {
> [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] =
> "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
> [AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
> #endif
> +#ifdef AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX
> + [AV1E_GET_SEQ_LEVEL_IDX] = "AV1E_GET_SEQ_LEVEL_IDX",
> +#endif
> +#ifdef AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX
> + [AV1E_GET_TARGET_SEQ_LEVEL_IDX] = "AV1E_GET_TARGET_SEQ_LEVEL_IDX",
> +#endif
> };
>
> static av_cold void log_encoder_error(AVCodecContext *avctx, const char
> *desc)
> @@ -323,10 +329,68 @@ static av_cold int codecctl_int(AVCodecContext
> *avctx,
> return 0;
> }
>
> +#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
> + defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
> +static av_cold int codecctl_intp(AVCodecContext *avctx,
> +#ifdef UENUM1BYTE
> + aome_enc_control_id id,
> +#else
> + enum aome_enc_control_id id,
> +#endif
> + int* ptr)
> +{
> + AOMContext *ctx = avctx->priv_data;
> + char buf[80];
> + int width = -30;
> + int res;
> +
> + snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]);
> + av_log(avctx, AV_LOG_DEBUG, " %*s%d\n", width, buf, *ptr);
> +
> + res = aom_codec_control(&ctx->encoder, id, ptr);
> + if (res != AOM_CODEC_OK) {
> + snprintf(buf, sizeof(buf), "Failed to set %s codec control",
> + ctlidstr[id]);
> + log_encoder_error(avctx, buf);
> + return AVERROR(EINVAL);
> + }
> +
> + return 0;
> +}
> +#endif
> +
> static av_cold int aom_free(AVCodecContext *avctx)
> {
> AOMContext *ctx = avctx->priv_data;
>
> +#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
> + defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
> + if (!(avctx->flags & AV_CODEC_FLAG_PASS1)) {
> + int levels[32] = { 0 };
> + int target_levels[32] = { 0 };
> +
> + if (!codecctl_intp(avctx, AV1E_GET_SEQ_LEVEL_IDX, levels) &&
> + !codecctl_intp(avctx, AV1E_GET_TARGET_SEQ_LEVEL_IDX,
> + target_levels)) {
> + for (int i = 0; i < 32; i++) {
> + if (levels[i] > target_levels[i]) {
> + // Warn when the target level was not met
> + av_log(avctx, AV_LOG_WARNING,
> + "Could not encode to target level %d.%d for "
> + "operating point %d. The output level is
> %d.%d.\n",
> + 2 + (target_levels[i] >> 2), target_levels[i]
> & 3,
> + i, 2 + (levels[i] >> 2), levels[i] & 3);
> + } else if (target_levels[i] < 31) {
> + // Log the encoded level if a target level was given
> + av_log(avctx, AV_LOG_INFO,
> + "Output level for operating point %d is
> %d.%d.\n",
> + i, 2 + (levels[i] >> 2), levels[i] & 3);
> + }
> + }
> + }
> + }
> +#endif
> +
> aom_codec_destroy(&ctx->encoder);
> av_freep(&ctx->twopass_stats.buf);
> av_freep(&avctx->stats_out);
> --
> 2.36.0.rc0.470.gd361397f0d-goog
>
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avcodec/libaomenc: Add unmet target level warning
2022-04-29 21:46 ` Bohan Li
@ 2022-05-16 20:48 ` Bohan Li
0 siblings, 0 replies; 9+ messages in thread
From: Bohan Li @ 2022-05-16 20:48 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Another ping :)
On Fri, Apr 29, 2022 at 2:46 PM Bohan Li <bohanli@google.com> wrote:
> Gentle ping on this :)
>
> On Tue, Apr 19, 2022 at 11:20 AM Bohan Li <bohanli@google.com> wrote:
>
>> When target levels are set, this patch checks whether they are
>> satisfied by libaom. If not, a warning is shown. Otherwise the output
>> levels are also logged.
>>
>> This patch applies basically the same approach used for libvpx.
>>
>> Signed-off-by: Bohan Li <bohanli@google.com>
>> ---
>> libavcodec/libaomenc.c | 64 ++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 64 insertions(+)
>>
>> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
>> index 054903e6e2..77be56fa51 100644
>> --- a/libavcodec/libaomenc.c
>> +++ b/libavcodec/libaomenc.c
>> @@ -198,6 +198,12 @@ static const char *const ctlidstr[] = {
>> [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] =
>> "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
>> [AV1E_SET_ENABLE_REF_FRAME_MVS] =
>> "AV1E_SET_ENABLE_REF_FRAME_MVS",
>> #endif
>> +#ifdef AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX
>> + [AV1E_GET_SEQ_LEVEL_IDX] = "AV1E_GET_SEQ_LEVEL_IDX",
>> +#endif
>> +#ifdef AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX
>> + [AV1E_GET_TARGET_SEQ_LEVEL_IDX] =
>> "AV1E_GET_TARGET_SEQ_LEVEL_IDX",
>> +#endif
>> };
>>
>> static av_cold void log_encoder_error(AVCodecContext *avctx, const char
>> *desc)
>> @@ -323,10 +329,68 @@ static av_cold int codecctl_int(AVCodecContext
>> *avctx,
>> return 0;
>> }
>>
>> +#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
>> + defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
>> +static av_cold int codecctl_intp(AVCodecContext *avctx,
>> +#ifdef UENUM1BYTE
>> + aome_enc_control_id id,
>> +#else
>> + enum aome_enc_control_id id,
>> +#endif
>> + int* ptr)
>> +{
>> + AOMContext *ctx = avctx->priv_data;
>> + char buf[80];
>> + int width = -30;
>> + int res;
>> +
>> + snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]);
>> + av_log(avctx, AV_LOG_DEBUG, " %*s%d\n", width, buf, *ptr);
>> +
>> + res = aom_codec_control(&ctx->encoder, id, ptr);
>> + if (res != AOM_CODEC_OK) {
>> + snprintf(buf, sizeof(buf), "Failed to set %s codec control",
>> + ctlidstr[id]);
>> + log_encoder_error(avctx, buf);
>> + return AVERROR(EINVAL);
>> + }
>> +
>> + return 0;
>> +}
>> +#endif
>> +
>> static av_cold int aom_free(AVCodecContext *avctx)
>> {
>> AOMContext *ctx = avctx->priv_data;
>>
>> +#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
>> + defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
>> + if (!(avctx->flags & AV_CODEC_FLAG_PASS1)) {
>> + int levels[32] = { 0 };
>> + int target_levels[32] = { 0 };
>> +
>> + if (!codecctl_intp(avctx, AV1E_GET_SEQ_LEVEL_IDX, levels) &&
>> + !codecctl_intp(avctx, AV1E_GET_TARGET_SEQ_LEVEL_IDX,
>> + target_levels)) {
>> + for (int i = 0; i < 32; i++) {
>> + if (levels[i] > target_levels[i]) {
>> + // Warn when the target level was not met
>> + av_log(avctx, AV_LOG_WARNING,
>> + "Could not encode to target level %d.%d for "
>> + "operating point %d. The output level is
>> %d.%d.\n",
>> + 2 + (target_levels[i] >> 2), target_levels[i]
>> & 3,
>> + i, 2 + (levels[i] >> 2), levels[i] & 3);
>> + } else if (target_levels[i] < 31) {
>> + // Log the encoded level if a target level was given
>> + av_log(avctx, AV_LOG_INFO,
>> + "Output level for operating point %d is
>> %d.%d.\n",
>> + i, 2 + (levels[i] >> 2), levels[i] & 3);
>> + }
>> + }
>> + }
>> + }
>> +#endif
>> +
>> aom_codec_destroy(&ctx->encoder);
>> av_freep(&ctx->twopass_stats.buf);
>> av_freep(&avctx->stats_out);
>> --
>> 2.36.0.rc0.470.gd361397f0d-goog
>>
>>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avcodec/libaomenc: Add unmet target level warning
2022-04-19 18:18 ` [FFmpeg-devel] [PATCH v2] " Bohan Li
2022-04-29 21:46 ` Bohan Li
@ 2022-05-17 19:45 ` James Zern
2022-05-25 0:43 ` James Zern
2022-05-27 20:41 ` James Zern
1 sibling, 2 replies; 9+ messages in thread
From: James Zern @ 2022-05-17 19:45 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Bohan Li
On Tue, Apr 19, 2022 at 11:20 AM Bohan Li
<bohanli-at-google.com@ffmpeg.org> wrote:
>
> When target levels are set, this patch checks whether they are
> satisfied by libaom. If not, a warning is shown. Otherwise the output
> levels are also logged.
>
> This patch applies basically the same approach used for libvpx.
>
> Signed-off-by: Bohan Li <bohanli@google.com>
> ---
> libavcodec/libaomenc.c | 64 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 64 insertions(+)
>
lgtm.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avcodec/libaomenc: Add unmet target level warning
2022-05-17 19:45 ` James Zern
@ 2022-05-25 0:43 ` James Zern
2022-05-25 16:23 ` Bohan Li
2022-05-27 20:41 ` James Zern
1 sibling, 1 reply; 9+ messages in thread
From: James Zern @ 2022-05-25 0:43 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Bohan Li
On Tue, May 17, 2022 at 12:45 PM James Zern <jzern@google.com> wrote:
>
> On Tue, Apr 19, 2022 at 11:20 AM Bohan Li
> <bohanli-at-google.com@ffmpeg.org> wrote:
> >
> > When target levels are set, this patch checks whether they are
> > satisfied by libaom. If not, a warning is shown. Otherwise the output
> > levels are also logged.
> >
> > This patch applies basically the same approach used for libvpx.
> >
> > Signed-off-by: Bohan Li <bohanli@google.com>
> > ---
> > libavcodec/libaomenc.c | 64 ++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 64 insertions(+)
> >
>
> lgtm.
> + } else if (target_levels[i] < 31) {
> + // Log the encoded level if a target level was given
> + av_log(avctx, AV_LOG_INFO,
> + "Output level for operating point %d is %d.%d.",
> + i, 2 + (levels[i] >> 2), levels[i] & 3);
> + }
Actually this is a bit spammy. If there's only one operating point set
then I'd expect a single line output, but this seems to print all 32
regardless. Is that expected?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avcodec/libaomenc: Add unmet target level warning
2022-05-25 0:43 ` James Zern
@ 2022-05-25 16:23 ` Bohan Li
0 siblings, 0 replies; 9+ messages in thread
From: Bohan Li @ 2022-05-25 16:23 UTC (permalink / raw)
To: James Zern; +Cc: FFmpeg development discussions and patches
Thanks for the reply, James!
This is indeed not the intended behaviour, but it is due to libaom not
initializing all the indices correctly. I've submitted a patch for review
in libaom that fixes this, and after that patch the levels are only logged
when a target level is given with this ffmpeg patch.
Best,
Bohan
On Tue, May 24, 2022 at 5:43 PM James Zern <jzern@google.com> wrote:
> On Tue, May 17, 2022 at 12:45 PM James Zern <jzern@google.com> wrote:
> >
> > On Tue, Apr 19, 2022 at 11:20 AM Bohan Li
> > <bohanli-at-google.com@ffmpeg.org> wrote:
> > >
> > > When target levels are set, this patch checks whether they are
> > > satisfied by libaom. If not, a warning is shown. Otherwise the output
> > > levels are also logged.
> > >
> > > This patch applies basically the same approach used for libvpx.
> > >
> > > Signed-off-by: Bohan Li <bohanli@google.com>
> > > ---
> > > libavcodec/libaomenc.c | 64 ++++++++++++++++++++++++++++++++++++++++++
> > > 1 file changed, 64 insertions(+)
> > >
> >
> > lgtm.
>
> > + } else if (target_levels[i] < 31) {
> > + // Log the encoded level if a target level was given
> > + av_log(avctx, AV_LOG_INFO,
> > + "Output level for operating point %d is
> %d.%d.",
> > + i, 2 + (levels[i] >> 2), levels[i] & 3);
> > + }
>
> Actually this is a bit spammy. If there's only one operating point set
> then I'd expect a single line output, but this seems to print all 32
> regardless. Is that expected?
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2] avcodec/libaomenc: Add unmet target level warning
2022-05-17 19:45 ` James Zern
2022-05-25 0:43 ` James Zern
@ 2022-05-27 20:41 ` James Zern
1 sibling, 0 replies; 9+ messages in thread
From: James Zern @ 2022-05-27 20:41 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Tue, May 17, 2022 at 12:45 PM James Zern <jzern@google.com> wrote:
>
> On Tue, Apr 19, 2022 at 11:20 AM Bohan Li
> <bohanli-at-google.com@ffmpeg.org> wrote:
> >
> > When target levels are set, this patch checks whether they are
> > satisfied by libaom. If not, a warning is shown. Otherwise the output
> > levels are also logged.
> >
> > This patch applies basically the same approach used for libvpx.
> >
> > Signed-off-by: Bohan Li <bohanli@google.com>
> > ---
> > libavcodec/libaomenc.c | 64 ++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 64 insertions(+)
> >
>
> lgtm.
applied. thanks for the patch.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-05-27 20:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 19:59 [FFmpeg-devel] [PATCH] Add unmet target level warning to libaom encoding Bohan Li
2022-04-19 17:03 ` [FFmpeg-devel] [PATCH] avcodec/libaomenc: Add unmet target level warning Bohan Li
2022-04-19 18:18 ` [FFmpeg-devel] [PATCH v2] " Bohan Li
2022-04-29 21:46 ` Bohan Li
2022-05-16 20:48 ` Bohan Li
2022-05-17 19:45 ` James Zern
2022-05-25 0:43 ` James Zern
2022-05-25 16:23 ` Bohan Li
2022-05-27 20:41 ` James Zern
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git