From patchwork Sat Sep 23 02:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TADANO Tokumei X-Patchwork-Id: 43876 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:38a7:b0:15d:8365:d4b8 with SMTP id n39csp1188617pzf; Fri, 22 Sep 2023 19:00:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHo9nVfsoqEML/09pKZ9f2uxKE5rqhhfNN2nMLgl+LzcKwshPPwXwCWlU4aequaWSftaCHW X-Received: by 2002:a17:907:62a6:b0:9a9:fa4a:5a4e with SMTP id nd38-20020a17090762a600b009a9fa4a5a4emr5499203ejc.13.1695434454836; Fri, 22 Sep 2023 19:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695434454; cv=none; d=google.com; s=arc-20160816; b=P7t2LNRznY6zQZ1ZdRyQQriFYA3chejtRUmIi0ZpJE9erdvat5ahExVHs6ouQ+Ua+V Nu5VcYr6LvfD2qz0xaRmG1XtskMxO7PlBXdv4xRuJJcTvxp3aiLFsLG68gIpihC1xi5U T2YhIZw29ccxmC0K/XZrDM31iP23Rco6d4Iah3KEDeQDD+N7j3+qWe9CXMaN8A0fqww1 xrc8Q5UOMxj4zNl+IL9rgK1NIjwq9ixrIRrVF9XvKjehSKu54Z0EnU1b5N5La+9zXzap AK0TVsQ7wnaIa1+9r8qoLTl4pZfjOxhX80mpUmLpmDXwpUrDzHp3s9cY8Dpk+1r+VFBt +QdQ== 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=L041YMPsb3MAkPgS6g2AGlLoV52yzCWhSvl75pgNIm4=; fh=ssXC39eKeah6YcPRlt8jBK+nQIpHohGaLsoJm2kZFpQ=; b=s+JHnDSuXy0AKz/L+2IepocAnW1qNdM+dYTtIO0/JCHIIfLtfQBJN/bQURCkKVenT/ gfhWfKGg33e7SGe71NqQ9KWnC3/HlSrXgMUlfIqYeiIdmMvuqJjQlGeuOjypRVF74TDR gC511uNwdeKB3/SsFru6Ta4fNpl1waY9DikW5L0VsSfIaaOJRniNnLRKJ9U9xrPJPgpI TAq/Bt9EZl/PdV8vOeMMqogirkT7vEIIEwoAttkP6J9ozwYrLO9KSqjSg3JAn+MDLzKz H3XqiQSN5dWm5VD5xDRaBA9aWR0IRBh77pznZvMCmCzPQDRt6zpf8SvD0954OBk5N7Sj s5Bw== 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 bf25-20020a0564021a5900b00533392321b1si4215661edb.440.2023.09.22.19.00.54; Fri, 22 Sep 2023 19:00:54 -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 6D54168C807; Sat, 23 Sep 2023 05:00:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from dmta1006.nifty.com (mta-snd01010.nifty.com [106.153.227.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 990C968C807 for ; Sat, 23 Sep 2023 05:00:40 +0300 (EEST) Received: from osamu-pc.kimura.local by dmta1006.nifty.com with ESMTP id <20230923020036339.RXRI.58378.osamu-pc.kimura.local@nifty.com>; Sat, 23 Sep 2023 11:00:36 +0900 From: TADANO Tokumei To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Sep 2023 11:00:23 +0900 Message-Id: <20230923020023.9288-1-aimingoff@pc.nifty.jp> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] lavc/libaribcaption.c: add MSZ characters related options 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: egIKzLP3byTM This patch add MSZ (Middle Size; half width) characters related options. * add `-replace_msz_japanese` option introduced in version 1.0.1 of libaribcaption. * add `-replace_msz_glyph` option introduced in version 1.1.0 of libaribcaption. * rename `-replace_fullwidth_ascii` option to `-replace_msz_ascii` to clarify option meaning. * FIX: change all the `bool` option variables in `ARIBCaptionContext` to `int`. On some environments, a `bool` variable is small space than `int`. If a `bool` option was specified by command line, following variables would be filled and destroyed. --- doc/decoders.texi | 28 ++++++++++++++++++++------ libavcodec/libaribcaption.c | 40 ++++++++++++++++++++++++++++--------- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/doc/decoders.texi b/doc/decoders.texi index 09b8314dd2..27b981b267 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -427,12 +427,6 @@ If your player cannot handle AVSubtitles with multiple ASS rectangles properly, set this option to @var{true} or define @env{ASS_SINGLE_RECT=1} to change default behavior at compilation. -@item -replace_fullwidth_ascii @var{boolean} -Specify whether to replace MSZ (Middle Size, half width) fullwidth -alphanumerics with halfwidth alphanumerics. - -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. @@ -459,6 +453,28 @@ Specify whether to render replaced DRCS characters as Unicode characters. The default is @var{true}. +@item -replace_msz_ascii @var{boolean} +Specify whether to replace MSZ (Middle Size, half width) fullwidth +alphanumerics with halfwidth alphanumerics. + +The default is @var{true}. + +@item -replace_msz_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 -replace_msz_glyph @var{boolean} +Specify whether to replace MSZ (Middle Size, half width) characters +with halfwidth glyphs if the fonts supports it. +This option works under FreeType or DirectWrite renderer +with Adobe-Japan1 compliant fonts. +e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho, +Yu Gothic, Yu Mincho, and Meiryo. + +The default is @var{true}. + @item -canvas_size @var{image_size} Specify the resolution of the canvas to render subtitles to; usually, this should be frame size of input video. diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c index 8a8c8f8cfd..ddff47633a 100644 --- a/libavcodec/libaribcaption.c +++ b/libavcodec/libaribcaption.c @@ -68,14 +68,20 @@ typedef struct ARIBCaptionContext { int subtitle_type; int encoding_scheme; - bool ass_single_rect; + int ass_single_rect; char *font; - bool replace_fullwidth_ascii; - bool force_stroke_text; - bool ignore_background; - bool ignore_ruby; + int force_stroke_text; + int ignore_background; + int ignore_ruby; float stroke_width; - bool replace_drcs; + int replace_drcs; + int replace_msz_ascii; +#if defined(ARIBCC_VERSION) + int replace_msz_japanese; +# if AV_VERSION_INT(ARIBCC_VERSION_MAJOR, ARIBCC_VERSION_MINOR, ARIBCC_VERSION_PATCH) >= AV_VERSION_INT(1, 1, 0) + int replace_msz_glyph; +# endif +#endif int64_t pts; AVRational time_base; @@ -1004,7 +1010,11 @@ static int aribcaption_init(AVCodecContext *avctx) return AVERROR_EXTERNAL; } aribcc_decoder_set_replace_msz_fullwidth_ascii(ctx->decoder, - ctx->replace_fullwidth_ascii); + ctx->replace_msz_ascii); +#if defined(ARIBCC_VERSION) + aribcc_decoder_set_replace_msz_fullwidth_japanese(ctx->decoder, + ctx->replace_msz_japanese); +#endif /* Similar behavior as ffmpeg tool to set canvas size */ if (ctx->canvas_width > 0 && ctx->canvas_height > 0 && @@ -1057,6 +1067,10 @@ static int aribcaption_init(AVCodecContext *avctx) aribcc_renderer_set_force_no_background(ctx->renderer, ctx->ignore_background); aribcc_renderer_set_force_no_ruby(ctx->renderer, ctx->ignore_ruby); aribcc_renderer_set_stroke_width(ctx->renderer, ctx->stroke_width); +#if defined(ARIBCC_VERSION) && AV_VERSION_INT(ARIBCC_VERSION_MAJOR, ARIBCC_VERSION_MINOR, ARIBCC_VERSION_PATCH) >= AV_VERSION_INT(1, 1, 0) + aribcc_renderer_set_replace_msz_halfwidth_glyph(ctx->renderer, + ctx->replace_msz_glyph); +#endif if (ctx->font) { int is_nomem = 0; size_t count = 0; @@ -1132,8 +1146,6 @@ static const AVOption options[] = { OFFSET(ass_single_rect), AV_OPT_TYPE_BOOL, { .i64 = ASS_SINGLE_RECT }, 0, 1, SD }, { "font", "comma-separated font family [ass, bitmap]", 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 }, { "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]", @@ -1144,6 +1156,16 @@ static const AVOption options[] = { OFFSET(stroke_width), AV_OPT_TYPE_FLOAT, { .dbl = 1.5 }, 0.0, 3.0, SD }, { "replace_drcs", "replace known DRCS [bitmap]", OFFSET(replace_drcs), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, + { "replace_msz_ascii", "replace MSZ fullwidth alphanumerics with halfwidth alphanumerics [ass, bitmap]", + OFFSET(replace_msz_ascii), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, +#if defined(ARIBCC_VERSION) + { "replace_msz_japanese", "replace MSZ fullwidth Japanese with halfwidth [ass, bitmap]", + OFFSET(replace_msz_japanese), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, +# if AV_VERSION_INT(ARIBCC_VERSION_MAJOR, ARIBCC_VERSION_MINOR, ARIBCC_VERSION_PATCH) >= AV_VERSION_INT(1, 1, 0) + { "replace_msz_glyph", "replace MSZ characters with halfwidth glyphs [bitmap]", + OFFSET(replace_msz_glyph), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, +# endif +#endif {"canvas_size", "set input video size (WxH or abbreviation) [bitmap]", OFFSET(canvas_width), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, SD }, { NULL } From patchwork Tue Oct 17 11:21:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TADANO Tokumei X-Patchwork-Id: 44274 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3e0b:b0:15d:8365:d4b8 with SMTP id bk11csp290052pzc; Tue, 17 Oct 2023 04:22:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLl6z97Cu43UTrK0QBfmRZgUQG3fU3pa1Sd1TqcfQnljrzDnTiA1LUdFOK8sjnXMpcjJcB X-Received: by 2002:a50:d696:0:b0:53d:f358:202c with SMTP id r22-20020a50d696000000b0053df358202cmr1537052edi.5.1697541774357; Tue, 17 Oct 2023 04:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697541774; cv=none; d=google.com; s=arc-20160816; b=jTigrOeDvVCWfxt85C0jwSy96B5snFBJ5VRUi1oqqx3vQ8OniZWrwFSpOjUtB7NdT5 4unUMUnGII5WRNTxAv8KHIgaOyB5/ISJMT2x2OvapP/L8hWDPTJnfXnvwViamfcq2qzi H+6q7cfsDXNwCAJa5/8FqEi33Dw2Jhtirtd9UBahmIu5zDlI8lxAuNjy7CtTcZcjQZoL 1JW9eYnz8n8idK9CbEwSGV+sdKV7xcVQhm1GV/7ipTbYJOxHFQaZ+J6x//HV0VTPFa4C 8jCdX9zmxJFUk6ip2Dl+8Zcd+Idu46sdjNLFCkWlrDWQlB3fr8qyxBCHRR2lQfMY7dPh xZ+g== 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:delivered-to; bh=b9ZvH74fB4i8uTckNK9VXMPqYBeOzgF5Vd9tZmE21VA=; fh=ssXC39eKeah6YcPRlt8jBK+nQIpHohGaLsoJm2kZFpQ=; b=dBcbxLj5elhI0dkvwQo1IFBcBAKosbIcO04gfW97sgFvG/8SpcXeF3MbYRmWwjxE7M LKQrx/GHUTgPyS8LUBzkwCIvy8zgebtdRz5VEueGbhhlUgEYGAYgqBrxMfhf4gnmsumr jucACdNNQjK/KLXUJaP5f0eoVikr/52p9tlmmc1fvD8NNvyjCe1Y2gl5Y44iPIv3khXe qHBgccadDckhHnQf+vXrceQ+X4vBEYuhZirsv730+4lNH8evs0jXEtLocVKnonnqkE+5 aAIi2kZ7AZgBaPZzC4PTnA5l2NMdwKecj1likXAjyGPO6QI/mfIcIeLZ6lXP0+cov6+A SMPw== 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 u7-20020a50d507000000b00537a1931c40si637874edi.531.2023.10.17.04.22.49; Tue, 17 Oct 2023 04:22:54 -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 64BF968C9FF; Tue, 17 Oct 2023 14:22:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from dmta1019.nifty.com (mta-snd01010.nifty.com [106.153.227.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CF12868C9B4 for ; Tue, 17 Oct 2023 14:22:37 +0300 (EEST) Received: from osamu-pc.kimura.local by dmta1019.nifty.com with ESMTP id <20231017112234489.DKCD.96055.osamu-pc.kimura.local@nifty.com>; Tue, 17 Oct 2023 20:22:34 +0900 From: TADANO Tokumei To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Oct 2023 20:21:58 +0900 Message-Id: <20231017112159.199755-3-aimingoff@pc.nifty.jp> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230923020023.9288-1-aimingoff@pc.nifty.jp> References: <20230923020023.9288-1-aimingoff@pc.nifty.jp> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 2/3] lavc/libaribcaption.c: add MSZ characters related options 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: 0OXZmNnx3xwR This patch add MSZ (Middle Size; half width) characters related options. * add `-replace_msz_japanese` option introduced in version 1.0.1 of libaribcaption. * add `-replace_msz_glyph` option introduced in version 1.1.0 of libaribcaption. If specified fonts contain half-width glyphs (e.g., BIZ UDGothic), it make better rendering with `-replace_msz_ascii false` and `-replace_msz_japanese false` option for bitmap sub_type. Signed-off-by: TADANO Tokumei --- configure | 2 +- doc/decoders.texi | 16 ++++++++++++++++ libavcodec/libaribcaption.c | 10 ++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/configure b/configure index d203177a74..2fb827e1fb 100755 --- a/configure +++ b/configure @@ -6679,7 +6679,7 @@ enabled libaom && require_pkg_config libaom "aom >= 1.0.0" aom/aom_co enabled libaribb24 && { check_pkg_config libaribb24 "aribb24 > 1.0.3" "aribb24/aribb24.h" arib_instance_new || { enabled gpl && require_pkg_config libaribb24 aribb24 "aribb24/aribb24.h" arib_instance_new; } || die "ERROR: libaribb24 requires version higher than 1.0.3 or --enable-gpl."; } -enabled libaribcaption && require_pkg_config libaribcaption "libaribcaption >= 0.1.0" "aribcaption/aribcaption.h" aribcc_context_alloc +enabled libaribcaption && require_pkg_config libaribcaption "libaribcaption >= 1.1.1" "aribcaption/aribcaption.h" aribcc_context_alloc enabled lv2 && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883 enabled libass && require_pkg_config libass "libass >= 0.11.0" ass/ass.h ass_library_init diff --git a/doc/decoders.texi b/doc/decoders.texi index 09b8314dd2..36c3404475 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -459,6 +459,22 @@ Specify whether to render replaced DRCS characters as Unicode characters. The default is @var{true}. +@item -replace_msz_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 -replace_msz_glyph @var{boolean} +Specify whether to replace MSZ (Middle Size; half width) characters +with halfwidth glyphs if the fonts supports it. +This option works under FreeType or DirectWrite renderer +with Adobe-Japan1 compliant fonts. +e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho, +Yu Gothic, Yu Mincho, and Meiryo. + +The default is @var{true}. + @item -canvas_size @var{image_size} Specify the resolution of the canvas to render subtitles to; usually, this should be frame size of input video. diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c index be3328c5c9..74822586dc 100644 --- a/libavcodec/libaribcaption.c +++ b/libavcodec/libaribcaption.c @@ -76,6 +76,8 @@ typedef struct ARIBCaptionContext { int ignore_ruby; float stroke_width; int replace_drcs; + int replace_msz_japanese; + int replace_msz_glyph; int64_t pts; AVRational time_base; @@ -1005,6 +1007,8 @@ static int aribcaption_init(AVCodecContext *avctx) } aribcc_decoder_set_replace_msz_fullwidth_ascii(ctx->decoder, ctx->replace_fullwidth_ascii); + aribcc_decoder_set_replace_msz_fullwidth_japanese(ctx->decoder, + ctx->replace_msz_japanese); /* Similar behavior as ffmpeg tool to set canvas size */ if (ctx->canvas_width > 0 && ctx->canvas_height > 0 && @@ -1057,6 +1061,8 @@ static int aribcaption_init(AVCodecContext *avctx) aribcc_renderer_set_force_no_background(ctx->renderer, ctx->ignore_background); aribcc_renderer_set_force_no_ruby(ctx->renderer, ctx->ignore_ruby); aribcc_renderer_set_stroke_width(ctx->renderer, ctx->stroke_width); + aribcc_renderer_set_replace_msz_halfwidth_glyph(ctx->renderer, + ctx->replace_msz_glyph); if (ctx->font) { int is_nomem = 0; size_t count = 0; @@ -1144,6 +1150,10 @@ static const AVOption options[] = { OFFSET(stroke_width), AV_OPT_TYPE_FLOAT, { .dbl = 1.5 }, 0.0, 3.0, SD }, { "replace_drcs", "replace known DRCS [bitmap]", OFFSET(replace_drcs), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, + { "replace_msz_japanese", "replace MSZ fullwidth Japanese with halfwidth [ass, bitmap]", + OFFSET(replace_msz_japanese), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, + { "replace_msz_glyph", "replace MSZ characters with halfwidth glyphs [bitmap]", + OFFSET(replace_msz_glyph), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, {"canvas_size", "set input video size (WxH or abbreviation) [bitmap]", OFFSET(canvas_width), AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, SD }, { NULL } From patchwork Tue Oct 17 11:21:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TADANO Tokumei X-Patchwork-Id: 44275 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3e0b:b0:15d:8365:d4b8 with SMTP id bk11csp290099pzc; Tue, 17 Oct 2023 04:22:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFX4Ycr7jKEesQ0pTxxgaJV/c3tlgHW1efWoPbgeUG9Q8ZtazKW/L3tPI8t8SxWtLDN2lC0 X-Received: by 2002:a05:6512:b9f:b0:503:2555:d1e7 with SMTP id b31-20020a0565120b9f00b005032555d1e7mr1896862lfv.45.1697541779397; Tue, 17 Oct 2023 04:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697541779; cv=none; d=google.com; s=arc-20160816; b=mRiVXSma6SWtftEGmfF7zLXnLfqI8lNvSdUa9tMa+YKkhuyP4YMUJE8P48AdeSpCQJ g7byB/28fYQRN1kGsaJtOeoZKJKLEyVBMUjg0RObUPyVAeIgK/1a3x1hbRZ8UGEHK4H3 8p2yewlgz8EVThgvlqj6a+8YbDiNglCt8qbyG5G/kfHQ4LiYHr9qf9bW/7EMShyHz4VD fBZBthEx5Br7almddl4iGoR60BYPr1fAMu6oEDdA9r3ZlBwEPTfrU97UBReMMLxQwsT5 U6cRCQws3iOPgYOlTr1cM5vF6+Zg7S4bwHl/lnpK3h9WaoWeBbtmd2RVqOe52jlBtg8K P2/A== 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:delivered-to; bh=YeCTOOEH4k65minozCgBbMRe5nyR1Hp1L+eFT1asdyU=; fh=ssXC39eKeah6YcPRlt8jBK+nQIpHohGaLsoJm2kZFpQ=; b=QDSHdAmdE7ASI4XK2W2JYJ3Umm2w2qWQOEPEpBy+Qg9D3S8uXDjSCoOy8Dkr0NLp9T I7rSZFVgqkmGoGcSDlxaHru/fyUZO96ekH+PSFWJDdB9zj2uuOthjq0vKdSV4vz1ypt1 i8BOZHQQP8x2391uYp3etUXIQkHMoN1yW9F9VXsV317D8xMw23lEaHH0fA749OBUNxIZ BQJIsLEBXgfBGmxhjG5Mvnd0fIhwqrAuR5KPkFTUL3JPCRFvP97T4x/uf10vNtuYa0sy kxigQhX9x76OmkffEyWN3Nmq5ti/gm/KuOBHYgc9RMmw7PJif+Bs0UgPhpRcYk7IwbiF 2U4Q== 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 l7-20020a1709066b8700b0099cbed6da42si637490ejr.157.2023.10.17.04.22.58; Tue, 17 Oct 2023 04:22:59 -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 5CE5468C768; Tue, 17 Oct 2023 14:22:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from dmta1019.nifty.com (mta-snd01008.nifty.com [106.153.227.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D4B8468C768 for ; Tue, 17 Oct 2023 14:22:43 +0300 (EEST) Received: from osamu-pc.kimura.local by dmta1019.nifty.com with ESMTP id <20231017112240241.DKCG.96055.osamu-pc.kimura.local@nifty.com>; Tue, 17 Oct 2023 20:22:40 +0900 From: TADANO Tokumei To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Oct 2023 20:21:59 +0900 Message-Id: <20231017112159.199755-4-aimingoff@pc.nifty.jp> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230923020023.9288-1-aimingoff@pc.nifty.jp> References: <20230923020023.9288-1-aimingoff@pc.nifty.jp> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 3/3] lavc/libaribcaption.c: rename `-replace_fullwidth_ascii` 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: rL6HpHuZSFNg This patch renames `-replace_fullwidth_ascii` option to `-replace_msz_ascii` to clarify option meaning. Signed-off-by: TADANO Tokumei --- doc/decoders.texi | 12 ++++++------ libavcodec/libaribcaption.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/decoders.texi b/doc/decoders.texi index 36c3404475..eb00e2a9e9 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -427,12 +427,6 @@ If your player cannot handle AVSubtitles with multiple ASS rectangles properly, set this option to @var{true} or define @env{ASS_SINGLE_RECT=1} to change default behavior at compilation. -@item -replace_fullwidth_ascii @var{boolean} -Specify whether to replace MSZ (Middle Size, half width) fullwidth -alphanumerics with halfwidth alphanumerics. - -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. @@ -459,6 +453,12 @@ Specify whether to render replaced DRCS characters as Unicode characters. The default is @var{true}. +@item -replace_msz_ascii @var{boolean} +Specify whether to replace MSZ (Middle Size; half width) fullwidth +alphanumerics with halfwidth alphanumerics. + +The default is @var{true}. + @item -replace_msz_japanese @var{boolean} Specify whether to replace some MSZ (Middle Size; half width) fullwidth japanese special characters with halfwidth ones. diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c index 74822586dc..2a058a4992 100644 --- a/libavcodec/libaribcaption.c +++ b/libavcodec/libaribcaption.c @@ -70,12 +70,12 @@ typedef struct ARIBCaptionContext { int encoding_scheme; int ass_single_rect; char *font; - int replace_fullwidth_ascii; int force_stroke_text; int ignore_background; int ignore_ruby; float stroke_width; int replace_drcs; + int replace_msz_ascii; int replace_msz_japanese; int replace_msz_glyph; @@ -1006,7 +1006,7 @@ static int aribcaption_init(AVCodecContext *avctx) return AVERROR_EXTERNAL; } aribcc_decoder_set_replace_msz_fullwidth_ascii(ctx->decoder, - ctx->replace_fullwidth_ascii); + ctx->replace_msz_ascii); aribcc_decoder_set_replace_msz_fullwidth_japanese(ctx->decoder, ctx->replace_msz_japanese); @@ -1138,8 +1138,6 @@ static const AVOption options[] = { OFFSET(ass_single_rect), AV_OPT_TYPE_BOOL, { .i64 = ASS_SINGLE_RECT }, 0, 1, SD }, { "font", "comma-separated font family [ass, bitmap]", 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 }, { "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]", @@ -1150,6 +1148,8 @@ static const AVOption options[] = { OFFSET(stroke_width), AV_OPT_TYPE_FLOAT, { .dbl = 1.5 }, 0.0, 3.0, SD }, { "replace_drcs", "replace known DRCS [bitmap]", OFFSET(replace_drcs), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, + { "replace_msz_ascii", "replace MSZ fullwidth alphanumerics with halfwidth alphanumerics [ass, bitmap]", + OFFSET(replace_msz_ascii), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, { "replace_msz_japanese", "replace MSZ fullwidth Japanese with halfwidth [ass, bitmap]", OFFSET(replace_msz_japanese), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD }, { "replace_msz_glyph", "replace MSZ characters with halfwidth glyphs [bitmap]",