summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPetri Hintukainen <phintuka@users.sourceforge.net>2014-05-13 15:36:01 +0300
committerPetri Hintukainen <phintuka@users.sourceforge.net>2014-05-13 15:36:01 +0300
commitffb3d85142620eac6062e8b62fec17ed388d750f (patch)
tree5124dad9adab2011b0b16caa2abfcb1137cbeb6d /src
parent4998bbecfc734db37374a12ee8458a5fb33c9ef5 (diff)
parenta50e7b47238338b1abf468d721cd47dcf7e6203a (diff)
downloadxine-lib-ffb3d85142620eac6062e8b62fec17ed388d750f.tar.gz
xine-lib-ffb3d85142620eac6062e8b62fec17ed388d750f.tar.bz2
merge
Diffstat (limited to 'src')
-rw-r--r--src/combined/ffmpeg/ff_video_decoder.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c
index 57d3a2b93..57cda0714 100644
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -406,9 +406,11 @@ static int get_buffer (AVCodecContext *context, AVFrame *av_frame)
#endif /* ENABLE_VAAPI */
/* The alignment rhapsody */
- buf_width += 2 * this->edge + 15;
- buf_width &= ~15;
- buf_height += 2 * this->edge + 15;
+ /* SSE2+ requirement (U, V rows need to be 16 byte aligned too) */
+ buf_width += 2 * this->edge + 31;
+ buf_width &= ~31;
+ /* 2 extra lines for the edge wrap below plus XINE requirement */
+ buf_height += 2 * this->edge + 2 + 15;
buf_height &= ~15;
if ((this->full2mpeg || (this->context->pix_fmt != PIX_FMT_YUV420P &&
@@ -503,12 +505,15 @@ static int get_buffer (AVCodecContext *context, AVFrame *av_frame)
av_frame->linesize[2] = img->pitches[2];
if (this->output_format == XINE_IMGFMT_YV12) {
- av_frame->data[0] += (img->pitches[0] + 1) * this->edge;
- av_frame->data[1] += (img->pitches[1] + 1) * this->edge / 2;
- av_frame->data[2] += (img->pitches[2] + 1) * this->edge / 2;
- img->crop_left = this->edge;
+ /* nasty hack: wrap right edge to the left side when needed to get proper
+ SSE2 alignment on all planes. */
+ int left_edge = (this->edge + 31) & ~31;
+ av_frame->data[0] += img->pitches[0] * this->edge + left_edge;
+ av_frame->data[1] += (img->pitches[1] * this->edge + left_edge) / 2;
+ av_frame->data[2] += (img->pitches[2] * this->edge + left_edge) / 2;
+ img->crop_left = left_edge;
img->crop_top = this->edge;
- img->crop_right = buf_width - width - this->edge;
+ img->crop_right = buf_width - width - left_edge;
img->crop_bottom = buf_height - height - this->edge;
}