[FFmpeg-devel] [PATCH] ffplay: fix odd YUV width

Marton Balint cus at passwd.hu
Sun Aug 26 11:10:58 CEST 2012



On Fri, 24 Aug 2012, Michael Niedermayer wrote:

> On Fri, Aug 24, 2012 at 01:05:29PM +0200, Marton Balint wrote:
>> Should fix issue #1322.
>>
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>>  ffplay.c |   12 ++++++++++--
>>  1 files changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/ffplay.c b/ffplay.c
>> index f81bd7c..f996b68 100644
>> --- a/ffplay.c
>> +++ b/ffplay.c
>> @@ -1586,7 +1586,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
>>      char buffersrc_args[256];
>>      int ret;
>>      AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
>> -    AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format;
>> +    AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format, *filt_scale;
>>      AVCodecContext *codec = is->video_st->codec;
>>
>>      snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags);
>> @@ -1612,14 +1612,22 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
>>      if (ret < 0)
>>          return ret;
>>
>> +    /* SDL YUV code is not handling odd width/height for some driver
>> +     * combinations, therefore we upscale the picture to an even width/height. */
>> +    if ((ret = avfilter_graph_create_filter(&filt_scale,
>> +                                            avfilter_get_by_name("scale"),
>> +                                            "ffplay_scale", "ceil(in_w/2)*2:ceil(in_h/2)*2", NULL, graph)) < 0)
>> +        return ret;
>
> maybe padding or croping 1 line/column would be better than scaling
> due to speed and possible quality issues, especially interlaced
> material could suffer from vertical scaling

True, I will send an updated patch soon.

Regards,
Marton


More information about the ffmpeg-devel mailing list