]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/tiertexseqv.c
Replace int_fast integer types with their sized standard posix counterparts.
[ffmpeg] / libavcodec / tiertexseqv.c
index f106ceb321915a84755726c04bcdae62d2c36656..4468f00df1ea7b13a3d899727bbe20a97bbd3091 100644 (file)
@@ -2,38 +2,36 @@
  * Tiertex Limited SEQ Video Decoder
  * Copyright (c) 2006 Gregory Montoir (cyx@users.sourceforge.net)
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
- * @file tiertexseqv.c
+ * @file
  * Tiertex Limited SEQ video decoder
  */
 
 #include "avcodec.h"
 #define ALT_BITSTREAM_READER_LE
-#include "bitstream.h"
+#include "get_bits.h"
 
 
 typedef struct SeqVideoContext {
     AVCodecContext *avctx;
     AVFrame frame;
-    unsigned int palette[256];
-    unsigned char block[8 * 8];
 } SeqVideoContext;
 
 
@@ -72,22 +70,23 @@ static const unsigned char *seq_decode_op1(SeqVideoContext *seq, const unsigned
     const unsigned char *color_table;
     int b, i, len, bits;
     GetBitContext gb;
+    unsigned char block[8 * 8];
 
     len = *src++;
     if (len & 0x80) {
         switch (len & 3) {
         case 1:
-            src = seq_unpack_rle_block(src, seq->block, sizeof(seq->block));
+            src = seq_unpack_rle_block(src, block, sizeof(block));
             for (b = 0; b < 8; b++) {
-                memcpy(dst, &seq->block[b * 8], 8);
+                memcpy(dst, &block[b * 8], 8);
                 dst += seq->frame.linesize[0];
             }
             break;
         case 2:
-            src = seq_unpack_rle_block(src, seq->block, sizeof(seq->block));
+            src = seq_unpack_rle_block(src, block, sizeof(block));
             for (i = 0; i < 8; i++) {
                 for (b = 0; b < 8; b++)
-                    dst[b * seq->frame.linesize[0]] = seq->block[i * 8 + b];
+                    dst[b * seq->frame.linesize[0]] = block[i * 8 + b];
                 ++dst;
             }
             break;
@@ -139,16 +138,17 @@ static void seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int
     int flags, i, j, x, y, op;
     unsigned char c[3];
     unsigned char *dst;
+    uint32_t *palette;
 
     flags = *data++;
 
     if (flags & 1) {
+        palette = (uint32_t *)seq->frame.data[1];
         for (i = 0; i < 256; i++) {
             for (j = 0; j < 3; j++, data++)
                 c[j] = (*data << 2) | (*data >> 4);
-            seq->palette[i] = AV_RB24(c);
+            palette[i] = AV_RB24(c);
         }
-        memcpy(seq->frame.data[1], seq->palette, sizeof(seq->palette));
         seq->frame.palette_has_changed = 1;
     }
 
@@ -173,7 +173,7 @@ static void seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int
     }
 }
 
-static int seqvideo_decode_init(AVCodecContext *avctx)
+static av_cold int seqvideo_decode_init(AVCodecContext *avctx)
 {
     SeqVideoContext *seq = avctx->priv_data;
 
@@ -187,8 +187,10 @@ static int seqvideo_decode_init(AVCodecContext *avctx)
 
 static int seqvideo_decode_frame(AVCodecContext *avctx,
                                  void *data, int *data_size,
-                                 const uint8_t *buf, int buf_size)
+                                 AVPacket *avpkt)
 {
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
 
     SeqVideoContext *seq = avctx->priv_data;
 
@@ -207,7 +209,7 @@ static int seqvideo_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-static int seqvideo_decode_end(AVCodecContext *avctx)
+static av_cold int seqvideo_decode_end(AVCodecContext *avctx)
 {
     SeqVideoContext *seq = avctx->priv_data;
 
@@ -217,9 +219,9 @@ static int seqvideo_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec tiertexseqvideo_decoder = {
+AVCodec ff_tiertexseqvideo_decoder = {
     "tiertexseqvideo",
-    CODEC_TYPE_VIDEO,
+    AVMEDIA_TYPE_VIDEO,
     CODEC_ID_TIERTEXSEQVIDEO,
     sizeof(SeqVideoContext),
     seqvideo_decode_init,
@@ -227,4 +229,5 @@ AVCodec tiertexseqvideo_decoder = {
     seqvideo_decode_end,
     seqvideo_decode_frame,
     CODEC_CAP_DR1,
+    .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ video"),
 };