[FFmpeg-cvslog] aasc: 8bit support

Paul B Mahol git at videolan.org
Thu Aug 9 02:02:25 CEST 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Aug  8 23:59:33 2012 +0000| [bd971ddaf47aed588985b33659e403950f71dcc7] | committer: Paul B Mahol

aasc: 8bit support

Closes #1319.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd971ddaf47aed588985b33659e403950f71dcc7
---

 libavcodec/aasc.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c
index f34a722..7b48557 100644
--- a/libavcodec/aasc.c
+++ b/libavcodec/aasc.c
@@ -36,14 +36,29 @@ typedef struct AascContext {
     AVCodecContext *avctx;
     GetByteContext gb;
     AVFrame frame;
+
+    uint32_t palette[AVPALETTE_COUNT];
+    int palette_size;
 } AascContext;
 
 static av_cold int aasc_decode_init(AVCodecContext *avctx)
 {
     AascContext *s = avctx->priv_data;
+    uint8_t *ptr;
+    int i;
 
     s->avctx = avctx;
     switch (avctx->bits_per_coded_sample) {
+    case 8:
+        avctx->pix_fmt = PIX_FMT_PAL8;
+
+        ptr = avctx->extradata;
+        s->palette_size = FFMIN(avctx->extradata_size, AVPALETTE_SIZE);
+        for (i = 0; i < s->palette_size / 4; i++) {
+            s->palette[i] = 0xFFU << 24 | AV_RL32(ptr);
+            ptr += 4;
+        }
+        break;
     case 16:
         avctx->pix_fmt = PIX_FMT_RGB555;
         break;
@@ -112,6 +127,9 @@ static int aasc_decode_frame(AVCodecContext *avctx,
         return -1;
     }
 
+    if (avctx->pix_fmt == PIX_FMT_PAL8)
+        memcpy(s->frame.data[1], s->palette, s->palette_size);
+
     *data_size = sizeof(AVFrame);
     *(AVFrame*)data = s->frame;
 



More information about the ffmpeg-cvslog mailing list