Fix alpha plane flipping for the yuva420p and similar pixel formats.

Originally committed as revision 20771 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Stefano Sabatini 2009-12-08 17:08:49 +00:00
parent e185a2f649
commit e87eb039cc

View File

@ -48,11 +48,11 @@ static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
AVFilterPicRef *picref = avfilter_get_video_buffer(link->dst->outputs[0], AVFilterPicRef *picref = avfilter_get_video_buffer(link->dst->outputs[0],
perms, w, h); perms, w, h);
picref->data[0] += (h-1) * picref->linesize[0]; for (i = 0; i < 4; i ++) {
picref->linesize[0] = -picref->linesize[0]; int vsub = i == 1 || i == 2 ? flip->vsub : 0;
for (i = 1; i < 4; i ++) {
if (picref->data[i]) { if (picref->data[i]) {
picref->data[i] += ((h >> flip->vsub)-1) * picref->linesize[i]; picref->data[i] += ((h >> vsub)-1) * picref->linesize[i];
picref->linesize[i] = -picref->linesize[i]; picref->linesize[i] = -picref->linesize[i];
} }
} }
@ -66,11 +66,11 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
AVFilterPicRef *ref2 = avfilter_ref_pic(picref, ~0); AVFilterPicRef *ref2 = avfilter_ref_pic(picref, ~0);
int i; int i;
ref2->data[0] += (link->h-1) * ref2->linesize[0]; for (i = 0; i < 4; i ++) {
ref2->linesize[0] = -ref2->linesize[0]; int vsub = i == 1 || i == 2 ? flip->vsub : 0;
for (i = 1; i < 4; i ++) {
if (ref2->data[i]) { if (ref2->data[i]) {
ref2->data[i] += ((link->h >> flip->vsub)-1) * ref2->linesize[i]; ref2->data[i] += ((link->h >> vsub)-1) * ref2->linesize[i];
ref2->linesize[i] = -ref2->linesize[i]; ref2->linesize[i] = -ref2->linesize[i];
} }
} }