]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/roqvideo.c
tablegen: the executable depends on tablegen headers as well
[ffmpeg] / libavcodec / roqvideo.c
index 036e2e0d28cbcf139fe0ef7ea7f81665ea58f545..830eb7b329a398df915564d8d4a326dcc7c6f602 100644 (file)
@@ -20,8 +20,8 @@
  */
 
 /**
- * @file roqvideo.c
- * Id RoQ Video common functions based on work by Dr. Tim Ferguson
+ * @file
+ * id RoQ Video common functions based on work by Dr. Tim Ferguson
  */
 
 #include "avcodec.h"
@@ -43,8 +43,8 @@ void ff_apply_vector_2x2(RoqContext *ri, int x, int y, roq_cell *cell)
     unsigned char *bptr;
     int boffs,stride;
 
-    stride = ri->y_stride;
-    boffs = (y * stride) + x;
+    stride = ri->current_frame->linesize[0];
+    boffs = y*stride + x;
 
     bptr = ri->current_frame->data[0] + boffs;
     bptr[0       ] = cell->y[0];
@@ -52,6 +52,9 @@ void ff_apply_vector_2x2(RoqContext *ri, int x, int y, roq_cell *cell)
     bptr[stride  ] = cell->y[2];
     bptr[stride+1] = cell->y[3];
 
+    stride = ri->current_frame->linesize[1];
+    boffs = y*stride + x;
+
     bptr = ri->current_frame->data[1] + boffs;
     bptr[0       ] =
     bptr[1       ] =
@@ -70,8 +73,8 @@ void ff_apply_vector_4x4(RoqContext *ri, int x, int y, roq_cell *cell)
     unsigned char *bptr;
     int boffs,stride;
 
-    stride = ri->y_stride;
-    boffs = (y * stride) + x;
+    stride = ri->current_frame->linesize[0];
+    boffs = y*stride + x;
 
     bptr = ri->current_frame->data[0] + boffs;
     bptr[         0] = bptr[         1] = bptr[stride    ] = bptr[stride  +1] = cell->y[0];
@@ -79,6 +82,9 @@ void ff_apply_vector_4x4(RoqContext *ri, int x, int y, roq_cell *cell)
     bptr[stride*2  ] = bptr[stride*2+1] = bptr[stride*3  ] = bptr[stride*3+1] = cell->y[2];
     bptr[stride*2+2] = bptr[stride*2+3] = bptr[stride*3+2] = bptr[stride*3+3] = cell->y[3];
 
+    stride = ri->current_frame->linesize[1];
+    boffs = y*stride + x;
+
     bptr = ri->current_frame->data[1] + boffs;
     bptr[         0] = bptr[         1] = bptr[stride    ] = bptr[stride  +1] =
     bptr[         2] = bptr[         3] = bptr[stride  +2] = bptr[stride  +3] =
@@ -109,10 +115,13 @@ static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax
         return;
     }
 
-    for(cp = 0; cp < 3; cp++)
-        block_copy(ri->current_frame->data[cp] + (y * ri->y_stride) + x,
-                   ri->last_frame->data[cp] + (my * ri->y_stride) + mx,
-                   ri->y_stride, ri->y_stride, sz);
+    for(cp = 0; cp < 3; cp++) {
+        int outstride = ri->current_frame->linesize[cp];
+        int instride  = ri->last_frame   ->linesize[cp];
+        block_copy(ri->current_frame->data[cp] + y*outstride + x,
+                   ri->last_frame->data[cp] + my*instride + mx,
+                   outstride, instride, sz);
+    }
 }