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 3A0DA44C64 for ; Fri, 14 Apr 2023 15:59:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 852F868BEAD; Fri, 14 Apr 2023 18:59:09 +0300 (EEST) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5E6E268BE80 for ; Fri, 14 Apr 2023 18:59:02 +0300 (EEST) Received: by mail-wm1-f54.google.com with SMTP id he13so15632761wmb.2 for ; Fri, 14 Apr 2023 08:59:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681487941; x=1684079941; h=content-transfer-encoding:content-language:to:subject:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Hek6ZeYmsuQcBoX3FI6SjLHy8/IrJ8ALyyV2TFKIHxI=; b=Qp0vKgbhCfDUDDF94HV4j35vj/i1qNmadyrJyL6UyFIbzgJvL5kofhzwT5CiQ7qv4R V+Bw8HJGeJkU4UaUzyYrgg5AAiVMJVh4WgIJyF9PIcgepUAZAsWI0AioU1L8bfsyaH/r OCFk9V7HJ0liJyFzCBincnfvxPYWup/YMGpqCtqXg2p07ByXGqf5RfJ2m224RRqFx4+B 5wxe8B4uM62zqLFcuc1wnqbkmC78EdHy4FCzjmZf+PcjcKco6lUNpupTICQF6HupMAvB 4n41Hg/4G94jFwFYKQvolRPCURnNCodM1uqseWmIiwRdQVk+keNoRC9EPJXP/t2l8IvO 6TEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681487941; x=1684079941; h=content-transfer-encoding:content-language:to:subject:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Hek6ZeYmsuQcBoX3FI6SjLHy8/IrJ8ALyyV2TFKIHxI=; b=ljTJNXIEOC9SLbeWz7/8EYinoWhGtqPYsct1qpQqEASjvN0+XI3WA8A4EzwK0dh9Jp kfZm/sLMGHgdbEf+r88QnS+Juljb4YeIXtH5Czipy6NT4Otk/8EbvEN507g/EiE4sC5J lDFtZ6uQ8m0ZD/ErVcukJIElHsyZ43lVAOTY5O0LsPB/0Iyt4grqLEGBWpAVJdH8S/1E W15ylWLa2PeSWHUTT7gF1Q/dlJ1NFaV9VUaHrlO5t4j0w2+EI1Oafo5nCwpRzE4bGh4q +gIfQqNRUdwNyR8KjELP9qKD4X6q26gTeu6kH/LfW9utSizbRURqIgzevvEpaPER4/J6 8r0Q== X-Gm-Message-State: AAQBX9esptNgcEDE/52Hs41nrgYBtNJ/SQaRJV8KlW0gLaWbZUuO8i2l Dq2hQUm3IAvZJMLFhNNRAmm1xXEZ6aT8JA== X-Google-Smtp-Source: AKy350YlVolR6Ez6bKkCv04N8+H7mGjM6DKTK17LHbbiFm6xmq0v4q7SYoo9W3unSikIk5vuVyc+8Q== X-Received: by 2002:a1c:cc1a:0:b0:3ef:6b97:f0c3 with SMTP id h26-20020a1ccc1a000000b003ef6b97f0c3mr5068973wmb.15.1681487941039; Fri, 14 Apr 2023 08:59:01 -0700 (PDT) Received: from [192.168.1.216] ([81.0.1.1]) by smtp.gmail.com with ESMTPSA id p6-20020a1c7406000000b003ed2c0a0f37sm4568552wmc.35.2023.04.14.08.59.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Apr 2023 08:59:00 -0700 (PDT) Message-ID: <260ab8b9-ddbe-c933-9a08-3420c4a02189@gmail.com> Date: Fri, 14 Apr 2023 17:58:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 From: Suraj Shirvankar To: ffmpeg-devel@ffmpeg.org Content-Language: en-US Subject: [FFmpeg-devel] [PATCH] vf_psnr: 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" 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.34.1 _______________________________________________ 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".