summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-09-30 01:07:25 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-09-30 01:07:25 +0000
commit503bc4026d73a2e02f472b166aa068176859e376 (patch)
treef3e20d314a5c59c9cc98b5e25eed12c70ae4129a /libavcodec/utils.c
parent8c07cee91a82212ef2e8bb2300aa5a8cc0a13df0 (diff)
downloadffmpeg-503bc4026d73a2e02f472b166aa068176859e376.tar.gz
Replace second (and wrong) call to avcodec_align_dimensions() by adjusting
stride_align. This is not particularly pretty and I will gladly implement something else if someone has an idea! Originally committed as revision 15466 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 155978744a..66122a5c9f 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -229,6 +229,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
int size[4] = {0};
int tmpsize;
AVPicture picture;
+ int stride_align[4];
avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
@@ -238,12 +239,22 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
w+= EDGE_WIDTH*2;
h+= EDGE_WIDTH*2;
}
- avcodec_align_dimensions(s, &w, &h);
ff_fill_linesize(&picture, s->pix_fmt, w);
- for (i=0; i<4; i++)
- picture.linesize[i] = ALIGN(picture.linesize[i], STRIDE_ALIGN);
+ for (i=0; i<4; i++){
+//STRIDE_ALIGN is 8 for SSE* but this does not work for SVQ1 chroma planes
+//we could change STRIDE_ALIGN to 16 for x86/sse but it would increase the
+//picture size unneccessarily in some cases. The solution here is not
+//pretty and better ideas are welcome!
+#ifdef HAVE_MMX
+ if(s->codec_id == CODEC_ID_SVQ1)
+ stride_align[i]= 16;
+ else
+#endif
+ stride_align[i] = STRIDE_ALIGN;
+ picture.linesize[i] = ALIGN(picture.linesize[i], stride_align[i]);
+ }
tmpsize = ff_fill_pointer(&picture, NULL, s->pix_fmt, h);
@@ -269,7 +280,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
if((s->flags&CODEC_FLAG_EMU_EDGE) || (s->pix_fmt == PIX_FMT_PAL8) || !size[2])
buf->data[i] = buf->base[i];
else
- buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), STRIDE_ALIGN);
+ buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), stride_align[i]);
}
buf->width = s->width;
buf->height = s->height;