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 EDE8E4654B for ; Sun, 21 May 2023 13:54:32 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6B34C68BFC6; Sun, 21 May 2023 16:54:29 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7E09268BCD7 for ; Sun, 21 May 2023 16:54:23 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 295D744018; Sun, 21 May 2023 15:54:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1684677263; bh=SnFJBK/h4KQyb2Fko7lXk4uYXPecyWt/96F1F0RR9tU=; h=From:To:Cc:Subject:Date:From; b=pq57MjUVq1yCM2DSAsm0YBjXFifmMgTkdquJxpVTthD6+chB1oOhIW/w2UcmJlUA4 tUpsYFY/qBHcUG1mmiQGLf2LDesmRk72MOAxmiUpFurbXkIFeKP18X0xxGl1SxjOMT jncsFl7u+wmo2nxFO8YNO36ndpukZJSE30Czvm0A= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 21 May 2023 15:54:20 +0200 Message-Id: <20230521135420.15319-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavfi/vf_libplacebo: add RGB colorspace sanity 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 Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas Explicitly forbid using a non-RGB colorspace with RGB pixel format or vice versa. This mirrors identical logic from vf_scale. --- libavfilter/vf_libplacebo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index f26d0126beb..e5af2693293 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -695,6 +695,13 @@ static int output_frame_mix(AVFilterContext *ctx, if (s->color_primaries >= 0) out->color_primaries = s->color_primaries; + /* Sanity colorspace overrides */ + if (outdesc->flags & AV_PIX_FMT_FLAG_RGB) { + out->colorspace = AVCOL_SPC_RGB; + } else if (out->colorspace == AVCOL_SPC_RGB) { + out->colorspace = AVCOL_SPC_UNSPECIFIED; + } + changed_csp = ref->colorspace != out->colorspace || ref->color_range != out->color_range || ref->color_trc != out->color_trc || -- 2.40.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".