From patchwork Sat Sep 26 10:28:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22618 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 553B944B313 for ; Sat, 26 Sep 2020 13:32:47 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BE17568B832; Sat, 26 Sep 2020 13:30:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5E5DF68B78A for ; Sat, 26 Sep 2020 13:30:20 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id g4so6628114wrs.5 for ; Sat, 26 Sep 2020 03:30:20 -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=MxAQcCZXRlmLDsmjzWU+fXCThcTmSOLKftW4jzb2l+Q=; b=FA5E5TNRapRYutStVGC+04uZfeQLrvImQ0a7JQw2r2Oqg9OQ5f1c8mlP2ajVTAo40J p6EWYv1OYKVnfzhUwz7bRGpQ5Gabcs5rZ4tVE0rYwJkampidNpcJrJB/r+LIoQYjix4O nWleblJWKh8fo92qqyLaLJUhW8hC/E0p74bzU/befqfwTyzkjT1rj2/rnWyKI0EteK5x 3+ROpFKOQAonCilLo/WLvngDjdW9r6zBqxNMUGRywobp4mrHxMIIthCxE3NSMUwFUGyQ HKBdvQ3moprzqJWvGvXGQo24BVR1OmkCoGgGhXyf1eeBMLgPWkTRhlznUjIX32jtJbKn kYVg== 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=MxAQcCZXRlmLDsmjzWU+fXCThcTmSOLKftW4jzb2l+Q=; b=J/p43v+LVw+ox7glIt2nKQGjz6ICyy3Dqi0WP6BPwX8OodeBSsVnkr+RMSwUJhvyW5 w+sonoonwUTeyCurS0RNrJEHa97T0yKnJ+s8rw8e82ZrxXkhY5f+kBhZZ6R9b5UEOPB/ g9YzJ9wkFSQZZy8Lqk0PdwGcb9vrB0jbEMh+n+1W3YUYl11vyt+9j9lb6my0Zsl63LS4 TyCTZh7AVZ6ll7dLMTAdffz8pZYk4fHJHBgvyHKxSAb8qhlPkBXE0OwxoEcVFPpm8plT STD/N1rIB91xuar6wGYH+EvJqg1+e25s03yYyvhMncc9LOS0qIcBVmrioY1SRV3HE7T9 iHWw== X-Gm-Message-State: AOAM531XnNtALQjhg+2SWYdxNmn3Whq5egxHIsOL6zy43SJHfxKfPI/V nWBBFNlzIXEyR0T0JvRugxKpaMc86RE= X-Google-Smtp-Source: ABdhPJx2VLYkhx7X2r+qCRh4ZPjPBXF4REZUhoS/pEheiWd+hpLMfV9qoMJaXf3HDwsP/9GtJ4HQyQ== X-Received: by 2002:adf:cd05:: with SMTP id w5mr8966728wrm.62.1601116219416; Sat, 26 Sep 2020 03:30:19 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 03:30:18 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 26 Sep 2020 12:28:03 +0200 Message-Id: <20200926102804.228089-24-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 24/25] avcodec/fraps: Use unchecked 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" The fraps decoder already checked for overreads manually (and errored out in this scenario), yet it still enabled implicit checks, leading to worse performance and more code size. This commit disables the implicit bitstream reader checks. For the sample [1] this improves performance from 195105896 to 155851561 decicycles for Clang 10 and from 222801887 to 168270467 decicycles when compiled with GCC 9.3. These values are the average of 10 runs each looping ten 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index 7a7673f73f..00fd63ffec 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -31,6 +31,7 @@ * Version 2 files support by Konstantin Shishkov */ +#define UNCHECKED_BITSTREAM_READER 1 #include "avcodec.h" #include "get_bits.h" #include "huffman.h"