]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpegvideo_motion.c
avcodec: add enum values on chroma sample location
[ffmpeg] / libavcodec / mpegvideo_motion.c
index 42def5ee88ba57ced9e2e6c3b93bb4961e221f62..f33db341deb37966e61f97230c37f0d7d4c39b34 100644 (file)
 
 #include "libavutil/internal.h"
 #include "avcodec.h"
-#include "dsputil.h"
 #include "h261.h"
+#include "mpegutils.h"
 #include "mpegvideo.h"
 #include "mjpegenc.h"
 #include "msmpeg4.h"
+#include "qpeldsp.h"
 #include <limits.h>
 
 static void gmc1_motion(MpegEncContext *s,
@@ -70,10 +71,10 @@ static void gmc1_motion(MpegEncContext *s,
     }
 
     if ((motion_x | motion_y) & 7) {
-        s->dsp.gmc1(dest_y, ptr, linesize, 16,
-                    motion_x & 15, motion_y & 15, 128 - s->no_rounding);
-        s->dsp.gmc1(dest_y + 8, ptr + 8, linesize, 16,
-                    motion_x & 15, motion_y & 15, 128 - s->no_rounding);
+        s->mdsp.gmc1(dest_y, ptr, linesize, 16,
+                     motion_x & 15, motion_y & 15, 128 - s->no_rounding);
+        s->mdsp.gmc1(dest_y + 8, ptr + 8, linesize, 16,
+                     motion_x & 15, motion_y & 15, 128 - s->no_rounding);
     } else {
         int dxy;
 
@@ -113,8 +114,8 @@ static void gmc1_motion(MpegEncContext *s,
         ptr = s->edge_emu_buffer;
         emu = 1;
     }
-    s->dsp.gmc1(dest_cb, ptr, uvlinesize, 8,
-                motion_x & 15, motion_y & 15, 128 - s->no_rounding);
+    s->mdsp.gmc1(dest_cb, ptr, uvlinesize, 8,
+                 motion_x & 15, motion_y & 15, 128 - s->no_rounding);
 
     ptr = ref_picture[2] + offset;
     if (emu) {
@@ -125,8 +126,8 @@ static void gmc1_motion(MpegEncContext *s,
                                  s->h_edge_pos >> 1, s->v_edge_pos >> 1);
         ptr = s->edge_emu_buffer;
     }
-    s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8,
-                motion_x & 15, motion_y & 15, 128 - s->no_rounding);
+    s->mdsp.gmc1(dest_cr, ptr, uvlinesize, 8,
+                 motion_x & 15, motion_y & 15, 128 - s->no_rounding);
 }
 
 static void gmc_motion(MpegEncContext *s,
@@ -148,19 +149,19 @@ static void gmc_motion(MpegEncContext *s,
     oy = s->sprite_offset[0][1] + s->sprite_delta[1][0] * s->mb_x * 16 +
          s->sprite_delta[1][1] * s->mb_y * 16;
 
-    s->dsp.gmc(dest_y, ptr, linesize, 16,
-               ox, oy,
-               s->sprite_delta[0][0], s->sprite_delta[0][1],
-               s->sprite_delta[1][0], s->sprite_delta[1][1],
-               a + 1, (1 << (2 * a + 1)) - s->no_rounding,
-               s->h_edge_pos, s->v_edge_pos);
-    s->dsp.gmc(dest_y + 8, ptr, linesize, 16,
-               ox + s->sprite_delta[0][0] * 8,
-               oy + s->sprite_delta[1][0] * 8,
-               s->sprite_delta[0][0], s->sprite_delta[0][1],
-               s->sprite_delta[1][0], s->sprite_delta[1][1],
-               a + 1, (1 << (2 * a + 1)) - s->no_rounding,
-               s->h_edge_pos, s->v_edge_pos);
+    s->mdsp.gmc(dest_y, ptr, linesize, 16,
+                ox, oy,
+                s->sprite_delta[0][0], s->sprite_delta[0][1],
+                s->sprite_delta[1][0], s->sprite_delta[1][1],
+                a + 1, (1 << (2 * a + 1)) - s->no_rounding,
+                s->h_edge_pos, s->v_edge_pos);
+    s->mdsp.gmc(dest_y + 8, ptr, linesize, 16,
+                ox + s->sprite_delta[0][0] * 8,
+                oy + s->sprite_delta[1][0] * 8,
+                s->sprite_delta[0][0], s->sprite_delta[0][1],
+                s->sprite_delta[1][0], s->sprite_delta[1][1],
+                a + 1, (1 << (2 * a + 1)) - s->no_rounding,
+                s->h_edge_pos, s->v_edge_pos);
 
     if (CONFIG_GRAY && s->flags & CODEC_FLAG_GRAY)
         return;
@@ -171,20 +172,20 @@ static void gmc_motion(MpegEncContext *s,
          s->sprite_delta[1][1] * s->mb_y * 8;
 
     ptr = ref_picture[1];
-    s->dsp.gmc(dest_cb, ptr, uvlinesize, 8,
-               ox, oy,
-               s->sprite_delta[0][0], s->sprite_delta[0][1],
-               s->sprite_delta[1][0], s->sprite_delta[1][1],
-               a + 1, (1 << (2 * a + 1)) - s->no_rounding,
-               s->h_edge_pos >> 1, s->v_edge_pos >> 1);
+    s->mdsp.gmc(dest_cb, ptr, uvlinesize, 8,
+                ox, oy,
+                s->sprite_delta[0][0], s->sprite_delta[0][1],
+                s->sprite_delta[1][0], s->sprite_delta[1][1],
+                a + 1, (1 << (2 * a + 1)) - s->no_rounding,
+                s->h_edge_pos >> 1, s->v_edge_pos >> 1);
 
     ptr = ref_picture[2];
-    s->dsp.gmc(dest_cr, ptr, uvlinesize, 8,
-               ox, oy,
-               s->sprite_delta[0][0], s->sprite_delta[0][1],
-               s->sprite_delta[1][0], s->sprite_delta[1][1],
-               a + 1, (1 << (2 * a + 1)) - s->no_rounding,
-               s->h_edge_pos >> 1, s->v_edge_pos >> 1);
+    s->mdsp.gmc(dest_cr, ptr, uvlinesize, 8,
+                ox, oy,
+                s->sprite_delta[0][0], s->sprite_delta[0][1],
+                s->sprite_delta[1][0], s->sprite_delta[1][1],
+                a + 1, (1 << (2 * a + 1)) - s->no_rounding,
+                s->h_edge_pos >> 1, s->v_edge_pos >> 1);
 }
 
 static inline int hpel_motion(MpegEncContext *s,
@@ -253,8 +254,8 @@ void mpeg_motion_internal(MpegEncContext *s,
 #endif
 
     v_edge_pos = s->v_edge_pos >> field_based;
-    linesize   = s->current_picture.f.linesize[0] << field_based;
-    uvlinesize = s->current_picture.f.linesize[1] << field_based;
+    linesize   = s->current_picture.f->linesize[0] << field_based;
+    uvlinesize = s->current_picture.f->linesize[1] << field_based;
 
     dxy   = ((motion_y & 1) << 1) | (motion_x & 1);
     src_x = s->mb_x * 16 + (motion_x >> 1);
@@ -404,7 +405,7 @@ static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y,
                              motion_x, motion_y, h, 0, mb_y);
 }
 
-// FIXME move to dsputil, avg variant, 16x16 version
+// FIXME: SIMDify, avg variant, 16x16 version
 static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride)
 {
     int x;
@@ -825,7 +826,7 @@ static inline void apply_8x8(MpegEncContext *s,
  * @param qpix_op qpel motion compensation function (average or put normally)
  * the motion vectors are taken from s->mv and the MV type from s->mv_type
  */
-static av_always_inline void MPV_motion_internal(MpegEncContext *s,
+static av_always_inline void mpv_motion_internal(MpegEncContext *s,
                                                  uint8_t *dest_y,
                                                  uint8_t *dest_cb,
                                                  uint8_t *dest_cr,
@@ -899,7 +900,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
         } else {
             if (s->picture_structure != s->field_select[dir][0] + 1 &&
                 s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) {
-                ref_picture = s->current_picture_ptr->f.data;
+                ref_picture = s->current_picture_ptr->f->data;
             }
 
             mpeg_motion(s, dest_y, dest_cb, dest_cr,
@@ -916,7 +917,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
                 || s->pict_type == AV_PICTURE_TYPE_B || s->first_field) {
                 ref2picture = ref_picture;
             } else {
-                ref2picture = s->current_picture_ptr->f.data;
+                ref2picture = s->current_picture_ptr->f->data;
             }
 
             mpeg_motion(s, dest_y, dest_cb, dest_cr,
@@ -955,7 +956,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
                 /* opposite parity is always in the same frame if this is
                  * second field */
                 if (!s->first_field) {
-                    ref_picture = s->current_picture_ptr->f.data;
+                    ref_picture = s->current_picture_ptr->f->data;
                 }
             }
         }
@@ -964,7 +965,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
     }
 }
 
-void ff_MPV_motion(MpegEncContext *s,
+void ff_mpv_motion(MpegEncContext *s,
                    uint8_t *dest_y, uint8_t *dest_cb,
                    uint8_t *dest_cr, int dir,
                    uint8_t **ref_picture,
@@ -973,10 +974,10 @@ void ff_MPV_motion(MpegEncContext *s,
 {
 #if !CONFIG_SMALL
     if (s->out_format == FMT_MPEG1)
-        MPV_motion_internal(s, dest_y, dest_cb, dest_cr, dir,
+        mpv_motion_internal(s, dest_y, dest_cb, dest_cr, dir,
                             ref_picture, pix_op, qpix_op, 1);
     else
 #endif
-        MPV_motion_internal(s, dest_y, dest_cb, dest_cr, dir,
+        mpv_motion_internal(s, dest_y, dest_cb, dest_cr, dir,
                             ref_picture, pix_op, qpix_op, 0);
 }