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 D9EC046D9B for ; Tue, 10 Oct 2023 10:54:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BD65C68CA4E; Tue, 10 Oct 2023 13:54:49 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E5FEE68C8D8 for ; Tue, 10 Oct 2023 13:54:42 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 4048024048D; Tue, 10 Oct 2023 12:54:42 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id NnecRlkFwBLu; Tue, 10 Oct 2023 12:54:41 +0200 (CEST) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 801902400FF; Tue, 10 Oct 2023 12:54:41 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 61D251601B9; Tue, 10 Oct 2023 12:54:41 +0200 (CEST) From: Anton Khirnov To: "ffmpeg-devel@ffmpeg.org" In-Reply-To: <75548e3c104400a6cef07dad2a75ffa648e830cc.camel@amazon.it> References: <235b296cd67fed2c79862d4403dbe268d2f7e25b.camel@amazon.it> <75548e3c104400a6cef07dad2a75ffa648e830cc.camel@amazon.it> Mail-Followup-To: "ffmpeg-devel@ffmpeg.org" , "Carotti, Elias" Date: Tue, 10 Oct 2023 12:54:41 +0200 Message-ID: <169693528137.6638.10771778310430665651@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] libavc/libx264: add support to propagate SSE values through encoder stats 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 Cc: "Carotti, Elias" 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: Quoting Carotti, Elias via ffmpeg-devel (2023-10-02 19:35:09) > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 77a9f173b4..4c643c9066 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -129,6 +129,8 @@ typedef struct X264Context { > int roi_warned; > > int mb_info; > + > + int64_t sse[3]; The values don't need to be preserved across frames, so might as well put this on stack in the block calling ff_side_data_set_encoder_stats(). > } X264Context; > > static void X264_log(void *p, int level, const char *fmt, va_list args) > @@ -726,7 +728,40 @@ FF_ENABLE_DEPRECATION_WARNINGS > > pkt->flags |= AV_PKT_FLAG_KEY*pic_out.b_keyframe; > if (ret) { > - ff_side_data_set_encoder_stats(pkt, (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA, NULL, 0, pict_type); > + const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(csp_to_pixfmt(pic_out.img.i_csp)); > + int error_count = 0; > + int64_t *errors = NULL; > + > + if (ctx->flags & AV_CODEC_FLAG_PSNR) { > + double scale[3] = { 1, > + (1 << pix_desc->log2_chroma_h) * (double)(1 << pix_desc->log2_chroma_w), > + (1 << pix_desc->log2_chroma_h) * (double)(1 << pix_desc->log2_chroma_w), Any particular reason the cast is on the second value? It looks strange. > + }; > + double mse; > + int i; > + > + error_count = pix_desc->nb_components; > + > + av_log(ctx, AV_LOG_DEBUG, "PSNR values from libx264: %.3f %.3f %.3f.\n", > + pic_out.prop.f_psnr[0], pic_out.prop.f_psnr[1], pic_out.prop.f_psnr[2]); > + > + for (i = 0; i < pix_desc->nb_components; ++i) { for (int i .... -- Anton Khirnov _______________________________________________ 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".