diff mbox

[FFmpeg-devel] lavc/dvbsub: Allow 256 colour encoding

Message ID CAB0OVGoHvhL8NpxUPi6sN-5BYPaWUa+RUc2KKmTx8FSHqhsOkw@mail.gmail.com
State Accepted
Headers show

Commit Message

Carl Eugen Hoyos Oct. 24, 2017, 12:04 a.m. UTC
Hi!

Trying to encode 256-colour subtitles to dvbsub currently fails in the
"region" section, a hunk of Joolz' patch was not committed six years
ago.
Attached patch has two hunks: The forgotten hunk from the original
patch and further up a fix that I created now (to be committed
separately):
The line separator from the ETSI DVB blue book was missing for rle8 encodings.

Please comment, Carl Eugen

Comments

Michael Niedermayer Oct. 24, 2017, 8:11 p.m. UTC | #1
On Tue, Oct 24, 2017 at 02:04:28AM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Trying to encode 256-colour subtitles to dvbsub currently fails in the
> "region" section, a hunk of Joolz' patch was not committed six years
> ago.
> Attached patch has two hunks: The forgotten hunk from the original
> patch and further up a fix that I created now (to be committed
> separately):
> The line separator from the ETSI DVB blue book was missing for rle8 encodings.
> 
> Please comment, Carl Eugen

>  dvbsub.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 66361a461f9ed49d55b7f753243ffd585b647e23  0001-lavc-dvbsub-Allow-256-colour-encoding.patch
> From 06fd4904b6aa04c3ab8e056ef4f6be4a89093a1c Mon Sep 17 00:00:00 2001
> From: JULIAN GARDNER <joolzg@btinternet.com>
> Date: Tue, 24 Oct 2017 01:59:51 +0200
> Subject: [PATCH] lavc/dvbsub: Allow 256 colour encoding.
> 
> Fixes ticket #6769.

probably ok

thanks

[...]
Carl Eugen Hoyos Oct. 24, 2017, 8:59 p.m. UTC | #2
2017-10-24 22:11 GMT+02:00 Michael Niedermayer <michael@niedermayer.cc>:
> On Tue, Oct 24, 2017 at 02:04:28AM +0200, Carl Eugen Hoyos wrote:

>> Subject: [PATCH] lavc/dvbsub: Allow 256 colour encoding.
>>
>> Fixes ticket #6769.
>
> probably ok

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

From 06fd4904b6aa04c3ab8e056ef4f6be4a89093a1c Mon Sep 17 00:00:00 2001
From: JULIAN GARDNER <joolzg@btinternet.com>
Date: Tue, 24 Oct 2017 01:59:51 +0200
Subject: [PATCH] lavc/dvbsub: Allow 256 colour encoding.

Fixes ticket #6769.
---
 libavcodec/dvbsub.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c
index 3cdbade..8cce702 100644
--- a/libavcodec/dvbsub.c
+++ b/libavcodec/dvbsub.c
@@ -239,9 +239,9 @@  static void dvb_encode_rle8(uint8_t **pq,
             x += len;
         }
         /* end of line */
-        // 00000000 00000000 end of 8-bit/pixel_code_string
-        *q++ = 0x00;
+        // 00000000 end of 8-bit/pixel_code_string
         *q++ = 0x00;
+        *q++ = 0xf0;
         bitmap += linesize;
     }
     *pq = q;
@@ -342,6 +342,9 @@  static int encode_dvb_subtitles(DVBSubtitleContext *s,
         } else if (h->rects[region_id]->nb_colors <= 16) {
             /* 4 bpp, standard encoding */
             bpp_index = 1;
+        } else if (h->rects[region_id]->nb_colors <= 256) {
+            /* 8 bpp, standard encoding */
+            bpp_index = 2;
         } else {
             return -1;
         }
-- 
1.7.10.4