From patchwork Thu Jul 4 11:51:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 50330 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp3664251vqv; Thu, 4 Jul 2024 05:04:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV7NfygHQV2PpVeQF2JxDtno+6iyEaO58ePqPmkCvZ2EXL11KQKjeF5zA7/TtqQmLDSF/H1AJfWIkfMjtfXAkdCdhFQLtVVRxg6lQ== X-Google-Smtp-Source: AGHT+IHj3k5Mpy9cRP2oDtJqjzsEzLXwNwyNLS0LCrtH73OLcLO/Ig+vvnIIHD0NwT8u3vytkQcu X-Received: by 2002:ac2:5f9b:0:b0:52c:dbe6:f5f9 with SMTP id 2adb3069b0e04-52ea061851amr1103315e87.12.1720094653143; Thu, 04 Jul 2024 05:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720094653; cv=none; d=google.com; s=arc-20160816; b=VGVCE7vQ+TgkdoxCglyYyWrnPI9sNdy+hMKrS+ny1TeFLUAi90o9ea+Cyi8A0McilO 4pI/rHM/fsT0fmfhn/yYlLkGtQGa/VVU0HwuabPDMQ2HRBQAwVNin8cg5uM0WmDSDOu6 vCMsqQ9ysnmG4k9/52sifqQqlatgKSXtbjPQaqvrsJ4fL1I0qKGR23r3sg4sfs/DXdbD /d9lBxvktP2CtUZJlUw1WooSLkRvgYC5qZ0O8hWfN94ypvuwwjW7gv42Qvqf3/sRTSVF kiDYxPwe7rghzYFSubIDRsqgZf8ny6XHwRpg4zrdkL5Ibm8TQ+oveSevgUE/Ny25/ps2 4UQQ== 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=531542hJeTFDZmpCYDoxmu5f5Tb21Er2a4er3bcJesQ=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=fxNhzTRav/CWK1RdVDHO8deSiHp+8BIo3pbHMBGUi/m6Y1dlYr1SgF/f+hzsZFjnnb nD8Z5n0dtcdu7b4ZVSeuiNLBtryJsrMBmKcBvoaMO5N0jXziWQQk5/tGusxIPmPy1EjY 0mvaHKRKxjztIMACy0pE+gaurDVvbzw06Q9wdGiaGoaUmk473O1qdeOmdvDOK1GwBD/s 8zw4JuAKun3jX7YVf+/WhfJ2FIbZF/8R4jZ81w6rxdsCmhL9cgA81MKNqK7rRcfii+oE nQXs/4WKECXeqbuzzheV2J4UwoHKSuaSk2oc0q3Pj0sqXeeM3lDeuzLdIHEzgw1pzEzy dNfA==; 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=tnOtsTZP; 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 2adb3069b0e04-52ea2c1a285si47284e87.613.2024.07.04.05.04.12; Thu, 04 Jul 2024 05:04:13 -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; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=tnOtsTZP; 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 0CE1968DA25; Thu, 4 Jul 2024 14:54:03 +0300 (EEST) 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 E3CD168DA10 for ; Thu, 4 Jul 2024 14:53:50 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1720094029; bh=njzY9Ocn/6dWnV/LQc9JDqH9/D813PFysJ01a37js5I=; h=From:To:Cc:Subject:Date:From; b=tnOtsTZPSrVI2VaAHPjKpJJ+ORUMgVKM3ULfym+Idmirxamo9ark8qaEJhVo6pqXD GTrqaFlHRFzi6LE8zx5PU2Aa0holpflMUmRT5/HFvpsO7fen2cn/3z0TcNxwNuQKVD KgWc7xo+RorOmiLRLC++HlmPO6gfR9QCy+qfeiJ8= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id D2D9F4013C; Thu, 4 Jul 2024 13:53:49 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Jul 2024 13:51:57 +0200 Message-ID: <20240704115202.1235954-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/6] swscale: document SWS_FULL_CHR_H_* flags 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: XMtJnG+JGU/d From: Niklas Haas Based on my best understanding of what they do, given the source code. --- libswscale/swscale.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale.h b/libswscale/swscale.h index 9d4612aaf3..e22931cab4 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -82,11 +82,35 @@ const char *swscale_license(void); #define SWS_PRINT_INFO 0x1000 //the following 3 flags are not completely implemented -//internal chrominance subsampling info + +/** + * Perform full chroma upsampling when converting to RGB as part of scaling. + * + * For example, when converting 50x50 yuv420p to 100x100 rgba, setting this flag + * will scale the chroma plane from 25x25 to 100x100 (4:4:4), and then convert + * the 100x100 yuv444p image to rgba in the final output step. + * + * Without this flag, the chroma plane is instead scaled to 50x100 (4:2:2), + * with a single chroma sample being re-used for both horizontally adjacent RGBA + * output pixels. + */ #define SWS_FULL_CHR_H_INT 0x2000 -//input subsampling info + +/** + * Perform full chroma interpolation when downscaling RGB sources. + * + * For example, when converting a 100x100 rgba source to 50x50 yuv444p, setting + * this flag will generate a 100x100 (4:4:4) chroma plane, which is then + * downscaled to the required 50x50. + * + * Without this flag, the chroma plane is instead generated at 50x100 (dropping + * every other pixel), before then being downscaled to the required 50x50 + * resolution. + */ #define SWS_FULL_CHR_H_INP 0x4000 + #define SWS_DIRECT_BGR 0x8000 + #define SWS_ACCURATE_RND 0x40000 #define SWS_BITEXACT 0x80000 #define SWS_ERROR_DIFFUSION 0x800000 From patchwork Thu Jul 4 11:51:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 50325 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp3658170vqv; Thu, 4 Jul 2024 04:54:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW6MSqcL9u19OcOjlqpkSmAVbMkAasA8qxk/BKuA1En9JIh61xNUNel6WsjdwfgeuxrdUR1dFLnpBN0ZXSwpi+ewgc2ggM2ocsv3w== X-Google-Smtp-Source: AGHT+IH8RHQIBNeJoqAGSh0tVksMDPDdW5pMZ/UrZ57xwMTdMpBd0UmziFaPBS1VrKhPsF9fLP4d X-Received: by 2002:ac2:5b0e:0:b0:52e:9fda:f18a with SMTP id 2adb3069b0e04-52ea06cbe66mr917074e87.44.1720094043248; Thu, 04 Jul 2024 04:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720094043; cv=none; d=google.com; s=arc-20160816; b=SSYEDT9+g2maleHYwqugp6ykC8qDlGJZU6HQCycMyu/VyZFgFtDpBrQ+p+jgwtaOJc mgnHAvI8NudP8+q1gDf2ROD6NmxcLjRfRULMnc7D/JvHw+QFJVm4z44cQMA0C0Kblw/y bVpEdzR1ueZgJs2T8WY9IOL9CStoIP5fIjDkWLawowh1WdxbiVgQy00NbUJM2k7PPPhl Ep6GEOnwmXghWYMLM/gxo4MVQ8XH6Bc4t7hbcKmsIs8WD7yWXGwL0kgetu5d9kExn6mD LuuARx23E4ynmUyhomwHDWFImph+WgmikHrzjN9+S0t05jie3a9/eOnGX2+3VHE8023W s58g== 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=hXB2lwVPaIKpGLxEArgZI78H0KBho68NRciyDkLVE4c=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=S1mYzoyil/2rhKDF/fY9QBw2ugyoGY+bs0RMkYIUSS+sPwvfxu92Gp/i1rxJ3LMwyE Ri+qpONU1z2EAxS1t1Ec+XY7Ua12MXxO4fb8OtMQsTLarsCxyg7CTVWePmHqbqufmbQ5 jC2wmZovBTLRMyNLtyAOUGCOdBdaND12CBH8BMyk6xgV33BeClT5Iz5MDGdHcbUdr89t 3YJspEZXUf8BWhAaGM9F3ZKZT2WyKWm31WH6JA/j+vvv2sJs75C2h5A6YaLG5MPcLt+a Enhlzy9cYKCvZNEI8f2hqqaZkI7IIiCu1E0O7xiDsjn3g0KY2B4eQx62+LKTGV9Y+/Il cUWg==; 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=quiL41ab; 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 4fb4d7f45d1cf-58d8873ab76si1249774a12.320.2024.07.04.04.54.02; Thu, 04 Jul 2024 04:54:03 -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; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=quiL41ab; 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 EC70F68D9DA; Thu, 4 Jul 2024 14:53:59 +0300 (EEST) 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 E253368D9DA for ; Thu, 4 Jul 2024 14:53:50 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1720094030; bh=dRaAxaJdeXgnr5OlANUQFjp62oieGYX7zyJCc7x2UYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=quiL41ab2LFSlc6gGxAiCeIicki5zLdV3Xu1Xa9tnn/1hXJ7X3a3FLRjtjNXTzupx 4ztoTi+7EfhJ+GVYgAxmiJo1BbfbRWGpDIkSL64QHIM0t9yUGKbDW2cPQJ800IJAL6 etkquAyP/KEMSrFcArfUlejQdavbGNX05IWEluN0= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 12DD04033D; Thu, 4 Jul 2024 13:53:50 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Jul 2024 13:51:58 +0200 Message-ID: <20240704115202.1235954-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240704115202.1235954-1-ffmpeg@haasn.xyz> References: <20240704115202.1235954-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/6] avfilter/vf_setparams: allow setting chroma location 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: aqMqOUzfRGpK From: Niklas Haas Shockingly, there isn't currently _any_ filter for overriding this. --- doc/filters.texi | 17 +++++++++++++++++ libavfilter/vf_setparams.c | 19 ++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index c9c4f7cf6b..ca8f6e461a 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -22073,6 +22073,23 @@ Keep the same colorspace property (default). @item chroma-derived-c @item ictcp @end table + +@item chroma_location +Set the chroma sample location. +Available values are: + +@table @samp +@item auto +Keep the same chroma location (default). + +@item unspecified, unknown +@item left +@item center +@item topleft +@item top +@item bottomleft +@item bottom +@end table @end table @section sharpen_npp diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c index b7da8eb54b..ba32a6699c 100644 --- a/libavfilter/vf_setparams.c +++ b/libavfilter/vf_setparams.c @@ -41,6 +41,7 @@ typedef struct SetParamsContext { int color_primaries; int color_trc; int colorspace; + int chroma_location; } SetParamsContext; #define OFFSET(x) offsetof(SetParamsContext, x) @@ -119,6 +120,17 @@ static const AVOption setparams_options[] = { {"chroma-derived-c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_CL}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, {"ictcp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_ICTCP}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, {"ipt-c2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_IPT_C2}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, + + {"chroma_location", "select chroma sample location", OFFSET(chroma_location), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCHROMA_LOC_NB-1, FLAGS, .unit = "chroma_location"}, + {"auto", "keep the same chroma location", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, FLAGS, .unit = "chroma_location"}, + {"unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_UNSPECIFIED}, INT_MIN, INT_MAX, FLAGS, .unit = "chroma_location"}, + {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_UNSPECIFIED}, INT_MIN, INT_MAX, FLAGS, .unit = "chroma_location"}, + {"left", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_LEFT}, INT_MIN, INT_MAX, FLAGS, .unit = "chroma_location"}, + {"center", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_CENTER}, INT_MIN, INT_MAX, FLAGS, .unit = "chroma_location"}, + {"topleft", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_TOPLEFT}, INT_MIN, INT_MAX, FLAGS, .unit = "chroma_location"}, + {"top", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_TOP}, INT_MIN, INT_MAX, FLAGS, .unit = "chroma_location"}, + {"bottomleft", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_BOTTOMLEFT}, INT_MIN, INT_MAX, FLAGS, .unit = "chroma_location"}, + {"bottom", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_BOTTOM}, INT_MIN, INT_MAX, FLAGS, .unit = "chroma_location"}, {NULL} }; @@ -174,17 +186,18 @@ FF_ENABLE_DEPRECATION_WARNINGS frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST; } - /* set range */ + /* set straightforward parameters */ if (s->color_range >= 0) frame->color_range = s->color_range; - - /* set color prim, trc, space */ if (s->color_primaries >= 0) frame->color_primaries = s->color_primaries; if (s->color_trc >= 0) frame->color_trc = s->color_trc; if (s->colorspace >= 0) frame->colorspace = s->colorspace; + if (s->chroma_location >= 0) + frame->chroma_location = s->chroma_location; + return ff_filter_frame(ctx->outputs[0], frame); } From patchwork Thu Jul 4 11:51:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 50326 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp3658322vqv; Thu, 4 Jul 2024 04:54:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWV/ogNJfMWHKOQINXE2ITbSGNV5GGrp4x+SfVIX4Qu3vzni1C1JoGG/UsvY2dpk6FG8KkRw2f4cSxfslEyoNaIUR+kYZL/+ISpmQ== X-Google-Smtp-Source: AGHT+IGURFcUhZPGByZC9tpvzpyx4dPtaOkXukAhMVtcG9FOtJWzVr9vgKG/rApkQ+MapP0WyAhf X-Received: by 2002:a17:906:288d:b0:a72:83ad:f087 with SMTP id a640c23a62f3a-a77bd9e46a9mr88540466b.10.1720094063840; Thu, 04 Jul 2024 04:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720094063; cv=none; d=google.com; s=arc-20160816; b=XX03IjZSb8WfAe5MicCmE/ddAreri1TUjDp2yOc2c4wrkFtqR9x/ce3C1XHIOumXpe cjyFOnrbT3FhrRrWsn1/SEX9I0sMywW2ikWcU5c+TB50t50ud+ovWs4lcRM48gEAYLdv VPpBlfPTSMFF/y8uC/bMze87cQdvMGUKq2NAWvEpPUamNVvYeCMmrqyykON3EOl+DxnI 7FsYRft43Eguc+thcl8KCOANAd2B6ueDQ9bffEB23qRmJDkWzR5Bjv1qr/9XOGmcb4uP VecJk92E6z6tvIoNybKJh281CpVFzv0uKjE8kp/skyQefY2K1UkVNwwyjXjbjmSnZ8QT 8F4g== 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=oGhMEOzfMXGtDYddgsjzWvllwAiQGCH/nVqaLtb/1aY=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=d2Z+hULI45eZIc5kmLHwEhTHr/alh9aO+FMnZtJdfc1YOcElYRzcCMlXd8qlvmP+sN 2OtLtoCfMNXnBJYVUzPSaXPBaVWFeTWDNgTCmV73ItxZtX6w637vBkhq6rUBF8s3Z7/r wNMZE3wWIeFLY56/jQtkUAl4PNEdUf64qKGOlCx9VYlkH53ggqHiShO4gSjTBY3Qwmpj dtcT9r5HhQq1uBkcfPxfq4yVfwMeLpYL6yh2+DgQgSrYQU5/pCFYecfTr6s14GVP4Ulf OZOb7uBcbVSDmcIBII9Eo+jwUwGP6fEQdC5M4t8G9TDNLELeTFZ7oUkoPFe7SKeQlM3n 7AGA==; 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=ousrc4C3; 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 a640c23a62f3a-a77c0b02901si28719566b.122.2024.07.04.04.54.23; Thu, 04 Jul 2024 04:54:23 -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; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=ousrc4C3; 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 0F4F768D953; Thu, 4 Jul 2024 14:54:06 +0300 (EEST) 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 E6B7568DA12 for ; Thu, 4 Jul 2024 14:53:50 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1720094030; bh=95knvmWuOEtA4tyVc+nJk7D7pMYalEilxDEYKoRMMsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ousrc4C34CQyljf2+4GEb/OlCYUwIwts1uQEw7PiIZtfm3iQ35mO8cYrHx/TZxwSh oRJLtrI5iOWsWtNXICfSXJfMRYuVoU6xyahB5C+lPNVznGw4fwaEz6mDoFnuwGETY0 mAGnz6CNovKldj5NwNN97mk+vOxPfYorYDK8z3Xs= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 469F840564; Thu, 4 Jul 2024 13:53:50 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Jul 2024 13:51:59 +0200 Message-ID: <20240704115202.1235954-3-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240704115202.1235954-1-ffmpeg@haasn.xyz> References: <20240704115202.1235954-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] avfilter/swscale: always fix interlaced chroma location 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: EIMvbmI2LnRL From: Niklas Haas The current logic only fixes it when the user does not explicitly specify the chroma location. However, this does not make a lot of sense. Since there is no way to specify this property per-field, it effectively *prevents* the user from being able to correctly scale interlaced frames with top-aligned chroma. It makes more sense to consider the user setting in the progressive case only, and automatically adapt it to the correct interlaced field positions, following the details of the MPEG specification. --- libavfilter/vf_scale.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 841075193e..0b6701673f 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -709,12 +709,18 @@ static int config_props(AVFilterLink *outlink) * chroma positions. MPEG chroma positions are used by convention. * Note that this works for both MPEG-1/JPEG and MPEG-2/4 chroma * locations, since they share a vertical alignment */ - if (desc->log2_chroma_h == 1 && scale->in_v_chr_pos == -513) { - in_v_chr_pos = (i == 0) ? 128 : (i == 1) ? 64 : 192; + if (desc->log2_chroma_h == 1) { + if (in_v_chr_pos == -513) + in_v_chr_pos = 128; /* explicitly default missing info */ + in_v_chr_pos += 256 * (i == 2); /* offset by one luma row for odd rows */ + in_v_chr_pos >>= i > 0; /* double luma row distance */ } - if (outdesc->log2_chroma_h == 1 && scale->out_v_chr_pos == -513) { - out_v_chr_pos = (i == 0) ? 128 : (i == 1) ? 64 : 192; + if (outdesc->log2_chroma_h == 1) { + if (out_v_chr_pos == -513) + out_v_chr_pos = 128; + out_v_chr_pos += 256 * (i == 2); + out_v_chr_pos >>= i > 0; } av_opt_set_int(s, "src_h_chr_pos", scale->in_h_chr_pos, 0); From patchwork Thu Jul 4 11:52:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 50329 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp3664169vqv; Thu, 4 Jul 2024 05:04:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQdzxSU8GjH4FXs6LsHw0cDhGsS1+9CYBRptc2+I1cGrNMtno0kIFgZKvfK6Q/JLwb1CAynqKKa+xq7Q/jwTZ87OIafbEbf5kraw== X-Google-Smtp-Source: AGHT+IGsmO7HP3HG6KfTzSiSAjdAaX3si1LVztKGBamCD/YGY0xufQvpKqW8SLrKkBVUBgdiobpR X-Received: by 2002:a2e:9953:0:b0:2ec:7300:d02f with SMTP id 38308e7fff4ca-2ee8edd7b73mr8884651fa.49.1720094649388; Thu, 04 Jul 2024 05:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720094649; cv=none; d=google.com; s=arc-20160816; b=M8TDl9rpmuKsSYxd3oMg/V8XNCF1IbPCW6AZqRTzkvYMtt3Hu1aQITc0rVLELFM1iD tNf+W3hjsQlScY0QcbUngQCIKTdIQo0TC+gfQHqZYOtgZ7TLl3OoxH9+RXT4H7WVCwUZ +gXqSazny00eo68qxcUXZqwJVih21/UM1OILs6z0N7eZO0cH92qBPb8lFmNBXB6DtzBy xFrD2CTWuvFtVJ9CsHhbdahUhOwXfyDUdY8SkCcolme5PNJFhoZQDT3BJEIXNaF3WqUa 1Sm9YaEvIv/vMJ5Dh5UzaKrjKx2nDBUvkA7+EQbXdnguPyKPtpUZu4P+gVsnpTwWUd9L NDoQ== 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=0tf1vXdwedjHg8asOS3vf38twxm5c7V+iXrix8zGxHg=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=wg2ocvPj+jLifNOKoibY4muq+ETqqE16JDKV78zgvTlbf/6mKgz9g3QyT8kNJ9GH79 HsCYazunvXvaBVjFYqqAL8qJxNBsObL8bj1DMALZuzLxqk/zSbL7WWiSMuWUmwBJHIGM xtd+5rKxJjNqwedSfJZPsCP+n6EQ1UCZ0Oh1TZaQpjHnnG2+OWid1hmf7B/7B80DD2LQ 16aXJaCtLBaLXcbs0SysdZH0wm5Nnjo9W4hKpOpCPo/sNRvZpW0v6sWdBS6FvZJMd3PW Vso8/hevl1YvBpm/1OnZQ1WRllCX3O0Nzf8CwV/o4E4lGZYZKDTWgzaDnZpXbO72HGiB sbWg==; 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=FZ4lzXP8; 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 38308e7fff4ca-2ee91647a6asi1280761fa.525.2024.07.04.05.04.08; Thu, 04 Jul 2024 05:04:09 -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; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=FZ4lzXP8; 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 3103C68D9B5; Thu, 4 Jul 2024 14:54:07 +0300 (EEST) 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 EA42C68DA13 for ; Thu, 4 Jul 2024 14:53:50 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1720094030; bh=fDpAJLLSHrC1SiS6ESlOYBs0ivMDnNrfRTgl6Tw8IG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FZ4lzXP8O4QStfoU9OkZv8MPkKDpSMNexSVByCXE3PSsE0elLRKcGp88PBL1Vg6Hz 7zUXtFdIfgGa4MFoVd/eyIfxT2kyxYqkGDAbdZgAFipjilmdaocp24soOW8CernwlE Uq8Ze39ezBkgZP+Htt1LTrkxjymscLXEandZFQ6E= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 7C87A405C5; Thu, 4 Jul 2024 13:53:50 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Jul 2024 13:52:00 +0200 Message-ID: <20240704115202.1235954-4-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240704115202.1235954-1-ffmpeg@haasn.xyz> References: <20240704115202.1235954-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/6] avfilter/vf_scale: add in/out_chroma_loc 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: 3UOvcCUTE1kS From: Niklas Haas Currently, this just functions as a more principled and user-friendly replacement for the (undocumented and hard to use) *_chr_pos fields. However, the goal is to automatically infer these values from the input frames' chroma location, and deprecate the manual use of *_chr_pos altogether. (Indeed, my plans for an swscale replacement will most likely also end up limiting the set of legal chroma locations to those permissible by AVFrame properties) --- doc/filters.texi | 15 +++++++++ libavfilter/vf_scale.c | 75 ++++++++++++++++++++++++++++-------------- 2 files changed, 66 insertions(+), 24 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index ca8f6e461a..3cff4eec1c 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -21137,6 +21137,21 @@ Set full range (0-255 in case of 8-bit luma). Set "MPEG" range (16-235 in case of 8-bit luma). @end table +@item in_chroma_loc +@item out_chroma_loc +Set in/output chroma sample location. If not specified, center-sited chroma +is used by default. Possible values: + +@table @samp +@item auto, unknown +@item left +@item center +@item topleft +@item top +@item bottomleft +@item bottom +@end table + @item force_original_aspect_ratio Enable decreasing or increasing output video width or height if necessary to keep the original aspect ratio. Possible values: diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 0b6701673f..f0de0261db 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -168,6 +168,8 @@ typedef struct ScaleContext { int in_range; int out_range; + int in_chroma_loc; + int out_chroma_loc; int out_h_chr_pos; int out_v_chr_pos; int in_h_chr_pos; @@ -617,6 +619,29 @@ fail: return ret; } +static void calc_chroma_pos(int *h_pos, int *v_pos, int chroma_loc, + int h_pos_default, int v_pos_default, + int h_sub, int v_sub, int index) +{ + *h_pos = h_pos_default; + *v_pos = v_pos_default; + if (chroma_loc != AVCHROMA_LOC_UNSPECIFIED) + av_chroma_location_enum_to_pos(h_pos, v_pos, chroma_loc); + + if (h_sub && index > 0 /* interlaced fields */) { + if (*v_pos == -513) + *v_pos = 128; /* explicitly default missing info */ + *v_pos += 256 * (index == 2); /* offset by one luma row for odd rows */ + *v_pos >>= 1; /* double luma row distance */ + } + + /* Avoid offsetting chroma for progressive content */ + if (!h_sub) + *h_pos = -513; + if (!v_sub) + *v_pos = -513; +} + static int config_props(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; @@ -673,15 +698,16 @@ static int config_props(AVFilterLink *outlink) inlink0->h == outlink->h && in_range == outlink->color_range && in_colorspace == outlink->colorspace && - inlink0->format == outlink->format) + inlink0->format == outlink->format && + scale->in_chroma_loc == scale->out_chroma_loc) ; else { struct SwsContext **swscs[3] = {&scale->sws, &scale->isws[0], &scale->isws[1]}; int i; for (i = 0; i < 3; i++) { - int in_v_chr_pos = scale->in_v_chr_pos, out_v_chr_pos = scale->out_v_chr_pos; int in_full, out_full, brightness, contrast, saturation; + int h_chr_pos, v_chr_pos; const int *inv_table, *table; struct SwsContext *const s = sws_alloc_context(); if (!s) @@ -705,28 +731,17 @@ static int config_props(AVFilterLink *outlink) av_opt_set_int(s, "dst_range", outlink->color_range == AVCOL_RANGE_JPEG, 0); - /* Override chroma location default settings to have the correct - * chroma positions. MPEG chroma positions are used by convention. - * Note that this works for both MPEG-1/JPEG and MPEG-2/4 chroma - * locations, since they share a vertical alignment */ - if (desc->log2_chroma_h == 1) { - if (in_v_chr_pos == -513) - in_v_chr_pos = 128; /* explicitly default missing info */ - in_v_chr_pos += 256 * (i == 2); /* offset by one luma row for odd rows */ - in_v_chr_pos >>= i > 0; /* double luma row distance */ - } - - if (outdesc->log2_chroma_h == 1) { - if (out_v_chr_pos == -513) - out_v_chr_pos = 128; - out_v_chr_pos += 256 * (i == 2); - out_v_chr_pos >>= i > 0; - } - - av_opt_set_int(s, "src_h_chr_pos", scale->in_h_chr_pos, 0); - av_opt_set_int(s, "src_v_chr_pos", in_v_chr_pos, 0); - av_opt_set_int(s, "dst_h_chr_pos", scale->out_h_chr_pos, 0); - av_opt_set_int(s, "dst_v_chr_pos", out_v_chr_pos, 0); + calc_chroma_pos(&h_chr_pos, &v_chr_pos, scale->in_chroma_loc, + scale->in_h_chr_pos, scale->in_v_chr_pos, + desc->log2_chroma_w, desc->log2_chroma_h, i); + av_opt_set_int(s, "src_h_chr_pos", h_chr_pos, 0); + av_opt_set_int(s, "src_v_chr_pos", v_chr_pos, 0); + + calc_chroma_pos(&h_chr_pos, &v_chr_pos, scale->out_chroma_loc, + scale->out_h_chr_pos, scale->out_v_chr_pos, + outdesc->log2_chroma_w, outdesc->log2_chroma_h, i); + av_opt_set_int(s, "dst_h_chr_pos", h_chr_pos, 0); + av_opt_set_int(s, "dst_v_chr_pos", v_chr_pos, 0); if ((ret = sws_init_context(s, NULL, NULL)) < 0) return ret; @@ -987,6 +1002,8 @@ scale: out->height = outlink->h; out->color_range = outlink->color_range; out->colorspace = outlink->colorspace; + if (scale->out_chroma_loc != AVCHROMA_LOC_UNSPECIFIED) + out->chroma_location = scale->out_chroma_loc; if (scale->output_is_pal) avpriv_set_systematic_pal2((uint32_t*)out->data[1], outlink->format == AV_PIX_FMT_PAL8 ? AV_PIX_FMT_BGR8 : outlink->format); @@ -1217,6 +1234,16 @@ static const AVOption scale_options[] = { { "mpeg", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_MPEG}, 0, 0, FLAGS, .unit = "range" }, { "tv", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_MPEG}, 0, 0, FLAGS, .unit = "range" }, { "pc", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_JPEG}, 0, 0, FLAGS, .unit = "range" }, + { "in_chroma_loc", "set input chroma sample location", OFFSET(in_chroma_loc), AV_OPT_TYPE_INT, { .i64 = AVCHROMA_LOC_UNSPECIFIED }, 0, AVCHROMA_LOC_NB-1, .flags = FLAGS, .unit = "chroma_loc" }, + { "out_chroma_loc", "set output chroma sample location", OFFSET(out_chroma_loc), AV_OPT_TYPE_INT, { .i64 = AVCHROMA_LOC_UNSPECIFIED }, 0, AVCHROMA_LOC_NB-1, .flags = FLAGS, .unit = "chroma_loc" }, + {"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_UNSPECIFIED}, 0, 0, FLAGS, .unit = "chroma_loc"}, + {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_UNSPECIFIED}, 0, 0, FLAGS, .unit = "chroma_loc"}, + {"left", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_LEFT}, 0, 0, FLAGS, .unit = "chroma_loc"}, + {"center", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_CENTER}, 0, 0, FLAGS, .unit = "chroma_loc"}, + {"topleft", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_TOPLEFT}, 0, 0, FLAGS, .unit = "chroma_loc"}, + {"top", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_TOP}, 0, 0, FLAGS, .unit = "chroma_loc"}, + {"bottomleft", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_BOTTOMLEFT}, 0, 0, FLAGS, .unit = "chroma_loc"}, + {"bottom", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCHROMA_LOC_BOTTOM}, 0, 0, FLAGS, .unit = "chroma_loc"}, { "in_v_chr_pos", "input vertical chroma position in luma grid/256" , OFFSET(in_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513}, -513, 512, FLAGS }, { "in_h_chr_pos", "input horizontal chroma position in luma grid/256", OFFSET(in_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513}, -513, 512, FLAGS }, { "out_v_chr_pos", "output vertical chroma position in luma grid/256" , OFFSET(out_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513}, -513, 512, FLAGS }, From patchwork Thu Jul 4 11:52:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 50327 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp3658471vqv; Thu, 4 Jul 2024 04:54:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUjfK4WBfk+Xwh7+bPqhu3zK5cx5GoYQS0bJSnRQqX78DuBopMA8bKYojvINdrjQiJN+1OzDUa+6NwxTJeiwPyTNSWjK4291/ytAg== X-Google-Smtp-Source: AGHT+IFZIW+LBzS/e1FkLkFwxaJ1QxrwlonFt2F5RldDrisNpv9Pr+EbrQt57ykfOlppd9vS1S5n X-Received: by 2002:a17:906:80cf:b0:a6f:dd93:7ffb with SMTP id a640c23a62f3a-a77bd99b7cbmr100123266b.1.1720094083555; Thu, 04 Jul 2024 04:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720094083; cv=none; d=google.com; s=arc-20160816; b=cktcG3DwjDsWkz7EE0cuuedoqwCBSHgoSC7VrWW6HLoqcVza3HKETNWZwGYwDsao1r XUmhMytnVYHEZUsoNC02rUHYgI70GCnCu6TWA56rWHBxPUHuI6I0STe77P0kNPcOVqjP o6wSYZGOAXCuO1P9jppM2G4o3AWzRBPDjpdPP844jR2coTJd25UIJc4jUHQnrpWIeuW9 tQJRzg9VuolhJMReffLzn97fmvpmutNrlCVHd2BmRAkJpkaJPDjXjItbsooCyVcBhifk Hpv6rHxEi/B6yYujM3vkaaAYRkwFfOGrbGxEKc3YAcE2fCNTQLBstpOft+/DgJtoiaSP zocw== 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=y0fY/Zv8nZCm8JrS6DIWPUPEcPO8CWHfOq5GOdMb0mU=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=HJFKVuiIfTOaavp3cqclA1cDnzfc3GIpWv0Ejm63VNbwWdZiXzAj/gBgAFAuy9h3rb 9MsT9kmVC1xNyLuVoUGYHkwI6jHxJEpBxLLsz2fdxI18Z/wXuEeam9viRSHVYhsoZBIg HepgLkMXPL4p5Rl0U+eLH7o/guQVd/z574i8bjzIeq1BcNuryBFk35lSzyAo/wMCfBm6 oX+dYjyvZr/Fl7HtQJNCaNXITifeMEuDvc2rJtsd5+AkP9WgakEdP8eZon47XUW28cMZ ShekMn/ceb3YO3E4EUZ9MSUc4paqGJ5UFnbSmVQswGydiSYbLokkDsqSv/+d5BwV1R93 XseA==; 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="MaYjW/gl"; 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 a640c23a62f3a-a77b4ebda3esi78210966b.123.2024.07.04.04.54.43; Thu, 04 Jul 2024 04:54:43 -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; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b="MaYjW/gl"; 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 1D84768D9CE; Thu, 4 Jul 2024 14:54:09 +0300 (EEST) 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 099B668DA14 for ; Thu, 4 Jul 2024 14:53:51 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1720094030; bh=Ui+PxSpuFmRVqsLKEUrqqYrkFhws7zLSe4VSXZBhMis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MaYjW/glPdmiWivlqS+A6Hsn0XivC5O0+Eg/pdwu+mdShyWcmpaUhhvxl74cwqGGq a6WVLO7+CR2gHM1Z0GIJg9+HleJkgh3kbmh3EFOaHGoFPbMZf5lVeHxzSOPvYnLrIC 4H6Mj0007Fy1D57l4DHUVNzQRs28TMm/ZDXn0fy4= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id AF045406C7; Thu, 4 Jul 2024 13:53:50 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Jul 2024 13:52:01 +0200 Message-ID: <20240704115202.1235954-5-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240704115202.1235954-1-ffmpeg@haasn.xyz> References: <20240704115202.1235954-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] avfilter/vf_zscale: remove unused fields 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: bFr0db7s5Be/ From: Niklas Haas --- libavfilter/vf_zscale.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libavfilter/vf_zscale.c b/libavfilter/vf_zscale.c index 45f1bd25ce..dd0d1b7f46 100644 --- a/libavfilter/vf_zscale.c +++ b/libavfilter/vf_zscale.c @@ -108,11 +108,6 @@ typedef struct ZScaleContext { char *w_expr; ///< width expression string char *h_expr; ///< height expression string - int out_h_chr_pos; - int out_v_chr_pos; - int in_h_chr_pos; - int in_v_chr_pos; - int first_time; int force_original_aspect_ratio; From patchwork Thu Jul 4 11:52:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 50328 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp3664132vqv; Thu, 4 Jul 2024 05:04:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW05cTCEVfzTedhVijRtTfosep6za7qdPsjbbfop6jHfv5Fr2ZmLCFaYhU7IFmWvq1D8UNSrivOyXXsVA/LO+VsVAHEdceNN/JAgQ== X-Google-Smtp-Source: AGHT+IHhcQ2YGYRM3H+dX9iuYcPR4PXvwPq3t2yWsVE6CVXQbx2mmk1y8CUT6ksCvXlHbOJqIskQ X-Received: by 2002:a50:eb4c:0:b0:58c:7b28:f1c7 with SMTP id 4fb4d7f45d1cf-58e5b7a42cemr925054a12.38.1720094646255; Thu, 04 Jul 2024 05:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720094646; cv=none; d=google.com; s=arc-20160816; b=CaF2uP5ingKIb9lU4MGLHnvdumzod8wZBWuKIYZEUEMs3wqPh28310Hdsaw1PVqZ2a qoKOiOk3/nXw8KFYq8iSa4a1i/cIRXvqHLR0YmCDYcy3q0Cgvk+GlQdIMM507yATX8mo vIMNR1KAlzvqKJlD+nb7J/88X7KH7eSgs9qnnbP9sWgiR9UWYQw5i9LKl2+I9gdtnwkr hWM3lGBnTLXfcjOb2G0VMJK+A8xMkZGTJZqVRi5TgOeZfqebFpMUtUEiupHoRBAD+Vz6 a+tdwTrrvb6km56FkgNn+MWJ2nJK/cxDK2gp9nm4gszy9WBM+yU35t+L8rVMlP4oSLOz 2MBw== 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=Ay9rV7Kkv1lLyi2AvqdIyXe7wj1QoE70pdDojtGgLnw=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=pjkfhJwj60+taK3AOLDySOwy6K+WMg4NcSN+Sy31i98HAFwmeknvxreOjRAyxR3P10 wiuV/C0mYEvdDAQPC9G8s2vf/Y3kYw7J8NaduxB8E7d0DObSdmbyTWII9oNmyuwtNDRB zru6c3Rkq1uqibrKTbbukU/8lrd2aCTvqcb6KLC1jdCTyXZDg+z94gE8sJ/CzeQSyYKT sIPEIEJBka+gTf6duKZ05GeTDrAVjBE8LPB44YtGuncSM8KHfvBZzBNCSA6l8e0RABE6 DOUrFbs3rEnm0x3008USPl7aKX9I32WLOAq8SBmwRABS6GsnRjHkdJJZxO6eKrlX+ePt r2EQ==; 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=MsmuVWvQ; 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 4fb4d7f45d1cf-58b7fa229f8si2852585a12.123.2024.07.04.05.04.05; Thu, 04 Jul 2024 05:04:06 -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; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=MsmuVWvQ; 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 2156168DA1E; Thu, 4 Jul 2024 14:54:10 +0300 (EEST) 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 432FB68DA14 for ; Thu, 4 Jul 2024 14:53:56 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1720094031; bh=G8WTONKekV0epJ37oE1b2mJ08sFe7lI7Hu6EiAbNwNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MsmuVWvQTb/69dgULDPAlVGl0wFVWtxioAD0N1iRqs0l6FJ37ZP29ZODdVnUGkNcD jC8hHebPLsUCwwZKjEsbnUPMRl8IO+3YTzwptBmiEDgwEDwl+79Hl5AttM+kLSbXN8 uD6wcEM9ov8IooNhaIRF4cGwRaHJtFqIu04KT7w4= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id EC002408E3; Thu, 4 Jul 2024 13:53:50 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Jul 2024 13:52:02 +0200 Message-ID: <20240704115202.1235954-6-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240704115202.1235954-1-ffmpeg@haasn.xyz> References: <20240704115202.1235954-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/6] fate/scalechroma: switch to standard chroma location 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: FJWgYAWZRHtB From: Niklas Haas Replace the manually specified chroma location by one using standard notation, arbitrarily "bottomleft" as it is a less common path. Required if we want to phase out the use of manual chroma locations. --- tests/fate/filter-video.mak | 2 +- tests/ref/fate/filter-scalechroma | 50 +++++++++++++++---------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 7f8dc3aa27..cffd67b1f8 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -433,7 +433,7 @@ fate-filter-scale2ref_keep_aspect: CMD = framemd5 -frames:v 5 -/filter_complex $ FATE_FILTER_VSYNTH-$(call FILTERDEMDEC, SCALE, RAWVIDEO, RAWVIDEO) += fate-filter-scalechroma fate-filter-scalechroma: tests/data/vsynth1.yuv -fate-filter-scalechroma: CMD = framecrc -flags bitexact -s 352x288 -pix_fmt yuv444p -i $(TARGET_PATH)/tests/data/vsynth1.yuv -pix_fmt yuv420p -sws_flags +bitexact -vf scale=out_v_chr_pos=33:out_h_chr_pos=151 +fate-filter-scalechroma: CMD = framecrc -flags bitexact -s 352x288 -pix_fmt yuv444p -i $(TARGET_PATH)/tests/data/vsynth1.yuv -pix_fmt yuv420p -sws_flags +bitexact -vf scale=out_chroma_loc=bottomleft FATE_FILTER_VSYNTH_VIDEO_FILTER-$(CONFIG_VFLIP_FILTER) += fate-filter-vflip fate-filter-vflip: CMD = video_filter "vflip" diff --git a/tests/ref/fate/filter-scalechroma b/tests/ref/fate/filter-scalechroma index 842769c2d5..dbe08600ab 100644 --- a/tests/ref/fate/filter-scalechroma +++ b/tests/ref/fate/filter-scalechroma @@ -3,28 +3,28 @@ #codec_id 0: rawvideo #dimensions 0: 352x288 #sar 0: 0/1 -0, 0, 0, 1, 152064, 0xdcab783a -0, 1, 1, 1, 152064, 0x79c7f1f6 -0, 2, 2, 1, 152064, 0x3b810afb -0, 3, 3, 1, 152064, 0x892aca1d -0, 4, 4, 1, 152064, 0x52fdd093 -0, 5, 5, 1, 152064, 0xaa643426 -0, 6, 6, 1, 152064, 0x9ad020ed -0, 7, 7, 1, 152064, 0x5c179057 -0, 8, 8, 1, 152064, 0xa56bf155 -0, 9, 9, 1, 152064, 0x61dcffca -0, 10, 10, 1, 152064, 0x0d51a1d3 -0, 11, 11, 1, 152064, 0x652f9e8d -0, 12, 12, 1, 152064, 0xdc0bb4d8 -0, 13, 13, 1, 152064, 0x561437cf -0, 14, 14, 1, 152064, 0x69ef8e4f -0, 15, 15, 1, 152064, 0xe7244350 -0, 16, 16, 1, 152064, 0xe65651cf -0, 17, 17, 1, 152064, 0xfc9ff646 -0, 18, 18, 1, 152064, 0x6ae10bc4 -0, 19, 19, 1, 152064, 0xd3d1898a -0, 20, 20, 1, 152064, 0xf3f8b139 -0, 21, 21, 1, 152064, 0x68c129be -0, 22, 22, 1, 152064, 0xc3922593 -0, 23, 23, 1, 152064, 0x2b14d96e -0, 24, 24, 1, 152064, 0xab119489 +0, 0, 0, 1, 152064, 0x77bb80f8 +0, 1, 1, 1, 152064, 0x3a21f6e8 +0, 2, 2, 1, 152064, 0xcc0907b0 +0, 3, 3, 1, 152064, 0xaa5cd87b +0, 4, 4, 1, 152064, 0x410bd74d +0, 5, 5, 1, 152064, 0x7a763b14 +0, 6, 6, 1, 152064, 0x3e4020d4 +0, 7, 7, 1, 152064, 0x46be8b5d +0, 8, 8, 1, 152064, 0x8021f16c +0, 9, 9, 1, 152064, 0x82ca033d +0, 10, 10, 1, 152064, 0xa76ca6ca +0, 11, 11, 1, 152064, 0x49019bb7 +0, 12, 12, 1, 152064, 0x3590adf5 +0, 13, 13, 1, 152064, 0xf21235dc +0, 14, 14, 1, 152064, 0x6b5f93a9 +0, 15, 15, 1, 152064, 0x4b8c5137 +0, 16, 16, 1, 152064, 0x698b67cc +0, 17, 17, 1, 152064, 0x3cebef62 +0, 18, 18, 1, 152064, 0x77770da1 +0, 19, 19, 1, 152064, 0xecdd84d4 +0, 20, 20, 1, 152064, 0x873fbc32 +0, 21, 21, 1, 152064, 0x55043c82 +0, 22, 22, 1, 152064, 0xee2b3669 +0, 23, 23, 1, 152064, 0xa64ae990 +0, 24, 24, 1, 152064, 0xb3499e12