]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/qpeg.c
cosmetics: use a better function name than uncouple_channels()
[ffmpeg] / libavcodec / qpeg.c
index f7323a8719f5f941dd913ce1be3fba96303ea907..f0ef1ef94c4c6cd7d2b054d30c2d661a4f2836ec 100644 (file)
@@ -2,20 +2,21 @@
  * QPEG codec
  * Copyright (c) 2004 Konstantin Shishkov
  *
- * 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
- *
  */
 
 /**
@@ -24,7 +25,6 @@
  */
 
 #include "avcodec.h"
-#include "mpegvideo.h"
 
 typedef struct QpegContext{
     AVCodecContext *avctx;
@@ -32,7 +32,7 @@ typedef struct QpegContext{
     uint8_t *refdata;
 } QpegContext;
 
-static void qpeg_decode_intra(uint8_t *src, uint8_t *dst, int size,
+static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size,
                             int stride, int width, int height)
 {
     int i;
@@ -108,28 +108,26 @@ static void qpeg_decode_intra(uint8_t *src, uint8_t *dst, int size,
     }
 }
 
-static int qpeg_table_h[16] =
+static const int qpeg_table_h[16] =
  { 0x00, 0x20, 0x20, 0x20, 0x18, 0x10, 0x10, 0x20, 0x10, 0x08, 0x18, 0x08, 0x08, 0x18, 0x10, 0x04};
-static int qpeg_table_w[16] =
+static const int qpeg_table_w[16] =
  { 0x00, 0x20, 0x18, 0x08, 0x18, 0x10, 0x20, 0x10, 0x08, 0x10, 0x20, 0x20, 0x08, 0x10, 0x18, 0x04};
 
 /* Decodes delta frames */
-static void qpeg_decode_inter(uint8_t *src, uint8_t *dst, int size,
+static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
                             int stride, int width, int height,
-                            int delta, uint8_t *ctable, uint8_t *refdata)
+                            int delta, const uint8_t *ctable, uint8_t *refdata)
 {
     int i, j;
     int code;
     int filled = 0;
     int orig_height;
-    uint8_t *blkdata;
 
     /* copy prev frame */
     for(i = 0; i < height; i++)
         memcpy(refdata + (i * width), dst + (i * stride), width);
 
     orig_height = height;
-    blkdata = src - 0x86;
     height--;
     dst = dst + height * stride;
 
@@ -250,7 +248,7 @@ static void qpeg_decode_inter(uint8_t *src, uint8_t *dst, int size,
 
 static int decode_frame(AVCodecContext *avctx,
                         void *data, int *data_size,
-                        uint8_t *buf, int buf_size)
+                        const uint8_t *buf, int buf_size)
 {
     QpegContext * const a = avctx->priv_data;
     AVFrame * const p= (AVFrame*)&a->pic;
@@ -286,19 +284,18 @@ static int decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-static int decode_init(AVCodecContext *avctx){
+static av_cold int decode_init(AVCodecContext *avctx){
     QpegContext * const a = avctx->priv_data;
 
     a->avctx = avctx;
     avctx->pix_fmt= PIX_FMT_PAL8;
-    avctx->has_b_frames = 0;
     a->pic.data[0] = NULL;
     a->refdata = av_malloc(avctx->width * avctx->height);
 
     return 0;
 }
 
-static int decode_end(AVCodecContext *avctx){
+static av_cold int decode_end(AVCodecContext *avctx){
     QpegContext * const a = avctx->priv_data;
     AVFrame * const p= (AVFrame*)&a->pic;
 
@@ -319,4 +316,5 @@ AVCodec qpeg_decoder = {
     decode_end,
     decode_frame,
     CODEC_CAP_DR1,
+    .long_name = NULL_IF_CONFIG_SMALL("Q-team QPEG"),
 };