From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 7C280427A5 for ; Fri, 29 Apr 2022 21:46:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 358C768B261; Sat, 30 Apr 2022 00:46:46 +0300 (EEST) Received: from mail-yw1-f176.google.com (mail-yw1-f176.google.com [209.85.128.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EEF8D68B1B2 for ; Sat, 30 Apr 2022 00:46:38 +0300 (EEST) Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-2f7bb893309so98200477b3.12 for ; Fri, 29 Apr 2022 14:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=BiSPoiHZIww0e2AhxpTh1py3q1jEY9xmTKPatpyZxqo=; b=rDa9pxWSUluMUiq48Nnt9DGoW+j/zWnzluwEovMjOHHC78tvk3DDPEAtDPz8/NLJ0X SQlmEmCn33zGgTATpvTRf88/Ura0xWdYzwX/z2fZJ483HgKMd5OvK1uN71YxFFQlwZlg wMgfBXdn5bWDgqAZqE9j82vObzlXwKLxbECGC16PCSRqMdXvQvc3kgNEory6M9BpMgIt GSa7u5YvBbnnOhgGmiaMVCXKEHJ3R28Yo7G9ka66lx5hxkoHr4EheNt27jm73uPAFX6/ H7dniAjlbAtL1mT5BOFMOGpzyfHZKWkF814Ws5jzfCkxDuPkpCRfKF6OJegpOISQncRW t9HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=BiSPoiHZIww0e2AhxpTh1py3q1jEY9xmTKPatpyZxqo=; b=c/5uTetedgwsVoImes1QFZEViWlDmAvy5B0e6EDVQ9OngvYVcFWGDw/LuFVNIRkjA+ KCIWjtaeRBy2VPJuNsVd2LM6ahYbXQLoLQlZJNHF14Lmc6gQuF5mbB2+v0oJ2E12Iqlf 1nEEsBrBKrdg1bU3EfORwR8Pyd7o5k+tNVGU4iaCsfoJYxLDUAqfCYrhQzfqrYzMB5qc RfrIRSKMOmDVbTt37rUKaqQ4N76IX6VROKcq7x7L42RIT6y/M0UCUfAnDsttKdNYnp4D oJS7ljygoJTlhzQhszUBCodMO4ZezScYeTj22Rz/GbKBaLoYenk42h5DOWjTYqTEIAOz Xd2g== X-Gm-Message-State: AOAM532zoMHYQ4S0hTH/pzTlhzsWEIoln8jwCDt0cjWnFHFBwWeWosxk ibrtEEwnimYR/r4inv0cZ/7LLRGfKkX9Rhm2oAVhJo43004= X-Google-Smtp-Source: ABdhPJzQlo4Svr2X6TTJS56SlBN+9Yb9PzrsYVyNp9USMUd4zFU7Liy8rkMf1Hqr+uPhuVJ3f2u50u0MohdBiXlc57M= X-Received: by 2002:a81:4e8f:0:b0:2f6:27c4:9bef with SMTP id c137-20020a814e8f000000b002f627c49befmr1486359ywb.288.1651268797095; Fri, 29 Apr 2022 14:46:37 -0700 (PDT) MIME-Version: 1.0 References: <20220419170324.3342219-1-bohanli@google.com> <20220419181850.3392814-1-bohanli@google.com> In-Reply-To: <20220419181850.3392814-1-bohanli@google.com> From: Bohan Li Date: Fri, 29 Apr 2022 14:46:01 -0700 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/libaomenc: Add unmet target level warning X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Gentle ping on this :) On Tue, Apr 19, 2022 at 11:20 AM Bohan Li 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 > --- > 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".