From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 17A1F49DC3 for ; Mon, 11 Mar 2024 16:38:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0985F68D097; Mon, 11 Mar 2024 18:38:48 +0200 (EET) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B735468CD68 for ; Mon, 11 Mar 2024 18:38:41 +0200 (EET) Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a44665605f3so665871266b.2 for ; Mon, 11 Mar 2024 09:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710175121; x=1710779921; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=LsMdhC1pGhcrbVXy1v9dD4pxer5FZoY8B1flKp+OdgU=; b=d0m6tSh1byyhkmKFxH2nUOGW9xEvLT2oFDeyeRf8eWv9X4deXLTdNTxDKO63YbDF+m HorGxvttVYZ6WObeknjMKtSs3EuAfLVq3lfUD+AtySKEXpwzSRM40CJpw3n5NmYHKyuf c39mVs35uz4QY0xzGshyXmof5NNrruNlC2evFnU7VhK3tG4+gn1EWzVgt5cx9cL32sQm 11NMXccop9lzko4iJvNOg7ouwPSBuLg5da3n7afNmFmssbzCXhM1F5YdmlfEnRn8PG+U 5E4eBHCahxGl+ap0SDfm2IpyrxR53CSHajp8v8Jmcj0xATCeFn+xYrb7FXDmrPlzX5En +47A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710175121; x=1710779921; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LsMdhC1pGhcrbVXy1v9dD4pxer5FZoY8B1flKp+OdgU=; b=RRwQa8Bp87Vks0QnMJsj/PD/fmeAm4wddKPftvraOgBvUc1EB04OEr5GzmCveVPE+x DJUvI8YSLN6WBVMcAC6KW4rZTFV3k08hRnRJ/tszgAquAcNMCj6CligfPfWEQ8IQl9DH jkeG+Rvst5GBohXULZ2/V99KnSUwcE/aZp+4OKFTluTvzWth9VP602x9rA1QaRhugG4s NoXcxi9eYJjSY0iP8ObfZy9W9BNc/Gbqu92SfC4ag6xfLplQ4f7kF7THJHTNJHRCHVh+ sMiGR9f6Oh4tFru+Snra2BV4GJOag3px3QmTNX2VAa+iuoVdyVEDgjAZql1YLxkqbXLV LaGQ== X-Gm-Message-State: AOJu0YxYENEUnVwOr+tyz452tmsCyWazO5PXHmO38q1MgDB/MvNaVnlt mx8ZzUjJTiuEf/ZfjQ5ycRjCGUNljKCHC0xgJr8lXe1C3vmlOktxQQWatz1/ X-Google-Smtp-Source: AGHT+IFM08MQh1Mj0Ys47eA3acaiOG8St6/jSjRFswUy25Iw+Mh3ZEKE2BqE4Qh6t/r4YsJwsfWOwQ== X-Received: by 2002:a17:906:5909:b0:a44:16dc:14e7 with SMTP id h9-20020a170906590900b00a4416dc14e7mr4149627ejq.11.1710175120467; Mon, 11 Mar 2024 09:38:40 -0700 (PDT) Received: from mariano ([188.210.239.79]) by smtp.gmail.com with ESMTPSA id l12-20020a170906230c00b00a463758e663sm388471eja.33.2024.03.11.09.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 09:38:40 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id 16C04BFCDC; Mon, 11 Mar 2024 17:38:38 +0100 (CET) Date: Mon, 11 Mar 2024 17:38:38 +0100 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches , Marth64 References: <20240311004411.140656-1-marth64@proxyid.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240311004411.140656-1-marth64@proxyid.net> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH v2] avcodec/ccaption_dec: honor transparency of leading non-breaking space 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: Marth64 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On date Sunday 2024-03-10 19:44:11 -0500, Marth64 wrote: > In Closed Captions (US), the non-breaking space (0xA0) can be used to align > text horizontally from the left by using it as a leading character. > However, CC decoder does not ignore it as a leading character like it does > an ordinary space, so a blank padding is rendered over the black CC box. > This is not the intended viewing experience. > > Ignore the leading non-breaking spaces, thus creating the intended transparency > which aligns the text. Since all characters are fixed-width in CC, it > can be handled the same way as we currently treat leading ordinary spaces. > Also, as a nit, lowercase the NBSP's hex code in the entry table to match > casing of the other hex codes. > > v2 only updates the commit message which mistakenly referenced avformat. > > Signed-off-by: Marth64 > --- > libavcodec/ccaption_dec.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c > index faf058ce97..591013d202 100644 > --- a/libavcodec/ccaption_dec.c > +++ b/libavcodec/ccaption_dec.c > @@ -91,7 +91,7 @@ enum cc_charset { > ENTRY(0x36, "\u00a3") \ > ENTRY(0x37, "\u266a") \ > ENTRY(0x38, "\u00e0") \ > - ENTRY(0x39, "\u00A0") \ > + ENTRY(0x39, "\u00a0") \ > ENTRY(0x3a, "\u00e8") \ > ENTRY(0x3b, "\u00e2") \ > ENTRY(0x3c, "\u00ea") \ > @@ -471,7 +471,8 @@ static int capture_screen(CCaptionSubContext *ctx) > const char *row = screen->characters[i]; > const char *charset = screen->charsets[i]; > j = 0; > - while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN) > + while ((row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN) || > + (row[j] == 0x39 && charset[j] == CCSET_SPECIAL_AMERICAN)) > j++; > if (!tab || j < tab) > tab = j; > @@ -491,7 +492,9 @@ static int capture_screen(CCaptionSubContext *ctx) > j = 0; > > /* skip leading space */ > - while (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN && j < tab) > + while (j < tab && > + (row[j] == ' ' && charset[j] == CCSET_BASIC_AMERICAN) || > + (row[j] == 0x39 && charset[j] == CCSET_SPECIAL_AMERICAN)) > j++; Patch LGTM, will apply the complete patcheset if I see no comments after a few days. Thanks. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".