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 562AF491C2 for ; Mon, 5 Feb 2024 14:29:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 35AF468D125; Mon, 5 Feb 2024 16:29:38 +0200 (EET) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0BBB768AF3B for ; Mon, 5 Feb 2024 16:29:31 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1707143370; bh=PpyFGwGir4dFg0rnQUBnG+4GgV82yiQdGNE6MRlB5gA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vdo26xui5YcRWqsSXJXyCSxzxpxEPZbc8taRPVBeT4xISYq9X0rvaThVKN4s+Ucb0 OuojeOZRRWxp8jZ02aVsEBLsVBEnoV0+3/0NfQ95otRye3QL5OcJBSd+n5wKu0VSZb lpHFL0Ajy5NN8tv/f4QDuP4ZLnux/Y52ymGgPwWo= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id D444640CCA; Mon, 5 Feb 2024 15:29:30 +0100 (CET) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Feb 2024 15:29:26 +0100 Message-ID: <20240205142926.12050-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240205142926.12050-1-ffmpeg@haasn.xyz> References: <20240205142926.12050-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avfilter/buffersrc: allow promoting color range to MPEG 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 Otherwise, passing an UNSPECIFIED frame to am MPEG-only filter graph would trigger insertion of an unnecessary vf_scale filter, which would perform a memcpy to convert between the two. This is safe to do because unspecified YUV frames are already universally assumed to be MPEG range, in particular by swscale. --- libavfilter/buffersrc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 93fadab65f..a6a000df1e 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -506,8 +506,14 @@ static int query_formats(AVFilterContext *ctx) if ((ret = ff_add_format(&color_spaces, c->color_space)) < 0 || (ret = ff_set_common_color_spaces(ctx, color_spaces)) < 0) return ret; - if ((ret = ff_add_format(&color_ranges, c->color_range)) < 0 || - (ret = ff_set_common_color_ranges(ctx, color_ranges)) < 0) + if ((ret = ff_add_format(&color_ranges, c->color_range)) < 0) + return ret; + if (c->color_range == AVCOL_RANGE_UNSPECIFIED) { + /* allow implicitly promoting unspecified to mpeg */ + if ((ret = ff_add_format(&color_ranges, AVCOL_RANGE_MPEG)) < 0) + return ret; + } + if ((ret = ff_set_common_color_ranges(ctx, color_ranges)) < 0) return ret; } break; -- 2.43.0 _______________________________________________ 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".