From patchwork Sat Sep 26 10:28:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22616 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 21FFD44A10F for ; Sat, 26 Sep 2020 13:30:27 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0ABA868B83C; Sat, 26 Sep 2020 13:30:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6DE9E68B7A4 for ; Sat, 26 Sep 2020 13:30:22 +0300 (EEST) Received: by mail-wm1-f68.google.com with SMTP id a9so1881230wmm.2 for ; Sat, 26 Sep 2020 03:30:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZzDsxeXDB+Tk6R6kDjozQCnugVBhKcZ+aHLwkzyFS/A=; b=BKWIZFfdYgUjP1gcpm+b8Od33lImhICSa/ULolMESyW3zHZ0IhneeE5t566zN719cV z3WcWPUYlLh7cYkWvvdkeKw5NxHbeLork2FS9Hbyh35uUxuzCdXe7470QKyTvsbpItWs DgWmlTdomfv9KoqBcXVXN0M3suLS6xmCN+NCe4Zam++FIl3YPxRgJTky4pT97ShxHdyR idVZ4SXOi/SLJexOaNQ7y1UyBfTX4sQgbwsZaOV0v92gtY0LwXRr1XQppN6ZASUKX2cL VsH8AzWi5Iq3UbZnzA6NabRA91noN2UIBPnGYMAuhpcG8rwsnuyLwGMkzyGs2WqOXHW9 ikVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZzDsxeXDB+Tk6R6kDjozQCnugVBhKcZ+aHLwkzyFS/A=; b=VlZC36chglut6QiJI/WfqU5yh6Kq5qtFwmOEjQuMe9eWOc8x6rgaSPrt5Ew0AJYrNF ZuwkNHgOMT9iAxpRDz992AZpPm+H26crYXv3LDTYtS/xpMLKHebBUnJdvbcR/FdTSdVE mPCWzarnFcWsK50V4voNBrAA+I6bj7wXdiaiTr+XXEXA4AQNh0DUG6sgb9/XMalehwBV 2aHoLIdCZsQW9sxLy4yL7W0mTcWjuhh5kWS5ouCRMTLcoUlUHIf8x73o+MsS0eATgvTC YjZzkNwEpV1yqW8+jEKBj9SUCnu8vVku1xoKXuEm1P8pDZPs83tko1P90TySmK76Ppaa TiOg== X-Gm-Message-State: AOAM532jQNS0cE05Mp410Jxpgq6qIWhYHafPMpsyui5NaMTo11MgHMj8 4IQryVr+cBJfBkUse/HoC00qdOpOkzM= X-Google-Smtp-Source: ABdhPJySATI5ExrE6fThQH5uNLqT8OLEiEPlzVEAPvC2Dr0UUxJIioqHSpZ8s0cnQxElQx/x9A9bNA== X-Received: by 2002:a1c:e1d6:: with SMTP id y205mr2040082wmg.92.1601116221460; Sat, 26 Sep 2020 03:30:21 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k8sm6064867wrl.42.2020.09.26.03.30.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 03:30:20 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 26 Sep 2020 12:28:04 +0200 Message-Id: <20200926102804.228089-25-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926102804.228089-1-andreas.rheinhardt@gmail.com> References: <20200926102804.228089-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 25/25] avcodec/fraps: Use cached bitstream reader X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This proved beneficial for performance: For the sample [1] the number of decicycles in one decode call decreased from 155851561 to 108158037 for Clang 10 and from 168270467 to 128847479 for GCC 9.3. For x86-32 compiled with GCC 9.3 and run on an x64 Haswell the number increased from 158405517 to 202215769, so that the cached bitstream reader is only enabled if HAVE_FAST_64BIT is set. These values are the average of 10 runs each looping five times over the input. [1]: samples.ffmpeg.org/ffmpeg-bugs/trac/ticket2593/fraps_flv1_decoding_errors.avi Signed-off-by: Andreas Rheinhardt --- libavcodec/fraps.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index 00fd63ffec..8d01b44f11 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -31,6 +31,9 @@ * Version 2 files support by Konstantin Shishkov */ +#include "config.h" + +#define CACHED_BITSTREAM_READER HAVE_FAST_64BIT #define UNCHECKED_BITSTREAM_READER 1 #include "avcodec.h" #include "get_bits.h"