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 ESMTPS id F31FA4DCC7 for ; Sun, 2 Mar 2025 15:00:25 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D81FC68E36A; Sun, 2 Mar 2025 17:00:21 +0200 (EET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12olkn2018.outbound.protection.outlook.com [40.92.23.18]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 455F768E34B for ; Sun, 2 Mar 2025 17:00:15 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=c/QAz4GwAf3fUdn7hXDnRJeFCibJS7SZvEFq41+QMMXvI7ryoPjxNNuPdEIVJT/sAEyaD3fMLxa+m5VUzTOWevAfKBzQzUntTEhd+WIU5kP1P3LS1cDRXMifchAudTwkfpIiakm+GkoZC3uLBWaU2t3OHAqXnDdS7g6bUltkn0Bc7Q3YmKSirDFF9scGRX2COrIzZc2CHMkvYfmFyjz1aXBEYOru169JM1csCP2jCzYiqQwrGMWz1TGP6P9JdggCOJbw0wlj4+t5c5URm3IAzNJlhlrfSUtRnhCVcEZ95/FYH5Vks9C9Evyt4dfxrfmbBlGE+XRVa1LV77J+3smz8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=x8VsmsrTYbt+Qn7B7pdNbTvU2tH818WX8ch8gAMNjqI=; b=x7Tbzm3dPsq88qyciodFz9czpzgp8xkHsEFFm5n76EFC/eDH1juf0UL9t54Ld3BC+qrn6Y6jq2XhBmpfGxAgxEu73TyPZYE/dI3H6nzssGxyuH1yqzWk9LLSMxS/F8kUG7KcYMJWklD12NK+mzU+c7GpaI9MXNe/4R3i1AnNhhpPbzUo2SYSmb6z0JZV/yba8yR8sY61PjHRvCeKrKAERye+z4eabCALiwkXdjSRZ89iIaHwrZ8BZ3e83ufuc7IKjCQVwEsgQpfkg5yl51/kYOY8Pnn1p2h7nc3pjW3ATcs7mhcjUHAkdt1LKCDi+ee5MxWGRvV2HZDJDv3vnV0VLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x8VsmsrTYbt+Qn7B7pdNbTvU2tH818WX8ch8gAMNjqI=; b=nI81INi61W8mUtkCR+HoCJFOIs9zzpofObCUh5Z8rr10TRbFvR2RtOe4l3yHF2a5X6v6xOedYBgt7fXUxFzVdZnBqZbZgmVbtxBctWlQta3dP+yjysxqH99Ms2cYKkn6N/z7T2u1ylPbhPKFIXHo9XAdZyYFrgPWtQ/WwkukgBpSGhxHeHvDUCMbMdxPqRVzvdfD8xgPA/l7D4h2v5zQ0boQR2IWbSOqCfqOYiNNAajjlvLI2WDHI9vx/vOcyzO/YqflCWyaI8P6XoydzO64+8eCA3loR2HEQKHvE4+VIWCxXuH31IavYg9NNSdQcbNRiul2JPAp83/q0m01OzDm/A== Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM (2603:10b6:8:b::20) by SA1P223MB1092.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:3c9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8489.27; Sun, 2 Mar 2025 15:00:12 +0000 Received: from DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::bf09:8e9:b07f:98a7]) by DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM ([fe80::bf09:8e9:b07f:98a7%7]) with mapi id 15.20.8489.025; Sun, 2 Mar 2025 15:00:11 +0000 From: Soft Works To: FFmpeg development discussions and patches Thread-Topic: [FFmpeg-devel] [PATCH v4] libavcodec/dvbsubenc.c: add a disable_2bpp option to work around some decoders. Thread-Index: AQHbir8uxJd60YTWqkuRMuBU/33e0bNf5VPA Date: Sun, 2 Mar 2025 15:00:11 +0000 Message-ID: References: <78DB821E-BD88-4C49-A825-DF44E458066D@waider.ie> <20250301153208.3852-1-waider@waider.ie> In-Reply-To: <20250301153208.3852-1-waider@waider.ie> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM8P223MB0365:EE_|SA1P223MB1092:EE_ x-ms-office365-filtering-correlation-id: 86779a0b-96db-4257-baba-08dd599aee89 x-microsoft-antispam: BCL:0; ARA:14566002|461199028|8062599003|19110799003|8022599003|15080799006|7092599003|8060799006|3412199025|440099028|4302099013|10035399004|41001999003|102099032|1602099012; x-microsoft-antispam-message-info: =?iso-8859-1?Q?beSMuOMSG7SMs3PVM7Idn3Mp7i9h6dCQv1I3WSgdfNpgK2AOrssPHo+bsh?= =?iso-8859-1?Q?kp3suQ8evivzAOtDrULhW3nn7ORXqUSrzvtlaNdQwXPlMQ8XFRXAbbMurH?= =?iso-8859-1?Q?tlvWQLVXNvp+4CDQqxsBRBlpQIn3CqvwKH8bWzCmpis3YNKLpsUe5KkNDe?= =?iso-8859-1?Q?JxwxFPcnq6/qORaDU8rUqgIeVkiQ9yVTy7wNxXKg+6DXCscGCCSzqNNKLt?= =?iso-8859-1?Q?0F2zyPhGp8R5RWZM8jZ0Eb4/tRS104NeE0Ti+ZwH8cPy9z0muYfjrZAJr6?= =?iso-8859-1?Q?E0l2R2qp79xHtT8nD4bOn5iTENz4mdxQQLcpi1RE7pophCP6rV79aq0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aSuZS6d?= =?iso-8859-1?Q?vb2qgstt74oakU5oHkurnvIG7fI9dPb9lfghFNJDwqgoVZ2DZefQ2jkFzd?= =?iso-8859-1?Q?TacYfVS8W1Bv8nYdppgAjxyPVry+n200MMosZPYIqATDIXnoWRGnHmQN3G?= =?iso-8859-1?Q?nLKFcRiKxsO9ds7Qws4n696SBhixorg+p2GMTS067fw1zNmmo3y8TQCtcT?= =?iso-8859-1?Q?yCRdo+w/aWJJWLd53KdszoKebCR5F1Bc0QLXYwrTgyXEQkmD72HUKm/HW8?= =?iso-8859-1?Q?2FHU9YN8DgqFsohVXAgbqJovEtvvt+Df6cf/d/jcg8X/wcGRMQDMyhOg9z?= =?iso-8859-1?Q?v2zD3BhbXdTWaURAuUc3Sb5qknwtrRv5mj/UesUFN3yKjCgUbzrRFjCcXq?= =?iso-8859-1?Q?X/kQkUnLru4+FNUy2Ga0EjrBeT2/WCb2GBKHJpdDppdQLqKOfFgKRKJS0b?= =?iso-8859-1?Q?W7uo864hBguG/t98FljG0P2FtVCooeC6L7qr7SENQkjbQ2fpCfw+1sNPf7?= =?iso-8859-1?Q?fdUWTINdK1mkvyGyCOjkBJc1ldVIjJUk20iN3HC92vwHIHQqEEHeO9Iu/n?= =?iso-8859-1?Q?SvwS1YhAZGR5WG7ZxkhDdLeVqcFCCge6i9A3dapUs=3D?= MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-7719-20-msonline-outlook-92255.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 86779a0b-96db-4257-baba-08dd599aee89 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Mar 2025 15:00:11.7843 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1P223MB1092 Subject: Re: [FFmpeg-devel] [PATCH v4] libavcodec/dvbsubenc.c: add a disable_2bpp option to work around some decoders. 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: Ronan Waide Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > -----Original Message----- > From: ffmpeg-devel On Behalf Of Ronan > Waide > Sent: Samstag, 1. M=E4rz 2025 16:32 > To: ffmpeg-devel@ffmpeg.org > Cc: Ronan Waide > Subject: [FFmpeg-devel] [PATCH v4] libavcodec/dvbsubenc.c: add a > disable_2bpp option to work around some decoders. > = > As noted in the code in several places, some DVB subtitle decoders > don't handle 2bpp color. This patch adds a disable_2bpp option which > disables the 2bpp format; subtitles which would use 2bpp will be bumped > up to 4bpp. > = > Signed-off-by: Ronan Waide > --- > doc/encoders.texi | 27 ++++++++++++++ > libavcodec/dvbsubenc.c | 85 +++++++++++++++++++++++++++++++++--------- > 2 files changed, 95 insertions(+), 17 deletions(-) > = > diff --git a/doc/encoders.texi b/doc/encoders.texi > index f3fcc1aa60..07984b6b54 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -4484,6 +4484,33 @@ Reduces detail but attempts to preserve color at > extremely low bitrates. > @chapter Subtitles Encoders > @c man begin SUBTITLES ENCODERS > = > +@section dvbsub > + > +This codec encodes the bitmap subtitle format that is used in DVB > +broadcasts and recordings. The bitmaps are typically embedded in a > +container such as MPEG-TS as a separate stream. > + > +@subsection Options > + > +@table @option > +@item disable_2bpp @var{boolean} > +Disable the 2 bits-per-pixel encoding format. > + > +DVB supports 2, 4, and 8 bits-per-pixel color lookup tables. However, > +not all players support or properly support 2 bits-per-pixel, > +resulting in unusable subtitles. > +@table @option > +@item 0 > +The 2 bits-per-pixel encoding format will be used for subtitles with 4 > +colors or less. (default) > + > +@item 1 > +The 2 bits-per-pixel encoding format will be disabled, and subtitles > +with 4 colors or less will use a 4 bits-per-pixel format. > +@end table > + > +@end table > + > @section dvdsub > = > This codec encodes the bitmap subtitle format that is used in DVDs. > diff --git a/libavcodec/dvbsubenc.c b/libavcodec/dvbsubenc.c > index 822e3a5309..727a75e901 100644 > --- a/libavcodec/dvbsubenc.c > +++ b/libavcodec/dvbsubenc.c > @@ -22,9 +22,13 @@ > #include "bytestream.h" > #include "codec_internal.h" > #include "libavutil/colorspace.h" > +#include "libavutil/opt.h" > = > typedef struct DVBSubtitleContext { > + AVClass * class; > int object_version; > + int disable_2bpp; > + int min_colors; > } DVBSubtitleContext; > = > #define PUTBITS2(val)\ > @@ -38,6 +42,18 @@ typedef struct DVBSubtitleContext { > }\ > } > = > +static int dvbsub_init(AVCodecContext *avctx) > +{ > + DVBSubtitleContext *s =3D avctx->priv_data; > + if (s->disable_2bpp) { > + av_log(avctx, AV_LOG_DEBUG, "Disabling 2bpp subtitles.\n"); > + s->min_colors =3D 16; > + } else { > + s->min_colors =3D 0; > + } > + return 0; > +} > + > static int dvb_encode_rle2(uint8_t **pq, int buf_size, > const uint8_t *bitmap, int linesize, > int w, int h) > @@ -326,18 +342,22 @@ static int dvbsub_encode(AVCodecContext *avctx, > uint8_t *outbuf, int buf_size, > = > if (h->num_rects) { > for (clut_id =3D 0; clut_id < h->num_rects; clut_id++) { > - if (buf_size < 6 + h->rects[clut_id]->nb_colors * 6) > + int nb_colors =3D s->min_colors > h->rects[clut_id]- > >nb_colors > + ? s->min_colors > + : h->rects[clut_id]->nb_colors; > + > + if (buf_size < 6 + nb_colors * 6) > return AVERROR_BUFFER_TOO_SMALL; > = > /* CLUT segment */ > = > - if (h->rects[clut_id]->nb_colors <=3D 4) { > + if (nb_colors <=3D 4) { > /* 2 bpp, some decoders do not support it correctly */ > bpp_index =3D 0; > - } else if (h->rects[clut_id]->nb_colors <=3D 16) { > + } else if (nb_colors <=3D 16) { > /* 4 bpp, standard encoding */ > bpp_index =3D 1; > - } else if (h->rects[clut_id]->nb_colors <=3D 256) { > + } else if (nb_colors <=3D 256) { > /* 8 bpp, standard encoding */ > bpp_index =3D 2; > } else { > @@ -354,16 +374,24 @@ static int dvbsub_encode(AVCodecContext *avctx, > uint8_t *outbuf, int buf_size, > *q++ =3D clut_id; > *q++ =3D (0 << 4) | 0xf; /* version =3D 0 */ > = > - for(i =3D 0; i < h->rects[clut_id]->nb_colors; i++) { > + for(i =3D 0; i < nb_colors; i++) { > *q++ =3D i; /* clut_entry_id */ > *q++ =3D (1 << (7 - bpp_index)) | (0xf << 1) | 1; /* 2 > bits/pixel full range */ > { > int a, r, g, b; > - uint32_t x=3D ((uint32_t*)h->rects[clut_id]- > >data[1])[i]; > - a =3D (x >> 24) & 0xff; > - r =3D (x >> 16) & 0xff; > - g =3D (x >> 8) & 0xff; > - b =3D (x >> 0) & 0xff; > + if (i < h->rects[clut_id]->nb_colors) { > + uint32_t x=3D ((uint32_t*)h->rects[clut_id]- > >data[1])[i]; > + a =3D (x >> 24) & 0xff; > + r =3D (x >> 16) & 0xff; > + g =3D (x >> 8) & 0xff; > + b =3D (x >> 0) & 0xff; > + } else { > + /* pad out the CLUT */ > + a =3D 0; > + r =3D 0; > + g =3D 0; > + b =3D 0; > + } > = > *q++ =3D RGB_TO_Y_CCIR(r, g, b); > *q++ =3D RGB_TO_V_CCIR(r, g, b, 0); > @@ -373,7 +401,7 @@ static int dvbsub_encode(AVCodecContext *avctx, > uint8_t *outbuf, int buf_size, > } > = > bytestream_put_be16(&pseg_len, q - pseg_len - 2); > - buf_size -=3D 6 + h->rects[clut_id]->nb_colors * 6; > + buf_size -=3D 6 + nb_colors * 6; > } > = > if (buf_size < h->num_rects * 22) > @@ -381,14 +409,17 @@ static int dvbsub_encode(AVCodecContext *avctx, > uint8_t *outbuf, int buf_size, > for (region_id =3D 0; region_id < h->num_rects; region_id++) { > = > /* region composition segment */ > + int nb_colors =3D s->min_colors > h->rects[region_id]- > >nb_colors > + ? s->min_colors > + : h->rects[region_id]->nb_colors; > = > - if (h->rects[region_id]->nb_colors <=3D 4) { > + if (nb_colors <=3D 4) { > /* 2 bpp, some decoders do not support it correctly */ > bpp_index =3D 0; > - } else if (h->rects[region_id]->nb_colors <=3D 16) { > + } else if (nb_colors <=3D 16) { > /* 4 bpp, standard encoding */ > bpp_index =3D 1; > - } else if (h->rects[region_id]->nb_colors <=3D 256) { > + } else if (nb_colors <=3D 256) { > /* 8 bpp, standard encoding */ > bpp_index =3D 2; > } else { > @@ -424,17 +455,21 @@ static int dvbsub_encode(AVCodecContext *avctx, > uint8_t *outbuf, int buf_size, > const uint8_t *bitmap, int linesize, > int w, int h); > = > + int nb_colors =3D s->min_colors > h->rects[object_id]- > >nb_colors > + ? s->min_colors > + : h->rects[object_id]->nb_colors; > + > if (buf_size < 13) > return AVERROR_BUFFER_TOO_SMALL; > = > /* bpp_index maths */ > - if (h->rects[object_id]->nb_colors <=3D 4) { > + if (nb_colors <=3D 4) { > /* 2 bpp, some decoders do not support it correctly */ > dvb_encode_rle =3D dvb_encode_rle2; > - } else if (h->rects[object_id]->nb_colors <=3D 16) { > + } else if (nb_colors <=3D 16) { > /* 4 bpp, standard encoding */ > dvb_encode_rle =3D dvb_encode_rle4; > - } else if (h->rects[object_id]->nb_colors <=3D 256) { > + } else if (nb_colors <=3D 256) { > /* 8 bpp, standard encoding */ > dvb_encode_rle =3D dvb_encode_rle8; > } else { > @@ -506,6 +541,20 @@ static int dvbsub_encode(AVCodecContext *avctx, > uint8_t *outbuf, int buf_size, > return q - outbuf; > } > = > +#define OFFSET(x) offsetof(DVBSubtitleContext, x) > +#define SE AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM > +static const AVOption options[] =3D { > + {"disable_2bpp", "disable the 2bpp subtitle encoder", > OFFSET(disable_2bpp), AV_OPT_TYPE_BOOL, {.i64 =3D 0}, 0, 1, SE}, > + { NULL }, > +}; > + > +static const AVClass dvbsubenc_class =3D { > + .class_name =3D "DVBSUB subtitle encoder", > + .item_name =3D av_default_item_name, > + .option =3D options, > + .version =3D LIBAVUTIL_VERSION_INT, > +}; > + > const FFCodec ff_dvbsub_encoder =3D { > .p.name =3D "dvbsub", > CODEC_LONG_NAME("DVB subtitles"), > @@ -513,4 +562,6 @@ const FFCodec ff_dvbsub_encoder =3D { > .p.id =3D AV_CODEC_ID_DVB_SUBTITLE, > .priv_data_size =3D sizeof(DVBSubtitleContext), > FF_CODEC_ENCODE_SUB_CB(dvbsub_encode), > + .init =3D dvbsub_init, > + .p.priv_class =3D &dvbsubenc_class, > }; > -- Hi Ronan, thanks for your patch, it LGTM. This was ringing some bell, I didn't immediately know what it was, but now = I remember that we had encountered the 2bpp incompatibility with certain de= coders when implementing the text2graphicsub filter (demo here: https://git= hub.com/softworkz/SubtitleFilteringDemos/tree/master/Demo1), and so we chos= e to use a default of 16 for the output colors of the text2graphicsub filte= r to avoid that situation: https://github.com/softworkz/FFmpeg/blob/bb1179897474e20966d5cb7724877ca651= fe13d8/libavfilter/sf_text2graphicsub.c#L587-L588 In the light of these experiences, I would propose to go even one step furt= her and make 4bpp the default minimum, either by setting the default value = of disable_2bpp to 1 - or by renaming it to enable_2bpp with a default of 0= and a description like "2bpp is not supported by all decoders. By default,= 4bpp is used as the minimum. Set this to enable 2pbb encoding." Did you try running FATE while disable_2bpp is hardcoded to 1? If it causes= any test failures, then the FATE reference results would need to be adjust= ed accordingly. sw _______________________________________________ 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".