From patchwork Thu Aug 1 09:22:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 50849 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:12d6:0:b0:489:2eb3:e4c4 with SMTP id 205csp1008848vqs; Thu, 1 Aug 2024 02:23:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWXKGLeUWfFNH2/AbsrnXUxu+jl0rUK/lEsM+taWC0Qn4RxsF4VHFLyZvxAHKOWKuJpYwzjtl5BI4GnKnGqiHLEe7cZ+McUZpeg7Q== X-Google-Smtp-Source: AGHT+IGjx43URwCoGFOAvxVRaHjBLaAw17mouvF1Ub2fwq9YpzZMZvOxd+yI+zC5v9KTVibouMvL X-Received: by 2002:a05:6402:1a33:b0:5a2:3df7:bb6a with SMTP id 4fb4d7f45d1cf-5b700e8bcccmr1401542a12.31.1722504197705; Thu, 01 Aug 2024 02:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722504197; cv=none; d=google.com; s=arc-20160816; b=YZTKtK3ToCRKufksjHPcOiXoQtqwCWJjw4v5WBxrO0CllMF3KqcZ69xP6d6C3CYHMN vbhB2gph5zJnWdk7Hjn2wFxEDnVDiz2r+N/sq3k28T4DQuGiM6k0H+bEG0cWsl+TdwXn i2CBmkKecsZE0HnSNE9dx2UBmOILKpqBbyvkxGkjpc4C87sGFnFOpsbYa+lXpqMiQR2C nKwgv1ynejpYR5IoWNvJXR6OF1q4Fs0AjPH8adEAHOKH5xCHp8U6b5leClJRS6dBiasR eBc7vl6zBj4QaPsj+6bx8LV4mxiwMgAfl0NTeo9ZqQSIM3qltIL7r6L7I8Xio4I6V9Cs EQUg== 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:date:to:from:message-id :dkim-signature:delivered-to; bh=SR7RkIDqeXI1IRmxbD7KZUM3ALswh8YVvzTFB30edr4=; fh=HnHYuZ9XgUo86ZRXTLWWmQxhslYEI9B9taZ5X1DLFfc=; b=rljt6W88+V7JzbNdYRjcRk6qHtTSpx+WHkTQWWt0usQXOjibouPV9qsxnT06dW8uAe 7v9TakNTgb2Zhttz++950NMTq4ksYE1O/7lK/TqWy1AT6ILYDSDyj1MOOWZgaWKvNNwQ VKwYkMD2raq3pV004gqHaP1nqiSuy6Qb/TAibh0vILOqcqnipW1Pa/JkpgLEvYL6ZFeO s95ktNRZEdZQ+pQUuspeUJfs/JM63D9w4leAUMKit9O5QBRuw+ozAcwYWNRZnH6TmE95 2rSL2pAjWQdDgNDHgXJOJFbGzldOddv9mJHBFa/TqfQ77wou79zAJ1f7KsEWTD+2Ty9v ISjg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=egLFyP8b; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5afa417e6e6si8120060a12.689.2024.08.01.02.23.17; Thu, 01 Aug 2024 02:23:17 -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=@foxmail.com header.s=s201512 header.b=egLFyP8b; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B2D2468D5FE; Thu, 1 Aug 2024 12:23:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-192.mail.qq.com (out203-205-221-192.mail.qq.com [203.205.221.192]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4510868D5FE for ; Thu, 1 Aug 2024 12:23:04 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1722504175; bh=GndGewf2CQfzdsn0l5Y42JLy1DnE//c1KRwnSVJpJQs=; h=From:To:Cc:Subject:Date; b=egLFyP8btfjll1z5BJTgaDfEswuSaWWJm1X2WN68qLE3UMSk0VfZrP5h0vyWFUKZO dPnbRDxqFgaH32PyXgf5oKOt517mX/ifOS/E0n3cdk+kHgWcDMjPC5/7GQYKbppKdF E3Zgw6D6RY3gkYiD3Xl+O+srCMUY62fym+kGBNp8= Received: from ZHILIZHAO-MB1.tencent.com ([119.147.10.185]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 5B637070; Thu, 01 Aug 2024 17:22:54 +0800 X-QQ-mid: xmsmtpt1722504174tehrklf5v Message-ID: X-QQ-XMAILINFO: OQhZ3T0tjf0aYaulWQeaLCcbFyhAY4Qv28poW08iT3YV2KeY8jd38zi8VjPMpy ShxL3eFAdE2UefO44DV4BHqF92mFgnpl8/K88rr7abTzk7SL/1YpVY/S7tFnrKJJJCc7A7pzPTou 1/I3IzzTg1+c4Xz1MkTebBrW8GeX+iSLxtOKe0hZAhgxDvt0U1X/o+u8aRAKkw0u+99Jalz252RL IWK95EjFp5axmj8+DcJpBUmj0X1zrxQ7EaMdxA8ynZNHsbYd8AU5NiltJXDSNXX82bpSA4rZXJqA Aj1uHr+CWFhoUVALtIDlchers+Q16jl5OYqKr6dAt/mLr9lDHVvuTT1vlUYcgRgYUKUyMEIXED5R /QFa4sfMY2bPx2oosx8Tnjzj37/3PTtz+c1y2Yv++x8UUkrhjr//XkCtmaOn/yov4RcowZKULvzy bT6ytGIvS9uzmWi9c/meYY2YCXoES/JCDrVjK/veYGQ44EJ36sl1M6i5f7/ADww03o/EGzmSlLbi uBkGNuAfnpo16A/2BPQ05TT5p5cC5z00SQ6/TFE4caAcE99IM00lEzBpViDW+SixM/XGIVW2tXUD MbtHMvJ9dNEYTaUz+1jZXO0sIMQl6RzeWdsIYx9cdoa82czsmLn2Wt10OcYslxqOwSYOQvVQESGy RT3x8Jx3AtrAfr3KeA55/jqa27eBRLVuOcQwsmDXd9k1hZuEyrmUgxcsamtsWzlUdTQzPSjURndx Aouc7OUPnnGkreD89xsKMKjvjABX0BZ8ncH5ZSFuWLiguTVoaSMRlLBJgHF4kqoNpdSATtUh6wj5 5B5tTnPnwQzFzz8OlrhTb1V5sqBE+WHOhqRVTYe2PlcIeIOOB62n5MCCgzuBtR6raEVr49ScOgcY UnxCYqNgFepFpoNI3y1L0gxHMsrVKdCf2pVylSkFARUPPQF8C3/Z7SGG1RDpQnBC1kcaM86TlqF+ jva7WOGs0Kblz+tM+1xJxu0OMHnkOFhBoCgTliFa8= X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Aug 2024 17:22:53 +0800 X-OQ-MSGID: <20240801092253.47806-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] fftools/ffplay: handle flip in display matrix 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Y8CsJw0VqiCi From: Zhao Zhili Signed-off-by: Zhao Zhili --- fftools/ffplay.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index efcd4f6452..60d8874eab 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1963,16 +1963,21 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c theta = get_rotation(displaymatrix); if (fabs(theta - 90) < 1.0) { - INSERT_FILT("transpose", "clock"); + INSERT_FILT("transpose", displaymatrix[3] > 0 ? "cclock_flip" : "clock"); } else if (fabs(theta - 180) < 1.0) { - INSERT_FILT("hflip", NULL); - INSERT_FILT("vflip", NULL); + if (displaymatrix[0] < 0) + INSERT_FILT("hflip", NULL); + if (displaymatrix[4] < 0) + INSERT_FILT("vflip", NULL); } else if (fabs(theta - 270) < 1.0) { - INSERT_FILT("transpose", "cclock"); + INSERT_FILT("transpose", displaymatrix[3] < 0 ? "clock_flip" : "cclock"); } else if (fabs(theta) > 1.0) { char rotate_buf[64]; snprintf(rotate_buf, sizeof(rotate_buf), "%f*PI/180", theta); INSERT_FILT("rotate", rotate_buf); + } else { + if (displaymatrix && displaymatrix[4] < 0) + INSERT_FILT("vflip", NULL); } }