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 3E79D45EB6 for ; Fri, 14 Apr 2023 17:33:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5F98968BEF5; Fri, 14 Apr 2023 20:33:10 +0300 (EEST) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E7E2868BEC9 for ; Fri, 14 Apr 2023 20:33:03 +0300 (EEST) Received: by mail-wr1-f53.google.com with SMTP id s2so15028581wra.7 for ; Fri, 14 Apr 2023 10:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681493582; x=1684085582; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YNNzGcPdSjRj+t6qkzumjXFxZxIhXY461B/aOY/YR3U=; b=d2PXbeXuwedkzBXwt/GCPKHZPIAsKYmIitalsq+luyJjX95g55bu2Bm3FjWzD0uD/D 3jlgU2dyAN0NiyEnV7q92acAbh343Y5ZOurG98cyg3VCoaUHy/I1h5wJEGofj6ZX7aXr cSBg4KiKLSrmJcYFbgElF34UG8UuzygnYcEpKNNI2vNlJxLDFAKlYzuiq5rdNOuZKire nWyGAxCcyJbMeJHvJ/1QZvghkvHRtDilL3nGJGTsPdMbc81+oIsb8iQ0uqZ+omelNH22 lP9KFvI51ykyRjl8gOmkBthkVDDH6ujdunb65Cm9b8M9+8cpHuTQXFtGJrvuw18f9Ug6 6dUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681493582; x=1684085582; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YNNzGcPdSjRj+t6qkzumjXFxZxIhXY461B/aOY/YR3U=; b=jA63g26TzJd1RQBnPL4SkKjnxgQC721ILDjRHfrpeRxnYPSUiLC9G6ZX4ZkBbJhiXu WALG4HhjNP9p5+NhURpc5rvUZ+O0pbEp9ey64pR65mXrP7Dgbj+MAt2OfZt9gumyyYkj B6Nm6gFQY/6w/mCAaw+/l5asIx37c3Dojg28zp2pyMRF15KPWicGCUB0PBzBML+gw8TX DiEcZNir+O0DiscV7uFd/wKVO3y5A0vCbZfWWve1HDWlS8cMOC8TR5gZwjQhysUrtepx yV6p9QGGZzcwGCc8BCDsyLDpqujDW8CFWSyIwe+k021P2eKMlJfKl2tTnd3XGFIldhAs hroQ== X-Gm-Message-State: AAQBX9ePxAEzwfyyaH57fp9AZ+rE67On8taUWY5SHUB2ERFGXmViPkWD h+2c8ZRQAf9y13PyK09PKnf10ghm+rjiIQ== X-Google-Smtp-Source: AKy350b2oHlidi67dZ0A3zFiCZx7gBqlNyif2QqIXXyfcJ7W3IGzuanQjQDwkv45Ma5PKNVC0VcBRQ== X-Received: by 2002:adf:e612:0:b0:2d2:d324:e44f with SMTP id p18-20020adfe612000000b002d2d324e44fmr4665801wrm.16.1681493582404; Fri, 14 Apr 2023 10:33:02 -0700 (PDT) Received: from pop-os.home.arpa ([81.0.1.1]) by smtp.gmail.com with ESMTPSA id x4-20020a5d54c4000000b002c3f81c51b6sm3953571wrv.90.2023.04.14.10.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 10:33:02 -0700 (PDT) From: Suraj Shirvankar To: ffmpeg-devel@ffmpeg.org Date: Fri, 14 Apr 2023 19:32:55 +0200 Message-Id: <20230414173255.314460-1-surajshirvankar@gmail.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter: Refactor vf_psnr sse_line 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: Suraj Shirvankar 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: Signed-off-by: Suraj Shirvankar --- libavfilter/vf_psnr.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index 15cde7e8c8..a0c673831d 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -59,7 +59,7 @@ typedef struct PSNRContext { } PSNRContext; #define OFFSET(x) offsetof(PSNRContext, x) -#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM static const AVOption psnr_options[] = { {"stats_file", "Set file where to store per-frame difference information", OFFSET(stats_file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS }, @@ -81,31 +81,26 @@ static inline double get_psnr(double mse, uint64_t nb_frames, int max) return 10.0 * log10(pow_2(max) / (mse / nb_frames)); } -static uint64_t sse_line_8bit(const uint8_t *main_line, const uint8_t *ref_line, int outw) -{ - int j; - unsigned m2 = 0; - - for (j = 0; j < outw; j++) - m2 += pow_2(main_line[j] - ref_line[j]); +#define SSE_LINE(name, type) \ + static uint64_t sse_line_##name(const uint8_t *_main_line, \ + const uint8_t *_ref_line, int outw) \ + { \ + int j; \ + uint64_t m2 = 0; \ + const type *main_line = (const type *)_main_line; \ + const type *ref_line = (const type *)_ref_line; \ + \ + for (j = 0; j < outw; j++) \ + m2 += pow_2(main_line[j] - ref_line[j]); \ + \ + return m2; \ + } - return m2; -} +SSE_LINE(8bit, uint8_t) +SSE_LINE(16bit, uint16_t) -static uint64_t sse_line_16bit(const uint8_t *_main_line, const uint8_t *_ref_line, int outw) +typedef struct ThreadData { - int j; - uint64_t m2 = 0; - const uint16_t *main_line = (const uint16_t *) _main_line; - const uint16_t *ref_line = (const uint16_t *) _ref_line; - - for (j = 0; j < outw; j++) - m2 += pow_2(main_line[j] - ref_line[j]); - - return m2; -} - -typedef struct ThreadData { const uint8_t *main_data[4]; const uint8_t *ref_data[4]; int main_linesize[4]; -- 2.40.0 _______________________________________________ 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".