Mercurial > mplayer.hg
comparison libmpcodecs/vf_ass.c @ 21154:1ac5087585f6
Fix incorrect stride used in vf_ass.
author | eugeni |
---|---|
date | Wed, 22 Nov 2006 17:00:03 +0000 |
parents | 6ae01628975f |
children | 8174acbf0633 |
comparison
equal
deleted
inserted
replaced
21153:13b80aa9ca91 | 21154:1ac5087585f6 |
---|---|
216 first_row -= (first_row % 2); | 216 first_row -= (first_row % 2); |
217 last_row += (last_row % 2); | 217 last_row += (last_row % 2); |
218 chroma_rows = (last_row - first_row) / 2; | 218 chroma_rows = (last_row - first_row) / 2; |
219 | 219 |
220 for (pl = 1; pl < 3; ++pl) { | 220 for (pl = 1; pl < 3; ++pl) { |
221 int dst_stride = vf->dmpi->stride[pl] * 2; | 221 int dst_stride = vf->priv->outw; |
222 int src_stride = vf->dmpi->stride[pl]; | 222 int src_stride = vf->dmpi->stride[pl]; |
223 | 223 |
224 unsigned char* src = vf->dmpi->planes[pl] + (first_row/2) * src_stride; | 224 unsigned char* src = vf->dmpi->planes[pl] + (first_row/2) * src_stride; |
225 unsigned char* dst = vf->priv->planes[pl] + first_row * dst_stride; | 225 unsigned char* dst = vf->priv->planes[pl] + first_row * dst_stride; |
226 unsigned char* dst_next = dst + dst_stride; | 226 unsigned char* dst_next = dst + dst_stride; |
252 { | 252 { |
253 int pl; | 253 int pl; |
254 int i, j, k; | 254 int i, j, k; |
255 for (pl = 1; pl < 3; ++pl) { | 255 for (pl = 1; pl < 3; ++pl) { |
256 int dst_stride = vf->dmpi->stride[pl]; | 256 int dst_stride = vf->dmpi->stride[pl]; |
257 int src_stride = vf->dmpi->stride[pl] * 2; | 257 int src_stride = vf->priv->outw; |
258 | 258 |
259 unsigned char* dst = vf->dmpi->planes[pl]; | 259 unsigned char* dst = vf->dmpi->planes[pl]; |
260 unsigned char* src = vf->priv->planes[pl]; | 260 unsigned char* src = vf->priv->planes[pl]; |
261 unsigned char* src_next = vf->priv->planes[pl] + src_stride; | 261 unsigned char* src_next = vf->priv->planes[pl] + src_stride; |
262 for(i = 0; i < vf->dmpi->chroma_height; ++i) | 262 for(i = 0; i < vf->dmpi->chroma_height; ++i) |
289 int i, j; | 289 int i, j; |
290 mp_image_t* dmpi = vf->dmpi; | 290 mp_image_t* dmpi = vf->dmpi; |
291 | 291 |
292 src = bitmap; | 292 src = bitmap; |
293 dsty = dmpi->planes[0] + dst_x + dst_y * dmpi->stride[0]; | 293 dsty = dmpi->planes[0] + dst_x + dst_y * dmpi->stride[0]; |
294 dstu = vf->priv->planes[1] + dst_x + dst_y * 2 * dmpi->chroma_width; | 294 dstu = vf->priv->planes[1] + dst_x + dst_y * vf->priv->outw; |
295 dstv = vf->priv->planes[2] + dst_x + dst_y * 2 * dmpi->chroma_width; | 295 dstv = vf->priv->planes[2] + dst_x + dst_y * vf->priv->outw; |
296 for (i = 0; i < bitmap_h; ++i) { | 296 for (i = 0; i < bitmap_h; ++i) { |
297 for (j = 0; j < bitmap_w; ++j) { | 297 for (j = 0; j < bitmap_w; ++j) { |
298 unsigned k = ((unsigned)src[j]) * opacity / 255; | 298 unsigned k = ((unsigned)src[j]) * opacity / 255; |
299 dsty[j] = (k*y + (255-k)*dsty[j]) / 255; | 299 dsty[j] = (k*y + (255-k)*dsty[j]) / 255; |
300 dstu[j] = (k*u + (255-k)*dstu[j]) / 255; | 300 dstu[j] = (k*u + (255-k)*dstu[j]) / 255; |
301 dstv[j] = (k*v + (255-k)*dstv[j]) / 255; | 301 dstv[j] = (k*v + (255-k)*dstv[j]) / 255; |
302 } | 302 } |
303 src += stride; | 303 src += stride; |
304 dsty += dmpi->stride[0]; | 304 dsty += dmpi->stride[0]; |
305 dstu += 2 * dmpi->chroma_width; | 305 dstu += vf->priv->outw; |
306 dstv += 2 * dmpi->chroma_width; | 306 dstv += vf->priv->outw; |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 static int render_frame(struct vf_instance_s* vf, mp_image_t *mpi, const ass_image_t* img) | 310 static int render_frame(struct vf_instance_s* vf, mp_image_t *mpi, const ass_image_t* img) |
311 { | 311 { |