Re: [FFmpeg-devel] [PATCH]lavc/rscc: Support pal8

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 21:42 GMT+02:00 Paul B Mahol :
> On 9/19/16, Carl Eugen Hoyos  wrote:
>> 2016-09-19 20:28 GMT+02:00 Paul B Mahol :
>>> On 9/19/16, Carl Eugen Hoyos  wrote:
>>>
 Attached patch fixes the colours for the sample in ticket #5611.
>>
>>> You should use av_packet_get_side_data instead.
>>
>> New patch attached, thank you!

> OK

Patch applied.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavc/rscc: Support pal8

2016-09-19 Thread Paul B Mahol
On 9/19/16, Carl Eugen Hoyos  wrote:
> 2016-09-19 20:28 GMT+02:00 Paul B Mahol :
>> On 9/19/16, Carl Eugen Hoyos  wrote:
>>
>>> Attached patch fixes the colours for the sample in ticket #5611.
>
>> You should use av_packet_get_side_data instead.
>
> New patch attached, thank you!
>
> Carl Eugen
>

OK
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavc/rscc: Support pal8

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 20:28 GMT+02:00 Paul B Mahol :
> On 9/19/16, Carl Eugen Hoyos  wrote:
>
>> Attached patch fixes the colours for the sample in ticket #5611.

> You should use av_packet_get_side_data instead.

New patch attached, thank you!

Carl Eugen
From 233b857e263c7e948ddc12ee2c85d624593a9a09 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Mon, 19 Sep 2016 21:21:27 +0200
Subject: [PATCH] lavc/rscc: Support pal8 in rscc.

Fixes the colours of the sample for ticket #5611.
---
 libavcodec/rscc.c |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c
index 3b3703c..7f280a9 100644
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@ -31,7 +31,7 @@
  * and it can be deflated or not. Similarly, pixel data comes after the header
  * and a variable size value, and it can be deflated or just raw.
  *
- * Supports: GRAY8, BGRA, BGR24, RGB555, RGB8
+ * Supports: BGRA, BGR24, RGB555, PAL8
  */
 
 #include 
@@ -58,6 +58,7 @@ typedef struct RsccContext {
 Tile *tiles;
 unsigned int tiles_size;
 int component_size;
+uint32_t pal[AVPALETTE_COUNT];
 
 /* zlib interaction */
 uint8_t *inflated_buf;
@@ -89,7 +90,7 @@ static av_cold int rscc_init(AVCodecContext *avctx)
 ctx->component_size = avctx->bits_per_coded_sample / 8;
 switch (avctx->bits_per_coded_sample) {
 case 8:
-avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+avctx->pix_fmt = AV_PIX_FMT_PAL8;
 break;
 case 16:
 avctx->pix_fmt = AV_PIX_FMT_RGB555LE;
@@ -308,6 +309,16 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
 } else {
 frame->pict_type = AV_PICTURE_TYPE_P;
 }
+if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
+const uint8_t *pal = av_packet_get_side_data(avpkt,
+ AV_PKT_DATA_PALETTE,
+ NULL);
+if (pal) {
+frame->palette_has_changed = 1;
+memcpy(ctx->pal, pal, AVPALETTE_SIZE);
+}
+memcpy (frame->data[1], ctx->pal, AVPALETTE_SIZE);
+}
 *got_frame = 1;
 
 end:
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavc/rscc: Support pal8

2016-09-19 Thread Paul B Mahol
On 9/19/16, Carl Eugen Hoyos  wrote:
> Hi!
>
> Attached patch fixes the colours for the sample in ticket #5611.
>
> Please comment, Carl Eugen
>

You should use av_packet_get_side_data instead.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel