]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/motionpixels.c
mmal: Remove setting extradata on input format
[ffmpeg] / libavcodec / motionpixels.c
index 6c1efadd56114a304e8d084495ca516ba8f391cf..a18541b85246d0746aa52aeb1df20f3f1b508996 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "avcodec.h"
 #include "get_bits.h"
-#include "dsputil.h"
+#include "bswapdsp.h"
 #include "internal.h"
 
 #define MAX_HUFF_CODES 16
@@ -37,7 +37,7 @@ typedef struct HuffCode {
 typedef struct MotionPixelsContext {
     AVCodecContext *avctx;
     AVFrame *frame;
-    DSPContext dsp;
+    BswapDSPContext bdsp;
     uint8_t *changes_map;
     int offset_bits_len;
     int codes_count, current_codes_count;
@@ -71,7 +71,7 @@ static av_cold int mp_decode_init(AVCodecContext *avctx)
 
     motionpixels_tableinit();
     mp->avctx = avctx;
-    ff_dsputil_init(&mp->dsp, avctx);
+    ff_bswapdsp_init(&mp->bdsp);
     mp->changes_map = av_mallocz(avctx->width * h4);
     mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
     mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel));
@@ -212,13 +212,13 @@ static void mp_decode_line(MotionPixelsContext *mp, GetBitContext *gb, int y)
             p = mp_get_yuv_from_rgb(mp, x - 1, y);
         } else {
             p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
-            p.y = av_clip(p.y, 0, 31);
+            p.y = av_clip_uintp2(p.y, 5);
             if ((x & 3) == 0) {
                 if ((y & 3) == 0) {
                     p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb));
-                    p.v = av_clip(p.v, -32, 31);
+                    p.v = av_clip_intp2(p.v, 5);
                     p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb));
-                    p.u = av_clip(p.u, -32, 31);
+                    p.u = av_clip_intp2(p.u, 5);
                     mp->hpt[((y / 4) * mp->avctx->width + x) / 4] = p;
                 } else {
                     p.v = mp->hpt[((y / 4) * mp->avctx->width + x) / 4].v;
@@ -242,12 +242,12 @@ static void mp_decode_frame_helper(MotionPixelsContext *mp, GetBitContext *gb)
             p = mp_get_yuv_from_rgb(mp, 0, y);
         } else {
             p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
-            p.y = av_clip(p.y, 0, 31);
+            p.y = av_clip_uintp2(p.y, 5);
             if ((y & 3) == 0) {
                 p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb));
-                p.v = av_clip(p.v, -32, 31);
+                p.v = av_clip_intp2(p.v, 5);
                 p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb));
-                p.u = av_clip(p.u, -32, 31);
+                p.u = av_clip_intp2(p.u, 5);
             }
             mp->vpt[y] = p;
             mp_set_rgb_from_yuv(mp, 0, y, &p);
@@ -274,13 +274,14 @@ static int mp_decode_frame(AVCodecContext *avctx,
     }
 
     /* le32 bitstream msb first */
-    av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
+    av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + AV_INPUT_BUFFER_PADDING_SIZE);
     if (!mp->bswapbuf)
         return AVERROR(ENOMEM);
-    mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4);
+    mp->bdsp.bswap_buf((uint32_t *) mp->bswapbuf, (const uint32_t *) buf,
+                       buf_size / 4);
     if (buf_size & 3)
         memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3);
-    memset(mp->bswapbuf + buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+    memset(mp->bswapbuf + buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
     init_get_bits(&gb, mp->bswapbuf, buf_size * 8);
 
     memset(mp->changes_map, 0, avctx->width * avctx->height);
@@ -330,5 +331,5 @@ AVCodec ff_motionpixels_decoder = {
     .init           = mp_decode_init,
     .close          = mp_decode_end,
     .decode         = mp_decode_frame,
-    .capabilities   = CODEC_CAP_DR1,
+    .capabilities   = AV_CODEC_CAP_DR1,
 };