Commit 48c1768b authored by michael's avatar michael

Replace second (and wrong) call to avcodec_align_dimensions() by adjusting stride_align.

This is not particularely pretty and ill gladly implement something else if someone
has an idea!


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15466 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 9781b853
...@@ -229,6 +229,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ ...@@ -229,6 +229,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
int size[4] = {0}; int size[4] = {0};
int tmpsize; int tmpsize;
AVPicture picture; AVPicture picture;
int stride_align[4];
avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); 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){ ...@@ -238,12 +239,22 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
w+= EDGE_WIDTH*2; w+= EDGE_WIDTH*2;
h+= EDGE_WIDTH*2; h+= EDGE_WIDTH*2;
} }
avcodec_align_dimensions(s, &w, &h);
ff_fill_linesize(&picture, s->pix_fmt, w); ff_fill_linesize(&picture, s->pix_fmt, w);
for (i=0; i<4; i++) for (i=0; i<4; i++){
picture.linesize[i] = ALIGN(picture.linesize[i], STRIDE_ALIGN); //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); tmpsize = ff_fill_pointer(&picture, NULL, s->pix_fmt, h);
...@@ -269,7 +280,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ ...@@ -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]) if((s->flags&CODEC_FLAG_EMU_EDGE) || (s->pix_fmt == PIX_FMT_PAL8) || !size[2])
buf->data[i] = buf->base[i]; buf->data[i] = buf->base[i];
else 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->width = s->width;
buf->height = s->height; buf->height = s->height;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment