From patchwork Sat Oct 10 00:20:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jan_Ekstr=C3=B6m?= X-Patchwork-Id: 22821 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 2C61F448255 for ; Sat, 10 Oct 2020 03:20:38 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EB3EB68BA20; Sat, 10 Oct 2020 03:20:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BE5AC68B9DB for ; Sat, 10 Oct 2020 03:20:31 +0300 (EEST) Received: by mail-lf1-f68.google.com with SMTP id j30so10070349lfp.4 for ; Fri, 09 Oct 2020 17:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ztaXbjBVcAAkvgAIoDDBGEN3b2waulubFNa9jO32HXc=; b=H8BOFpiozlUMpxxDq+RIsWL/ixuZshKl/jfUxrJ8lRZBN9ilS3w/CpMSMrv7gNJXqJ kSklp86veJ1OyfIE1qo14e2moyJvyCnyehyDkxNM25rII5t63fBUy4czYHAXpNHOc0MF MYzt4/nI/kWJEHVcRBqo54R1i24Me7tqROsH3XgxTQvC714INbp6BopD/15ACcsvYt9O H8x9KqdIs8DBnlkitEfQ+5bsnqXiqtpdr8E/YwxyU7WSg56xjqR7MVZlTU0MFuM/yVxm LArDdO91anqjPQmNlVs0+4Q/THvptfoxiaY9M2AoGZp95duEx3FGT+JaocNhiIBdYWVW mQ8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=ztaXbjBVcAAkvgAIoDDBGEN3b2waulubFNa9jO32HXc=; b=S6RwH0+rDpdLF9HyHmpjJ9Y4P2/weJcu/T/0QWzDkkeFN1fgTCBx/aDhQ65X9W4sta alsTwf2cPws1v9DibnMImKUE8WuochJShmJmJw2lug25AJCLFbwBeDNYcXgCVQUYgrjr 6DzpwDU3CMFnQXoXkrcxvzbe8rzBTTrUa/xb3LFhpLX6MZ7QMhHKWalaTJ5ofG5Abb8m 7+fyOE3YAN+J+KrVhXyiFUeR0Mag5nQd62rQ/dnQYmXW/9hYKPSEGNWJuLaCupWLgVXl zipZ+NpKr73H7omehGm9a/bBwyEhRf9S037NJfEI1aiQc1B8afBchyWrdEh9OUUILIUz N2kg== X-Gm-Message-State: AOAM530pZgdU0P4TzvZYuST1OwlxcZxJCIMKuAy9E4BW8pQhKcjSuCp2 AI2j0HEQ50H6ucdHdjzsJyKh7tV1M3U= X-Google-Smtp-Source: ABdhPJzdcSsXnKFWlvUqSapr28LXw2qTk5bdpNsCETRQztTKts4dskiLAmLydPX2VfPU/eZz32JuIA== X-Received: by 2002:ac2:55b0:: with SMTP id y16mr2637931lfg.155.1602289230716; Fri, 09 Oct 2020 17:20:30 -0700 (PDT) Received: from localhost.localdomain (91-159-194-103.elisa-laajakaista.fi. [91.159.194.103]) by smtp.gmail.com with ESMTPSA id f129sm623772lfd.201.2020.10.09.17.20.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2020 17:20:30 -0700 (PDT) From: =?utf-8?q?Jan_Ekstr=C3=B6m?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Oct 2020 03:20:28 +0300 Message-Id: <20201010002029.6837-1-jeebjp@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] swscale/utils: split range override check into its own function 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libswscale/utils.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libswscale/utils.c b/libswscale/utils.c index 9ca378bd3b..832c9f873c 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -864,6 +864,11 @@ static void fill_xyztables(struct SwsContext *c) } } +static int range_override_needed(enum AVPixelFormat format) +{ + return !isYUV(format) && !isGray(format); +} + int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation) @@ -876,9 +881,9 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], desc_dst = av_pix_fmt_desc_get(c->dstFormat); desc_src = av_pix_fmt_desc_get(c->srcFormat); - if(!isYUV(c->dstFormat) && !isGray(c->dstFormat)) + if(range_override_needed(c->dstFormat)) dstRange = 0; - if(!isYUV(c->srcFormat) && !isGray(c->srcFormat)) + if(range_override_needed(c->srcFormat)) srcRange = 0; if (c->srcRange != srcRange ||