changeset 5199:0af35881395e libavcodec

use properly AVFrame.linesize patch by Vitor: [vitor1001 gmail com]
author benoit
date Mon, 02 Jul 2007 10:21:41 +0000
parents 579c01dbb5a1
children be79f0a00c10
files roqvideo.c roqvideodec.c
diffstat 2 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/roqvideo.c	Mon Jul 02 10:20:12 2007 +0000
+++ b/roqvideo.c	Mon Jul 02 10:21:41 2007 +0000
@@ -43,7 +43,7 @@
     unsigned char *bptr;
     int boffs,stride;
 
-    stride = ri->y_stride;
+    stride = ri->current_frame->linesize[0];
     boffs = (y * stride) + x;
 
     bptr = ri->current_frame->data[0] + boffs;
@@ -52,7 +52,9 @@
     bptr[stride  ] = cell->y[2];
     bptr[stride+1] = cell->y[3];
 
-    stride = ri->c_stride;
+    stride = ri->current_frame->linesize[1];
+    boffs = y*stride + x;
+
     bptr = ri->current_frame->data[1] + boffs;
     bptr[0       ] =
     bptr[1       ] =
@@ -71,7 +73,7 @@
     unsigned char *bptr;
     int boffs,stride;
 
-    stride = ri->y_stride;
+    stride = ri->current_frame->linesize[0];
     boffs = (y * stride) + x;
 
     bptr = ri->current_frame->data[0] + boffs;
@@ -80,7 +82,9 @@
     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->c_stride;
+    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] =
@@ -112,12 +116,12 @@
     }
 
     for(cp = 0; cp < 3; cp++) {
-        int stride = ri->current_frame->linesize[cp];
-        block_copy(ri->current_frame->data[cp] + (y*stride) + x,
-                   ri->last_frame->data[cp] + (my*stride) + mx,
-                   stride, stride, sz);
+        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);
     }
-
 }
 
 
--- a/roqvideodec.c	Mon Jul 02 10:20:12 2007 +0000
+++ b/roqvideodec.c	Mon Jul 02 10:21:41 2007 +0000
@@ -180,8 +180,6 @@
         av_log(avctx, AV_LOG_ERROR, "  RoQ: get_buffer() failed\n");
         return -1;
     }
-    s->y_stride = s->current_frame->linesize[0];
-    s->c_stride = s->current_frame->linesize[1];
 
     s->buf = buf;
     s->size = buf_size;