From patchwork Sun Aug 22 14:54:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29726 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp1321911iov; Sun, 22 Aug 2021 07:54:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPtMjB0WQkWe/5pCFYgh7ZR4q28l3LbFGfRiS+cu4vnZ6cpmAX1pYfnuqAyvm5J8cHemM1 X-Received: by 2002:a17:906:11c7:: with SMTP id o7mr31407910eja.480.1629644073595; Sun, 22 Aug 2021 07:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629644073; cv=none; d=google.com; s=arc-20160816; b=FyFVJ05senJG1zDRpHJ7vj0sXlk5b773Z5c8T0fKlUWg++8oIcsREJs4zGSR54VZ/U GKplTqKlBqvcmnyaF6+s9hhAgdfOvFEqDXxMkBVeTSnTcVk9S5MugP6UnxEPwWCCRTD/ zFVw/HTySOGWVryQNJRJf6ygK77n54kQsUkAFt1nTiPfLSLIoHxED6nvt+V+fB+gbViD ZobpvP9gmgTD2JN0y85xjCwPus10bj4dOf9B3/y91JjOuOqNzpMzSoeql75u0M8Fu91f pjUq3dVwT+6AF+wVEJaZXlIfyQA4uGe/yHym8mHhKJiJV9dGXkq90bCNUfgpIeG7olFl xtnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=daZRWtg4qdGBqt+U9a3rDDzfA2pWGwZ5ogCoQaCR2qs=; b=GGIWluBBvh125klzuwTDQynxi63hxTD5kPcBGPiz7XXeDDyhtTEtcJs9E3B3IpddAJ 8wadCZ9YuFKwnTx62SKx7Y/t8Lu3L40qRvINBrYotRd/OFWVr9THcaxCE3DNBWe0NFCI mUPkv+DhfDelIUwLKU73vj2S1EI938TbHaEOOvxkIMqQwECJp54JMekMX/Wps0xbL3kL MQcxecPOspdPIkKemWRNEOVo5PQRg2TFm5pv6DwUUF4iKcTF4328sHD1wEAFMUCSw2P6 HeyAqlGFuSbCxe9qkLLsDL1RPGwLnAUVOUhBHSzUdDWeiMgBNrPM7iayF5xTP7j0IW9q 3OKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y7si11702403edu.188.2021.08.22.07.54.33; Sun, 22 Aug 2021 07:54:33 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 530BB68A2F4; Sun, 22 Aug 2021 17:54:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ACD41689A52 for ; Sun, 22 Aug 2021 17:54:12 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 17MEsBXK017311 for ; Sun, 22 Aug 2021 16:54:12 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id E0E83EB5BC; Sun, 22 Aug 2021 16:54:11 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Sun, 22 Aug 2021 16:54:09 +0200 Message-Id: <20210822145409.316517-2-george@nsup.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210822145409.316517-1-george@nsup.org> References: <20210822145409.316517-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Sun, 22 Aug 2021 16:54:12 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 2/2] lavi/pixdesc: simplify depth computatoin in get_pix_fmt_score(). 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: WKTXmzmcQmJG Signed-off-by: Nicolas George --- libavutil/pixdesc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index f1898a6a13..967de7dcde 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2721,10 +2721,10 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components); for (i = 0; i < nb_components; i++) { - int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1); - if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) { + int depth = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components + 1 : dst_desc->comp[i].depth; + if (src_desc->comp[i].depth > depth && (consider & FF_LOSS_DEPTH)) { loss |= FF_LOSS_DEPTH; - score -= 65536 >> depth_minus1; + score -= 131072 >> depth; } }