]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/aasc.c
Mask bits of reference indexes properly to avoid negative numbers entangling
[ffmpeg] / libavcodec / aasc.c
index 4622828007beae18b4c5407e05bdf27452190c85..01172018c76b3bc5ae6b2a7d1daf04a578be46e4 100644 (file)
@@ -1,32 +1,33 @@
 /*
- * Autodesc RLE Decoder
+ * Autodesk RLE Decoder
  * Copyright (C) 2005 the ffmpeg project
  *
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg 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 this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
  * @file aasc.c
- * Autodesc RLE Video Decoder by Konstantin Shishkov
+ * Autodesk RLE Video Decoder by Konstantin Shishkov
  */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "common.h"
 #include "avcodec.h"
 #include "dsputil.h"
 
@@ -43,14 +44,13 @@ typedef struct AascContext {
     } \
     stream_byte = buf[stream_ptr++];
 
-static int aasc_decode_init(AVCodecContext *avctx)
+static av_cold int aasc_decode_init(AVCodecContext *avctx)
 {
-    AascContext *s = (AascContext *)avctx->priv_data;
+    AascContext *s = avctx->priv_data;
 
     s->avctx = avctx;
 
     avctx->pix_fmt = PIX_FMT_BGR24;
-    avctx->has_b_frames = 0;
     s->frame.data[0] = NULL;
 
     return 0;
@@ -58,9 +58,9 @@ static int aasc_decode_init(AVCodecContext *avctx)
 
 static int aasc_decode_frame(AVCodecContext *avctx,
                               void *data, int *data_size,
-                              uint8_t *buf, int buf_size)
+                              const uint8_t *buf, int buf_size)
 {
-    AascContext *s = (AascContext *)avctx->priv_data;
+    AascContext *s = avctx->priv_data;
     int stream_ptr = 4;
     unsigned char rle_code;
     unsigned char stream_byte;
@@ -150,9 +150,9 @@ static int aasc_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-static int aasc_decode_end(AVCodecContext *avctx)
+static av_cold int aasc_decode_end(AVCodecContext *avctx)
 {
-    AascContext *s = (AascContext *)avctx->priv_data;
+    AascContext *s = avctx->priv_data;
 
     /* release the last frame */
     if (s->frame.data[0])
@@ -171,4 +171,5 @@ AVCodec aasc_decoder = {
     aasc_decode_end,
     aasc_decode_frame,
     CODEC_CAP_DR1,
+    .long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
 };