[Ffmpeg-devel] Re: Re: Odd AVFrame.linesize Values when Decoding MPEG2
QuickTime
ffmpeg
Fri Oct 7 02:36:00 CEST 2005
Dear:
> Rich Felker wrote:
>
> > If you enable edge emulation (which also makes decoding faster) then
> > linesize will be equal to width as long as width is a multiple of 16,
> > but you should not rely on this to be the case.
>
> CODEC_FLAG_EMU_EDGE solved the problem. It's not something I would have
> found anywhere. Thanks for the tip.
>
> Paul
>
Well, Never rely on the CODEC_FLAG_EMU_EDGE Flag, It's will put an
overwhelming impact on the whole performance!!!
linesize is only suit for ME/MC with some padding areas
You should use AVCodecContext->width and AVCodecContext->height instead.
e.g:
int yuv2file_filter(AVPicture *pic,int yuv_index,int width,int height)
{
char yuv_file_index_string[32];
char yuv_file_name[64]="e:\\temp\\yuv_";
FILE *fp;
if(!pic)
return -1;
sprintf(yuv_file_index_string,"%d.yuv",yuv_index);
strcat(yuv_file_name,yuv_file_index_string);
fp=fopen(yuv_file_name,"wb");
if(fp)
{
int i,k,shift;
char *yuv_ptr;
for(k=0;k<3;k++)
{
shift = (k==0 ?0:1);
yuv_ptr=pic->data[k];
for(i=0; i<(height>>shift);i++)
{
fwrite(yuv_ptr,(width>>shift),1,fp);
yuv_ptr+=pic->linesize[k];
}
}
fclose(fp);
}
return 0;
}
More information about the ffmpeg-devel
mailing list