]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/qtrle.c
return if bitrate is not specified or too low
[ffmpeg] / libavcodec / qtrle.c
index 5c6ccb4fb1e2e00e86019879f78957e695a6b0be..4b0f38f740ffb4a65ad8ac6ad609ed2f3dedfbf0 100644 (file)
@@ -17,7 +17,6 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  */
 
 /**
 #include <string.h>
 #include <unistd.h>
 
-#include "common.h"
 #include "avcodec.h"
-#include "dsputil.h"
 
 typedef struct QtrleContext {
 
     AVCodecContext *avctx;
-    DSPContext dsp;
     AVFrame frame;
 
-    unsigned char *buf;
+    const unsigned char *buf;
     int size;
 
 } QtrleContext;
@@ -83,7 +79,7 @@ static void qtrle_decode_4bpp(QtrleContext *s)
     int rle_code;
     int row_ptr, pixel_ptr;
     int row_inc = s->frame.linesize[0];
-    unsigned char pi1, pi2, pi3, pi4, pi5, pi6, pi7, pi8;  /* 8 palette indices */
+    unsigned char pi1, pi2, pi3, pi4, pi5, pi6, pi7, pi8;  /* 8 palette indexes */
     unsigned char *rgb = s->frame.data[0];
     int pixel_limit = s->frame.linesize[0] * s->avctx->height;
 
@@ -126,7 +122,7 @@ static void qtrle_decode_4bpp(QtrleContext *s)
                 /* decode the run length code */
                 rle_code = -rle_code;
                 /* get the next 4 bytes from the stream, treat them as palette
-                 * indices, and output them rle_code times */
+                 * indexes, and output them rle_code times */
                 CHECK_STREAM_PTR(4);
                 pi1 = ((s->buf[stream_ptr]) >> 4) & 0x0f;
                 pi2 = (s->buf[stream_ptr++]) & 0x0f;
@@ -174,7 +170,7 @@ static void qtrle_decode_8bpp(QtrleContext *s)
     int rle_code;
     int row_ptr, pixel_ptr;
     int row_inc = s->frame.linesize[0];
-    unsigned char pi1, pi2, pi3, pi4;  /* 4 palette indices */
+    unsigned char pi1, pi2, pi3, pi4;  /* 4 palette indexes */
     unsigned char *rgb = s->frame.data[0];
     int pixel_limit = s->frame.linesize[0] * s->avctx->height;
 
@@ -217,7 +213,7 @@ static void qtrle_decode_8bpp(QtrleContext *s)
                 /* decode the run length code */
                 rle_code = -rle_code;
                 /* get the next 4 bytes from the stream, treat them as palette
-                 * indices, and output them rle_code times */
+                 * indexes, and output them rle_code times */
                 CHECK_STREAM_PTR(4);
                 pi1 = s->buf[stream_ptr++];
                 pi2 = s->buf[stream_ptr++];
@@ -489,7 +485,7 @@ static void qtrle_decode_32bpp(QtrleContext *s)
     }
 }
 
-static int qtrle_decode_init(AVCodecContext *avctx)
+static av_cold int qtrle_decode_init(AVCodecContext *avctx)
 {
     QtrleContext *s = avctx->priv_data;
 
@@ -523,7 +519,6 @@ static int qtrle_decode_init(AVCodecContext *avctx)
             avctx->bits_per_sample);
         break;
     }
-    dsputil_init(&s->dsp, avctx);
 
     s->frame.data[0] = NULL;
 
@@ -532,7 +527,7 @@ static int qtrle_decode_init(AVCodecContext *avctx)
 
 static int qtrle_decode_frame(AVCodecContext *avctx,
                               void *data, int *data_size,
-                              uint8_t *buf, int buf_size)
+                              const uint8_t *buf, int buf_size)
 {
     QtrleContext *s = avctx->priv_data;
 
@@ -605,7 +600,7 @@ static int qtrle_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-static int qtrle_decode_end(AVCodecContext *avctx)
+static av_cold int qtrle_decode_end(AVCodecContext *avctx)
 {
     QtrleContext *s = avctx->priv_data;
 
@@ -625,5 +620,6 @@ AVCodec qtrle_decoder = {
     qtrle_decode_end,
     qtrle_decode_frame,
     CODEC_CAP_DR1,
+    .long_name = "QuickTime Animation (RLE) video",
 };