]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/interplayvideo.c
aea: Return proper error code on invalid header
[ffmpeg] / libavcodec / interplayvideo.c
index 57035fd11a6bcdf562b7e1f16a8ebe55f974c210..af7aa130d124e24668401d0b5fe765515dea42e3 100644 (file)
@@ -40,7 +40,7 @@
 
 #include "avcodec.h"
 #include "bytestream.h"
-#include "dsputil.h"
+#include "hpeldsp.h"
 #define BITSTREAM_READER_LE
 #include "get_bits.h"
 #include "internal.h"
@@ -50,7 +50,7 @@
 typedef struct IpvideoContext {
 
     AVCodecContext *avctx;
-    DSPContext dsp;
+    HpelDSPContext hdsp;
     AVFrame *second_last_frame;
     AVFrame *last_frame;
     const unsigned char *decoding_map;
@@ -79,12 +79,12 @@ static int copy_from(IpvideoContext *s, AVFrame *src, AVFrame *dst, int delta_x,
             motion_offset, s->upper_motion_limit_offset);
         return AVERROR_INVALIDDATA;
     }
-    if (src->data[0] == NULL) {
+    if (!src->data[0]) {
         av_log(s->avctx, AV_LOG_ERROR, "Invalid decode type, corrupted header?\n");
         return AVERROR(EINVAL);
     }
-    s->dsp.put_pixels_tab[!s->is_16bpp][0](s->pixel_ptr, src->data[0] + motion_offset,
-                                           dst->linesize[0], 8);
+    s->hdsp.put_pixels_tab[!s->is_16bpp][0](s->pixel_ptr, src->data[0] + motion_offset,
+                                            dst->linesize[0], 8);
     return 0;
 }
 
@@ -939,7 +939,7 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
     s->is_16bpp = avctx->bits_per_coded_sample == 16;
     avctx->pix_fmt = s->is_16bpp ? AV_PIX_FMT_RGB555 : AV_PIX_FMT_PAL8;
 
-    ff_dsputil_init(&s->dsp, avctx);
+    ff_hpeldsp_init(&s->hdsp, avctx->flags);
 
     s->last_frame        = av_frame_alloc();
     s->second_last_frame = av_frame_alloc();
@@ -1013,6 +1013,7 @@ static av_cold int ipvideo_decode_end(AVCodecContext *avctx)
 
 AVCodec ff_interplay_video_decoder = {
     .name           = "interplayvideo",
+    .long_name      = NULL_IF_CONFIG_SMALL("Interplay MVE video"),
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_INTERPLAY_VIDEO,
     .priv_data_size = sizeof(IpvideoContext),
@@ -1020,5 +1021,4 @@ AVCodec ff_interplay_video_decoder = {
     .close          = ipvideo_decode_end,
     .decode         = ipvideo_decode_frame,
     .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_PARAM_CHANGE,
-    .long_name      = NULL_IF_CONFIG_SMALL("Interplay MVE video"),
 };