X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fqpeg.c;h=e6a0b30aefbc6075c545e7602320d5bb2276400e;hb=495af353dbb0f0f4792baecc63a45ef563f80e44;hp=44391d185a6bc2acc2e4a9de945a6d3805e1ba6a;hpb=233ed44543c8beee4e48cb895404f4305dd5eabb;p=ffmpeg diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index 44391d185a6..e6a0b30aefb 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -17,16 +17,14 @@ * 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 - * */ /** - * @file qpeg.c + * @file * QPEG codec. */ #include "avcodec.h" -#include "mpegvideo.h" typedef struct QpegContext{ AVCodecContext *avctx; @@ -34,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; @@ -110,15 +108,15 @@ 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; @@ -250,8 +248,10 @@ 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) + AVPacket *avpkt) { + const uint8_t *buf = avpkt->data; + int buf_size = avpkt->size; QpegContext * const a = avctx->priv_data; AVFrame * const p= (AVFrame*)&a->pic; uint8_t* outdata; @@ -286,18 +286,21 @@ 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; + if (!avctx->palctrl) { + av_log(avctx, AV_LOG_FATAL, "Missing required palette via palctrl\n"); + return -1; + } a->avctx = avctx; avctx->pix_fmt= PIX_FMT_PAL8; - 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; @@ -310,7 +313,7 @@ static int decode_end(AVCodecContext *avctx){ AVCodec qpeg_decoder = { "qpeg", - CODEC_TYPE_VIDEO, + AVMEDIA_TYPE_VIDEO, CODEC_ID_QPEG, sizeof(QpegContext), decode_init, @@ -318,4 +321,5 @@ AVCodec qpeg_decoder = { decode_end, decode_frame, CODEC_CAP_DR1, + .long_name = NULL_IF_CONFIG_SMALL("Q-team QPEG"), };