diff options
author | Torsten Jager <t.jager@gmx.de> | 2014-05-13 14:01:45 +0200 |
---|---|---|
committer | Torsten Jager <t.jager@gmx.de> | 2014-05-13 14:01:45 +0200 |
commit | a50e7b47238338b1abf468d721cd47dcf7e6203a (patch) | |
tree | deec2a0411408c4b13cf25824caddeac72e182bb /src | |
parent | 2e5a14ede18c8ccc861783e4cf2fbbcc91e1713c (diff) | |
download | xine-lib-a50e7b47238338b1abf468d721cd47dcf7e6203a.tar.gz xine-lib-a50e7b47238338b1abf468d721cd47dcf7e6203a.tar.bz2 |
Attempt to fix ffmpeg vp9 segfault.
Try not to add a lot of extra padding.
Diffstat (limited to 'src')
-rw-r--r-- | src/combined/ffmpeg/ff_video_decoder.c | 21 |
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; } |