From patchwork Mon Feb 5 14:29:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 46042 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7b08:b0:19e:8a94:b663 with SMTP id s8csp784948pzh; Mon, 5 Feb 2024 06:29:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IH1XRekS0+FTUZGqDbzZ3s7dgWHqWZqIRZ+2bra1UAsVpbJNyJiv5OJ2bb6K9LtyMM0GFiE X-Received: by 2002:aa7:d347:0:b0:55f:fb28:2701 with SMTP id m7-20020aa7d347000000b0055ffb282701mr4760324edr.1.1707143380008; Mon, 05 Feb 2024 06:29:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707143379; cv=none; d=google.com; s=arc-20160816; b=MjN/3mn1sU1IBZ38riflsgEWRizDGDdRC+ouQ290Yq5cRueCFDPIzXSXzHmMeaz4bu oeBAx9bC6hhwiCWZICerflR9VxffFgmQA/ER8LLT+LwtFlFHo+sBgDLB/87SJISbag/0 85HvDurY/OHU4TaFhyID90pYSD+pojSSfCR5GkIaAoUoXhyUm0EaGAD+xEerPUBy42r9 iPQ0Gj4y13L3oHL/8IQd/TNnhNeMBBzm0LylgAEUiLyWscIURAZ3oeR78JkO+RvqlaMs eFpM9SP4GQojxQIdkJIRVEBdyBh57hKCzUFxGYUiSPklnCWFeXyuXcZRLp9CMlDUgumk b+cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=UL7eoH6FMmMGfH+CndLfackP/6HigQJDK0s+INuNGyo=; fh=ngrqVFGRc6/7sB9vL2beCH25JgR629bHlzoh0srHqzQ=; b=p4ga1CXq1+PtJQ7C8s1uUyELjQT8NWq+FpOrDBHDvwxyKXDhe7ij9fwjf+DgIDPjgE /w1stOhZ2Yg99jO7T71JoMiNLfvMD5bDBOYmczLCJLIVFUtVzmnbTFaoqXO1y27NBMEB GfAr5boS147OF4/B94BM+MDpWVQAOp2YOuHL7i6YJqprlQ728DsnoL9k8GIpujVq/KyY o4XSjAPdY+p1B0a370j5bbfL4DGrZ7cc3nKr+5bfT/h3KsfJFpu2s0jUUbHrP+aviEW8 mRfa99amjQMUSg4GBqfyKbFYKiOm0rL4OngcGwMEJF1YZMX6xZjxLm6PK+oepW6LI/da aQkA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b="gc6vyao/"; 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 X-Forwarded-Encrypted: i=0; AJvYcCVv3d9nXMVrI+Fb/SR0Da7IA6ZqmoaIeCaqi/Bdth/VJMkoJduM5Fz5Ud1IIG9BhU/Etl0cLcOV3K1yFunWtSw2+DDvOSCtvfWn995Hjtf2Qgh6c96QnoTh9abQ8mLysi8dXThIrKr8Gc3/KeRU9AeMIe08p20PX6X4brKdocgDAuDt2LBHD6S/SGaShNple34hnz1aqbE6XxMzsqZhwJgzXA6O3DgJ6oIhxUgBXbXp2vgKdPdxYZ/1Agh1Zzpn9J+7wg7PFXnmbSf365ZdlPyu1ctIuqUoDSv72SImgZhmmnCCx8VLMOMw7tIZLq1d65p8E8dTeHju6aTNzd54j2ETUfAGeTc/yDi/44u31T2Sso08wfvKbTPd5cBTXPzHy/MwNRc5NqmM4k4zw5dephKt3lfgS8gMAiqNGeXYoz8uDouvk6YbqY+QpE1IyDkqAwzqxwSTK/xz12ASZ2YrlZysY7oA0dC8XVBKeHShW/7vdnmXZTL/ov2evI4w+Ugka9gOKHxilzyb2nls34EDC2fHCD9Z2lSbgcOVZGzs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Tw== Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ec14-20020a0564020d4e00b0055ced896819si4034235edb.212.2024.02.05.06.29.39; Mon, 05 Feb 2024 06:29:39 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b="gc6vyao/"; 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 8837668D13F; Mon, 5 Feb 2024 16:29:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D8A5068AF3B for ; Mon, 5 Feb 2024 16:29:30 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1707143370; bh=2EjVz5fCq0YOx6/l0gDPVP3TY2sMggfoBWJ2qAzozQQ=; h=From:To:Cc:Subject:Date:From; b=gc6vyao/tEPtnn/0ovA2Upv8Y0192cLQfPEI3q/xhDAi+wdNLDwqszAM3lJfHp7FO rXiTe3gEIJbf4P+X0K6LtM4R/JeEPEKRYf01EuVoNG2qeXXIPsF4BgqE9vv1zFtZ3n mYeUL+toGTpC9t3/Wz2dzEJX99mbTrZVOXX7r1Po= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id A22B6406AC; Mon, 5 Feb 2024 15:29:30 +0100 (CET) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Feb 2024 15:29:25 +0100 Message-ID: <20240205142926.12050-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avfilter/buffersrc: promote unspecified color metadata 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: RkwBDZpVloLC From: Niklas Haas Currently, this only affects untagged RGB/XYZ/Gray, which get forced to their corresponding metadata before entering the filter graph. The main justification for this change, however, is the planned ability to add automatic promotion of unspecified yuv to mpeg range yuv. Notably, this change will never allow accidentally cross-promoting unspecified to jpeg or to a specific YUV matrix, since that is still bound by the constraints of YUV range negotiation as set up by query_formats. --- libavfilter/buffersrc.c | 5 +++++ tests/ref/fate/rgb24-mkv | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 6e450ff6b7..93fadab65f 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -291,6 +291,11 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif + if (copy->colorspace == AVCOL_SPC_UNSPECIFIED) + copy->colorspace = ctx->outputs[0]->colorspace; + if (copy->color_range == AVCOL_RANGE_UNSPECIFIED) + copy->color_range = ctx->outputs[0]->color_range; + ret = ff_filter_frame(ctx->outputs[0], copy); if (ret < 0) return ret; diff --git a/tests/ref/fate/rgb24-mkv b/tests/ref/fate/rgb24-mkv index 99234f1052..1cbed136dd 100644 --- a/tests/ref/fate/rgb24-mkv +++ b/tests/ref/fate/rgb24-mkv @@ -1,5 +1,5 @@ -e181dc84058c3584598333dabd110123 *tests/data/fate/rgb24-mkv.matroska -58225 tests/data/fate/rgb24-mkv.matroska +7d767e8238c674ecfa80458cb281c09e *tests/data/fate/rgb24-mkv.matroska +58236 tests/data/fate/rgb24-mkv.matroska #tb 0: 1/10 #media_type 0: video #codec_id 0: rawvideo From patchwork Mon Feb 5 14:29:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 46043 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7b08:b0:19e:8a94:b663 with SMTP id s8csp785023pzh; Mon, 5 Feb 2024 06:29:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGo/LfBa827eeSURsqWn/6JsrtHtX/8FmVJX0LvlMPPQm9F9IqwbAUCm2LuOkXOdPf/ZAK8 X-Received: by 2002:ac2:58f3:0:b0:511:4b1e:8721 with SMTP id v19-20020ac258f3000000b005114b1e8721mr3259847lfo.7.1707143387548; Mon, 05 Feb 2024 06:29:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707143387; cv=none; d=google.com; s=arc-20160816; b=in8nz7ar1vqBiv6oQEdutzYHFwAAy79sDvutA6z6/MDMtwYat9RS9XeG1avXkKL+Ys UXlFYqUpAuRaXbiadm26uLfW0+4OSIMMD9GuwGuQ8zgASaMAjcaM16e5r0mcgeDNdShv M33Yx2vFQCVW2eIyLmuxsQ+2aox/wUy4dDJSr4rQa1j3UwKriU43E5Q6f/urKZ1Jr7WT FRv9Ecnh7kZanBGMnHvc/b/qePX4sx9sgR9q18qt/s+9p1AUgEIsXY2cNYH3oUYfjwBE CpYEevCtNAbli8Lqdk5qC/e5h38ctneCydYlGaR9ETyWpkl12d0mVj9agn1AYoxd1aQn dtIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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:dkim-signature:delivered-to; bh=eP/+GRWku2wN7WslCHGVpm5paY+pjPmf4p3vlVUNjEw=; fh=LECZR4hWQQJoygrxj+bOllDEGrhoG9btEBt9sJuT4kM=; b=tZS7ViT+oJrl6RfAeQq1JEiC0hVQ3affNX+9DPvTykKo4sQYpW/eUXAkro3XHT1LpB DcUfwD520Vcm3zPzmnw5G7O7aAUYvtjvoMQFKckVFBEz71bdjP+VN2BWLtYEuE7VBbMU 58AmnQuKgCBI5nV+3wuNYw8O4N1pD+CsIBdEgV/jQSOWbK4CimXcmwXFajXAvex4P4UW j4pvAm0+l7k3Gv4dPp5SdUoirKFmUggSjUWX3qVvVQV6SGOVOQwseQUKBSqqXufut4d4 hT5uiOztqW+aP4fZtNYJcUDiMUr8GKH9U7WOj20y+26nNYmNheZYnl8c/dg2tuHScRBy B0zg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=vdo26xui; 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 X-Forwarded-Encrypted: i=0; AJvYcCWPp1WNBg8wFZZWBQJdSkmI8s705T0ZPJLC0gsHvOxQVkAOuyCnb+oN0j+mLStyIhMDYGW9cJNAOknz9tJvzbePa1xV1l0SWmTk7p5cI736Swm6VPVhLKkjoBGoa8WRda1wkgKQlHeQ7p607hyjUP3nc6md8OUD3cfudB9NS406nzVsAD78fizBMCJUg/vRqueYqqOQ5VX1ZePzmEP2gcYjtcURkdpNMyjN0dZf0wW6sNrg7eqgQ10WaIBS0QgjPJ2kTluS+GkhZKRLjUAoRS2OfzmWztkfPlfBgBubx3ciz22rTBMO55O1C2JOAI/woFWT/yijqSneny6tgOem5L3M76Rugsv+/jqAXFc5ZEtMUac9OVDgo1pnWbgizU0F+PNzXIyBKNLKMI25QTd9BK+30TxoooJ2YRdzPQpqhS7OWeAy0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NDeAT5DJTIxG4AjiUOtF62ZIJ+V2766wkQV1Z3c7BOmxSYd3p1X3xUZHk71lq7TKmrw9g0+8yJ50vDm+XUm2L8XfhIDYQEIsGOt/HcZnzlV9U= Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hg19-20020a170906f35300b00a37ec299a7fsi344900ejb.829.2024.02.05.06.29.47; Mon, 05 Feb 2024 06:29:47 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=vdo26xui; 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 65D7368D14F; Mon, 5 Feb 2024 16:29:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Xyelzb7t7j3L 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;