aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-18 16:39:23 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-18 16:50:07 +0200
commit9626d0e906f698504efb8652bac143b98d66b088 (patch)
tree6de2011b2373a41383154154ac58650b643f2df4 /libavutil
parente41bf19d2cb0e39e65f67d45a11458751a086d8c (diff)
downloadffmpeg-9626d0e906f698504efb8652bac143b98d66b088.tar.gz
avutil/frame: Try to align width to achive linesize[0] alignment
This results in more alignment for pixel formats that have "odd" pixel sizes like RGB24. It makes access through SIMD easier Works around Issue described in Ticket1031 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/frame.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 24ad0dd224..7584ae3587 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -126,10 +126,14 @@ static int get_video_buffer(AVFrame *frame, int align)
return ret;
if (!frame->linesize[0]) {
- ret = av_image_fill_linesizes(frame->linesize, frame->format,
- frame->width);
- if (ret < 0)
- return ret;
+ for(i=1; i<=align; i+=i) {
+ ret = av_image_fill_linesizes(frame->linesize, frame->format,
+ FFALIGN(frame->width, i));
+ if (ret < 0)
+ return ret;
+ if (!(frame->linesize[0] & (align-1)))
+ break;
+ }
for (i = 0; i < 4 && frame->linesize[i]; i++)
frame->linesize[i] = FFALIGN(frame->linesize[i], align);