comparison roqvideo.c @ 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 3bfa0f33c854
children 07005ff96430
comparison
equal deleted inserted replaced
5198:579c01dbb5a1 5199:0af35881395e
41 void ff_apply_vector_2x2(RoqContext *ri, int x, int y, roq_cell *cell) 41 void ff_apply_vector_2x2(RoqContext *ri, int x, int y, roq_cell *cell)
42 { 42 {
43 unsigned char *bptr; 43 unsigned char *bptr;
44 int boffs,stride; 44 int boffs,stride;
45 45
46 stride = ri->y_stride; 46 stride = ri->current_frame->linesize[0];
47 boffs = (y * stride) + x; 47 boffs = (y * stride) + x;
48 48
49 bptr = ri->current_frame->data[0] + boffs; 49 bptr = ri->current_frame->data[0] + boffs;
50 bptr[0 ] = cell->y[0]; 50 bptr[0 ] = cell->y[0];
51 bptr[1 ] = cell->y[1]; 51 bptr[1 ] = cell->y[1];
52 bptr[stride ] = cell->y[2]; 52 bptr[stride ] = cell->y[2];
53 bptr[stride+1] = cell->y[3]; 53 bptr[stride+1] = cell->y[3];
54 54
55 stride = ri->c_stride; 55 stride = ri->current_frame->linesize[1];
56 boffs = y*stride + x;
57
56 bptr = ri->current_frame->data[1] + boffs; 58 bptr = ri->current_frame->data[1] + boffs;
57 bptr[0 ] = 59 bptr[0 ] =
58 bptr[1 ] = 60 bptr[1 ] =
59 bptr[stride ] = 61 bptr[stride ] =
60 bptr[stride+1] = cell->u; 62 bptr[stride+1] = cell->u;
69 void ff_apply_vector_4x4(RoqContext *ri, int x, int y, roq_cell *cell) 71 void ff_apply_vector_4x4(RoqContext *ri, int x, int y, roq_cell *cell)
70 { 72 {
71 unsigned char *bptr; 73 unsigned char *bptr;
72 int boffs,stride; 74 int boffs,stride;
73 75
74 stride = ri->y_stride; 76 stride = ri->current_frame->linesize[0];
75 boffs = (y * stride) + x; 77 boffs = (y * stride) + x;
76 78
77 bptr = ri->current_frame->data[0] + boffs; 79 bptr = ri->current_frame->data[0] + boffs;
78 bptr[ 0] = bptr[ 1] = bptr[stride ] = bptr[stride +1] = cell->y[0]; 80 bptr[ 0] = bptr[ 1] = bptr[stride ] = bptr[stride +1] = cell->y[0];
79 bptr[ 2] = bptr[ 3] = bptr[stride +2] = bptr[stride +3] = cell->y[1]; 81 bptr[ 2] = bptr[ 3] = bptr[stride +2] = bptr[stride +3] = cell->y[1];
80 bptr[stride*2 ] = bptr[stride*2+1] = bptr[stride*3 ] = bptr[stride*3+1] = cell->y[2]; 82 bptr[stride*2 ] = bptr[stride*2+1] = bptr[stride*3 ] = bptr[stride*3+1] = cell->y[2];
81 bptr[stride*2+2] = bptr[stride*2+3] = bptr[stride*3+2] = bptr[stride*3+3] = cell->y[3]; 83 bptr[stride*2+2] = bptr[stride*2+3] = bptr[stride*3+2] = bptr[stride*3+3] = cell->y[3];
82 84
83 stride = ri->c_stride; 85 stride = ri->current_frame->linesize[1];
86 boffs = y*stride + x;
87
84 bptr = ri->current_frame->data[1] + boffs; 88 bptr = ri->current_frame->data[1] + boffs;
85 bptr[ 0] = bptr[ 1] = bptr[stride ] = bptr[stride +1] = 89 bptr[ 0] = bptr[ 1] = bptr[stride ] = bptr[stride +1] =
86 bptr[ 2] = bptr[ 3] = bptr[stride +2] = bptr[stride +3] = 90 bptr[ 2] = bptr[ 3] = bptr[stride +2] = bptr[stride +3] =
87 bptr[stride*2 ] = bptr[stride*2+1] = bptr[stride*3 ] = bptr[stride*3+1] = 91 bptr[stride*2 ] = bptr[stride*2+1] = bptr[stride*3 ] = bptr[stride*3+1] =
88 bptr[stride*2+2] = bptr[stride*2+3] = bptr[stride*3+2] = bptr[stride*3+3] = cell->u; 92 bptr[stride*2+2] = bptr[stride*2+3] = bptr[stride*3+2] = bptr[stride*3+3] = cell->u;
110 mx, my, ri->width, ri->height); 114 mx, my, ri->width, ri->height);
111 return; 115 return;
112 } 116 }
113 117
114 for(cp = 0; cp < 3; cp++) { 118 for(cp = 0; cp < 3; cp++) {
115 int stride = ri->current_frame->linesize[cp]; 119 int outstride = ri->current_frame->linesize[cp];
116 block_copy(ri->current_frame->data[cp] + (y*stride) + x, 120 int instride = ri->last_frame ->linesize[cp];
117 ri->last_frame->data[cp] + (my*stride) + mx, 121 block_copy(ri->current_frame->data[cp] + (y*outstride) + x,
118 stride, stride, sz); 122 ri->last_frame->data[cp] + (my*instride) + mx,
123 outstride, instride, sz);
119 } 124 }
120
121 } 125 }
122 126
123 127
124 void ff_apply_motion_4x4(RoqContext *ri, int x, int y, 128 void ff_apply_motion_4x4(RoqContext *ri, int x, int y,
125 int deltax, int deltay) 129 int deltax, int deltay)