From patchwork Sun Nov 13 19:07:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oneric X-Patchwork-Id: 39259 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp2049998pzb; Sun, 13 Nov 2022 11:07:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf6VBtJn67YOrLs+eeWYdE3P8smjsZtOmPlnFT7+znHoRYIFXXy/Vs1lQukpdsblCE6zQUmZ X-Received: by 2002:aa7:c499:0:b0:44e:baab:54e7 with SMTP id m25-20020aa7c499000000b0044ebaab54e7mr9048520edq.265.1668366474755; Sun, 13 Nov 2022 11:07:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668366474; cv=none; d=google.com; s=arc-20160816; b=GYqt6fEh+3edlHGAl9HrEZZG4zMwYtr817ptrAFu2SeCsRZptVg6mgoek5zj9frSLI 3Z0HaSxq+fyn/9DWVTQWdV/gyVPVKlgbvA0thsiMK3DmMtjYtNoWQ/yQCxbsPVHRHIXF MkDrt3fETsxfX6enlHAfwBz9tASIOw0+LaIocZ6Ce1ioYsnm7PvXzj6YVAop4o7+yBxe B8ZV6EPCnZRkL3RdRbkXS5GxnVZcKni4QOSPEEyTv9KzqvW3KbGugvlaUuT1sTR6hKDc Air3+i68P6R4iatMGgC53f6J4UEl0+OTCh04PlA0ExtrOVLO+7v6LWYQFhe2+wEVRLjT AXZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=tS/lzX8MCCOqSGz4tjzhUDYRfKKAA/1j0R3xqzWPyco=; b=yEKdB0rZpvs4Qop7e4bnq+gTHKRU87IA2djn32nCbzvsmieg84ElQ5FGYKOssk2UOx 33Ol0vFwaUNoLTISrAT0h+SU7Tvkyc+kGOhsrsva8tXQh3v0GYGQ9Kqu8AS7sEHQiNhv lioj15Sw82zW8T0PG3yG0dOmQp0LGMsv0jGRaXihFqvIaXdL63zZQcY+Xik3gW2rM5Dw 89ktQsFw1D5O3pf9Nw7ZwQqmtk1Uc1Lb8gEAc/11f0LTUkBjfGfNo3F6GMRJfZl8pjxM VgPrhAkvxidygzw+q6OyiplNJvlHfF7JbHIJo03uH8JGJh2cpABYb1vrsxNnVAmh0vdr aQ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@oneric.de header.s=strato-dkim-0002 header.b=Cg828dup; 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 dz10-20020a0564021d4a00b004635dccd3casi8182201edb.57.2022.11.13.11.07.54; Sun, 13 Nov 2022 11:07:54 -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=@oneric.de header.s=strato-dkim-0002 header.b=Cg828dup; 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 40B0668BB61; Sun, 13 Nov 2022 21:07:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.22]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CAE3E68AF4E for ; Sun, 13 Nov 2022 21:07:17 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1668366436; s=strato-dkim-0002; d=oneric.de; h=References:In-Reply-To:Message-Id:Date:Subject:To:From:Cc:Date:From: Subject:Sender; bh=UJrFPrNLBr+VMjU2//rbU2UFtvHln0IfvaaQ0Oa9Iko=; b=Cg828dup0/C06++NxuR5vOrjrt5u3o4jlvlN5Cn4JNG9XxnJIKc7jJPMdPnMDzOGVe mU3WS7hWmbWZx38AfkafmDvAtfWCe1od5Idym9Lw3BuEHTLyZoRXSUw74CF8cT6UJEU0 OW2I5CgKLQOR2b03sdVWaVM1jstuZjPcRyduTr5p5TNGRAXPNNbA1AsAZgjwoPdcYHmQ yP80nZ4A4GtslikTk7FtcMzYygUwKMILj39H/A821o1JyQsfdN0cm5eBJpe82LSwqmEB Ck6qi7dppHj8aq7sVXXvRj9ZYsV8bjSPtbsl3g16U7/0WrJjOjchlsY1rmlAOxoKxm8k 1ZjA== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":I2IBZ0mrW/AWQXwgB4oxKM1YsW1lFUznrLvi/XReWqAAlWwZ8wlvfXmGs4jUQ0oz8ZbhHexs8fhgUyYHd48hugDaTPD0scTjgixgxauA" X-RZG-CLASS-ID: mo00 Received: from koenig-desktop.workgroup by smtp.strato.de (RZmta 48.2.1 AUTH) with ESMTPSA id V28b60yADJ7G27j (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate) for ; Sun, 13 Nov 2022 20:07:16 +0100 (CET) From: Oneric To: ffmpeg-devel@ffmpeg.org Date: Sun, 13 Nov 2022 20:07:03 +0100 Message-Id: <20221113190704.15518-3-oneric@oneric.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221113190704.15518-1-oneric@oneric.de> References: <20221113190704.15518-1-oneric@oneric.de> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/ass: accurately preserve colours 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: bmFbojBk4N6o Colour values used in ASS files without a "YCbCr Matrix" header set to "None" are subject to colour mangling, due to how ASS was historically conceived. A more in-depth description can be found in the documetation inside libass' public ass_types.h header. The important part is, if this header is not set to "None", the final output colours can deviate from the literal value specified in the file. When converting from non-ASS formats we do not want any colour shift to happen, so let's set the appropiate header. NB: ffmpeg's subtitle filter, does not follow libass' documentation regarding colour mangling, thus hiding the bug. Anything based on VSFilter, XySubFilter or e.g. mpv do and might show the issue. (Of course native ASS subs, which _do_ rely on colour mangling won't work properly with the subtitle filter, but this can be fixed another time) --- Link to libass’ docs regarding colour mangling: https://github.com/libass/libass/blob/3df19c2e809b16c9cf7c925fa3bb573e2e6f4fdd/libass/ass_types.h#L152-L232 --- libavcodec/ass.c | 1 + tests/ref/fate/sub-aqtitle | Bin 3213 -> 3233 bytes tests/ref/fate/sub-cc | Bin 839 -> 859 bytes tests/ref/fate/sub-cc-realtime | Bin 1524 -> 1544 bytes tests/ref/fate/sub-cc-scte20 | Bin 945 -> 965 bytes tests/ref/fate/sub-charenc | Bin 6008 -> 6028 bytes tests/ref/fate/sub-jacosub | Bin 1783 -> 1803 bytes tests/ref/fate/sub-microdvd | Bin 1375 -> 1395 bytes tests/ref/fate/sub-movtext | Bin 783 -> 803 bytes tests/ref/fate/sub-mpl2 | Bin 870 -> 890 bytes tests/ref/fate/sub-mpsub | Bin 2517 -> 2537 bytes tests/ref/fate/sub-mpsub-frames | Bin 736 -> 756 bytes tests/ref/fate/sub-pjs | Bin 860 -> 880 bytes tests/ref/fate/sub-realtext | Bin 939 -> 959 bytes tests/ref/fate/sub-sami | Bin 1981 -> 2001 bytes tests/ref/fate/sub-sami2 | Bin 9970 -> 9990 bytes tests/ref/fate/sub-scc | 1 + tests/ref/fate/sub-srt | Bin 6301 -> 6321 bytes tests/ref/fate/sub-srt-badsyntax | Bin 1561 -> 1581 bytes tests/ref/fate/sub-stl | Bin 2241 -> 2261 bytes tests/ref/fate/sub-subviewer | Bin 780 -> 800 bytes tests/ref/fate/sub-subviewer1 | Bin 1494 -> 1514 bytes tests/ref/fate/sub-vplayer | Bin 742 -> 762 bytes tests/ref/fate/sub-webvtt | Bin 1985 -> 2005 bytes tests/ref/fate/sub-webvtt2 | Bin 1648 -> 1668 bytes 25 files changed, 2 insertions(+) index 13f393cc86b9f797be24f37a07aafc7272c22e59..516d26af9ab09613f939d004826e44c80b3b1054 100644 GIT binary patch delta 29 kcmX@kcAITNgHWV%l5>%QZ(>PNW`&i4Uw&Td#=4VC0HTfx{Qv*} delta 10 Rcmcc3cARZO!^SDcnE)Fg1kC^d index be28084887a9b7fb80ae4ff3369cf7192a978919..a97d29f70ba1d3984887eacb6e833abb8a406902 100644 GIT binary patch delta 29 kcmdnUew2MegHWV%l5>%QZ(>PNW`&i4Uw&Td#yVqW0G!DRJ^%m! delta 10 RcmX@gzL9-G!^SCw%m5g91P%ZI index b574dda54dfdee55a07f13c808ee3baa6e100798..32086d9365399ae3a968f9f61c6e3fa83a35ff65 100644 GIT binary patch delta 29 kcmey)+s!wjK`7EW$+<|uH?gEBv%*TjFF!AJV_hX10HB5npa1{> delta 10 RcmeC?`_4O|VdIo?HUJr21aJTV index 6e2d2e35dbd94d6dded683b59436645805723372..973e9f16457906c4bf9bd95d7053b2c4e405e68a 100644 GIT binary patch delta 29 kcmeBYTg*10K`7EW$+<|uH?gEBv%*TjFF!AJW8Fk10F~YfRR910 delta 10 RcmZ3?*3UMfVdIp3CIA+|1SJ3f index 1a8e757585a91121cb27f360b352fecc34340d8b..4c3d37fa42206d262e221b1d0b81312289329143 100644 GIT binary patch delta 29 kcmcaA{8D&AgHWV%l5>%QZ(>PNW`&i4Uw&Td#=3A$0H=Qn$N&HU delta 10 RcmaDUd{uZt!^SD0oB$jT1egE- index 378190a3eb0aa64fd983bc10dd1caa512ba6c92e..a32720514305771ae40b9182a9c469e098b6b1aa 100644 GIT binary patch delta 29 kcmcb^_JM6egHWV%l5>%QZ(>PNW`&i4Uw&Td#=3h<0H;t3JOBUy delta 10 Rcmeysc86_3!^SChm;fBa1q=WH index dbd1cc310d670d6a2874af6d669b8e0d43c3b7cd..3f194bdd0253eff13af8df85876f656e9fca8658 100644 GIT binary patch delta 29 kcmdnXf02JegHWV%l5>%QZ(>PNW`&i4Uw&Td#yWd;0HHMsb^rhX delta 10 Rcmcb}zn6bP!^SDL>;M_<1V#V= index 62cbf6fa4a..ff667eb4ec 100644 index 61f472a84b9aac22954215b60df7acdecd05fddc..27bdd48c404370d047697c06b710e44aaa371b74 100644 GIT binary patch delta 29 kcmbQqvzBK%QZ(>PNW`&i4Uw&Td#=6<80GVkDf&c&j delta 10 RcmZ3>Gm~dR!^SBySpgU81X2J1 index c68a6442be223b8c98cef6e3a67b5a176cd434c9..e910e154ba6203eca72f994d2f3cfd40d50f5ebc 100644 GIT binary patch delta 29 kcmeBSTfjD%QZ(>PNW`&i4Uw&Td#<~n90H|IH*Z=?k delta 10 Rcmeyx`iyl#!^SCTOaL5w1gHQ2 index 357b8178ea1cf224ad47dcf78b24f1948ece6665..56afed8944071d465eba2a8c0308af88863e54b6 100644 GIT binary patch delta 29 kcmeys)51HUK`7EW$+<|uH?gEBv%*TjFF!AJW8EiK0H3)F2mk;8 delta 10 RcmZqS{lGJ!VdIn!tN%QZ(>PNW`&i4Uw&Td#=3_r0I1jtPXGV_ delta 10 Rcmey&b)RcO!^SE1SpXeE1s?za diff --git a/tests/ref/fate/sub-movtext b/tests/ref/fate/sub-movtext diff --git a/tests/ref/fate/sub-mpl2 b/tests/ref/fate/sub-mpl2 index f78cf6849530c0015fe58a6cc7cb1584d6c4c4ce..d740fbc365460187e6b4edcf3faa00bdb5638196 100644 GIT binary patch delta 29 kcmaFH_KR&ogHWV%l5>%QZ(>PNW`&i4Uw&Td#<~|w0I8G%QZ(>PNW`&i4Uw&Td#=0aX0H*>9#sB~S delta 10 Rcmeyu`hayp!^SBIOaL4N1eO2* diff --git a/tests/ref/fate/sub-pjs b/tests/ref/fate/sub-pjs diff --git a/tests/ref/fate/sub-realtext b/tests/ref/fate/sub-realtext index 04b1664f8968cc550ce6f695f3bd68544ce3c0cb..d80db64dafcc51c0536b968eb0416444bbdb2a21 100644 GIT binary patch delta 29 kcmZ3@zMp+UgHWV%l5>%QZ(>PNW`&i4Uw&Td#yVYQ0Gn+JEC2ui delta 10 RcmdnbzM6eP!^SDv%m5ex1N;C0 diff --git a/tests/ref/fate/sub-sami b/tests/ref/fate/sub-sami diff --git a/tests/ref/fate/sub-sami2 b/tests/ref/fate/sub-sami2 index dbec842d2b0181ebc0a7e8eefbd2991273255efb..bab07e4c0709cb420c1c248782e95bbf015b844f 100644 GIT binary patch delta 29 kcmez5+vYc+K`7EW$+<|uH?gEBv%*TjFF!AJV_k_F0IdWIF#rGn delta 10 RcmZqk`{X;JVdIn{H2@tM1pxp6 diff --git a/tests/ref/fate/sub-scc b/tests/ref/fate/sub-scc --- a/tests/ref/fate/sub-scc +++ b/tests/ref/fate/sub-scc @@ -4,6 +4,7 @@ ScriptType: v4.00+ PlayResX: 384 PlayResY: 288 ScaledBorderAndShadow: yes +YCbCr Matrix: None [V4+ Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding diff --git a/tests/ref/fate/sub-srt b/tests/ref/fate/sub-srt index b4eed235ce01f1f85bb26fd49fcdc123467c4740..a6ed4f31df47709db51272dff3bd889cb9ffc317 100644 GIT binary patch delta 29 kcmbPhxY2MzgHWV%l5>%QZ(>PNW`&i4Uw&Td#yWWk0HHDpYXATM delta 10 RcmdmJIM;AO!^SDH5&#*V1Umo# diff --git a/tests/ref/fate/sub-srt-badsyntax b/tests/ref/fate/sub-srt-badsyntax diff --git a/tests/ref/fate/sub-stl b/tests/ref/fate/sub-stl index 0f326c21730c959e9428cd96a5eca21014b5c888..3e847a68beb5d6cfca08ea4612027d72eda9958a 100644 GIT binary patch delta 29 kcmX>ocvWyhgHWV%l5>%QZ(>PNW`&i4Uw&Td#yV#X0HTTthX4Qo delta 10 RcmcaAcu;Uc!^SC&8~_?#1Xln6 diff --git a/tests/ref/fate/sub-subviewer b/tests/ref/fate/sub-subviewer diff --git a/tests/ref/fate/sub-subviewer1 b/tests/ref/fate/sub-subviewer1 index e88729ad5ec990202f9d23f96288a36eb5a845bb..2d253288e1db9f2c2061512b6c85ebaefc5c51b0 100644 GIT binary patch delta 29 kcmcb{{fc`+gHWV%l5>%QZ(>PNW`&i4Uw&Td#<~br0Hy^Bw*UYD delta 10 RcmaFGeT{oU!^SCLtN%QZ(>PNW`&i4Uw&Td#yV$q0HPfVf&c&j delta 10 Rcmcc0e~^Dd!^SC&>;M`)1X2J1