From patchwork Fri Sep 8 13:00:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TADANO Tokumei X-Patchwork-Id: 43660 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4e27:b0:149:dfde:5c0a with SMTP id gk39csp459005pzb; Fri, 8 Sep 2023 06:02:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHN/oyVRX/s71UAt8Aax8gZ125pyCcNlwi2U52C7WLt8/sTzZKX896iNnTiQyXi0glP7G/I X-Received: by 2002:a17:906:76cb:b0:9a9:f0f6:6d2e with SMTP id q11-20020a17090676cb00b009a9f0f66d2emr2070119ejn.7.1694178125756; Fri, 08 Sep 2023 06:02:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694178125; cv=none; d=google.com; s=arc-20160816; b=vxUt3O/aBO8SEQwl8RcPFBa90F0fwzUk+MnV5PpZncG0iAFd9k5gXZPsxES7YDWQLj qfqw7yVtoutFup0FpmQwdUNXjV4x62mnYj+OtSq4PjK7c/CfegaOAW7P/9XCJL79WJRq nsW6V0MA63JE3HyC6TYGpEQ/Qm/X/voxyWtL499hPnVt/79b5BJtWiT27rSVYHo6/AdO hWOJ/jNyl9gJZ7RvFVtk4JTTr6qu/DlmMB7chaVBi0T8G6Ehy5y2VUZDPAqBzl7znRxC iP42OCQ6pHSS7YiGXijjisKyOsMN/mtpGuidpJvuBgQQq8IF0dCAhQJGxkEGXmcaLZjj p3QQ== 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 :delivered-to; bh=+mvYKY1YGnBzKeROwe1cCBTgJEqRW9CsYa0qTeYZt7c=; fh=ssXC39eKeah6YcPRlt8jBK+nQIpHohGaLsoJm2kZFpQ=; b=OJY8fAuwDU/vgXJYzO+af5v+lbs65dzU1Zz3rZHFG3soNl3ny1sAh0lX7awzWKemV1 I3YCFemw2PPEFfXbx4Gux3J0FdosMQjzIj9xLoEUDVSZb/42zfknk+qX7mL5eaZZSu5K fBFVqtQ8WVKl25D4rMXcrEL7wYSt68MCyrnUpN8hf7FotKEX7Bhj88iy9SHcrIc9dBfJ KkABFREL6zY9OxuPGT7rZVwfA6Ic/sPnfa8vee4xUo2xo/RhPEntln8PRAdiMZBCFsYY rsL7R4NbKBdeYKtPVkl0cGW1xdc6uOtolTtik5wBTqNsaNJVKuZZCcc50y/nAK7M0dmg MKtg== ARC-Authentication-Results: i=1; mx.google.com; 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 d11-20020a1709064c4b00b00992acaba375si1213881ejw.842.2023.09.08.06.02.04; Fri, 08 Sep 2023 06:02:05 -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; 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 3C7DF68C80A; Fri, 8 Sep 2023 16:02:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from dmta1006.nifty.com (mta-snd01001.nifty.com [106.153.227.33]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5FF7A68C49B for ; Fri, 8 Sep 2023 16:01:51 +0300 (EEST) Received: from osamu-pc.kimura.local by dmta1006.nifty.com with ESMTP id <20230908130147056.UBND.19085.osamu-pc.kimura.local@nifty.com>; Fri, 8 Sep 2023 22:01:47 +0900 From: TADANO Tokumei To: ffmpeg-devel@ffmpeg.org Date: Fri, 8 Sep 2023 22:00:50 +0900 Message-Id: <20230908130050.85688-1-aimingoff@pc.nifty.jp> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavc/libaribcaption.c: add -replace_fullwidth_japanese option 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: TADANO Tokumei Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: UR3z4zsT/cYv This patch add `-replace_fullwidth_japanese` option introduced in latest (1.0.1) libaribcaption. --- doc/decoders.texi | 6 ++++++ libavcodec/libaribcaption.c | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 09b8314dd2..ee4cc6121e 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -433,6 +433,12 @@ alphanumerics with halfwidth alphanumerics. The default is @var{true}. +@item -replace_fullwidth_japanese @var{boolean} +Specify whether to replace some MSZ (Middle Size, half width) fullwidth +japanese special characters with halfwidth ones. + +The default is @var{true}. + @item -force_outline_text @var{boolean} Specify whether always render outline text for all characters regardless of the indication by charactor style. diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c index 8a8c8f8cfd..3ec35b9ba1 100644 --- a/libavcodec/libaribcaption.c +++ b/libavcodec/libaribcaption.c @@ -71,6 +71,9 @@ typedef struct ARIBCaptionContext { bool ass_single_rect; char *font; bool replace_fullwidth_ascii; +#if defined(ARIBCC_VERSION) + bool replace_fullwidth_japanese; +#endif bool force_stroke_text; bool ignore_background; bool ignore_ruby; @@ -1005,6 +1008,10 @@ static int aribcaption_init(AVCodecContext *avctx) } aribcc_decoder_set_replace_msz_fullwidth_ascii(ctx->decoder, ctx->replace_fullwidth_ascii); +#if defined(ARIBCC_VERSION) + aribcc_decoder_set_replace_msz_fullwidth_japanese(ctx->decoder, + ctx->replace_fullwidth_japanese); +#endif /* Similar behavior as ffmpeg tool to set canvas size */ if (ctx->canvas_width > 0 && ctx->canvas_height > 0 && @@ -1134,6 +1141,10 @@ static const AVOption options[] = { OFFSET(font), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD }, { "replace_fullwidth_ascii", "replace MSZ fullwidth alphanumerics with halfwidth alphanumerics [ass, bitmap]", OFFSET(replace_fullwidth_ascii), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, +#if defined(ARIBCC_VERSION) + { "replace_fullwidth_japanese", "replace MSZ fullwidth Japanese with halfwidth [ass, bitmap]", + OFFSET(replace_fullwidth_japanese), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, +#endif { "force_outline_text", "always render characters with outline [(ass), bitmap]", OFFSET(force_stroke_text), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, SD }, { "ignore_background", "ignore rendering caption background [(ass), bitmap]",