[FFmpeg-devel] [PATCH 2/3] lavc: add a framework to fix alignment problems.

Paul B Mahol onemda at gmail.com
Wed May 10 23:25:32 EEST 2017


On 5/10/17, Michael Niedermayer <michael at niedermayer.cc> wrote:
> On Wed, May 10, 2017 at 05:49:20PM +0200, Nicolas George wrote:
>> Le primidi 21 floreal, an CCXXV, Michael Niedermayer a ecrit :
>> > breaks (green stuff on edges)
>> >  ./ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -an -vframes 5  -vf uspp=4:8
>> > -qscale 1 -y file.avi
>>
>> It is a bug in vf_uspp:
>>
>> diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c
>> index ef493b860f..6e378253a0 100644
>> --- a/libavfilter/vf_uspp.c
>> +++ b/libavfilter/vf_uspp.c
>> @@ -250,6 +250,9 @@ static void filter(USPPContext *p, uint8_t *dst[3],
>> uint8_t *src[3],
>>          p->frame->data[2] = p->src[2] + x1c  + y1c  *
>> p->frame->linesize[2];
>>          p->frame->format  = p->avctx_enc[i]->pix_fmt;
>>
>> +        av_log(0, 16, "encode %d x %d with %d x %d\n",
>> +               p->frame->width, p->frame->height,
>> +               p->avctx_enc[i]->width, p->avctx_enc[i]->height);
>>          ret = avcodec_encode_video2(p->avctx_enc[i], &pkt, p->frame,
>> &got_pkt_ptr);
>>          if (ret < 0) {
>>              av_log(p->avctx_enc[i], AV_LOG_ERROR, "Encoding failed\n");
>>
>> gives:
>>
>>   Stream #0:1 -> #0:0 (mpeg2video (native) -> mpeg4 (native))
>> encode 720 x 576 with 736 x 592
>> zsh: segmentation fault  ./ffmpeg_g -nostdin -i
>> ~/tmp/samples/matrixbench_mpeg2.mpg -an -vframes 5 -vf
>>
>> vf_uspp is giving a 720 *576 frame to a 736 *592 encoder.
>>
>> I do not know how to fix that.
>
> fixed, and now your patchset seems to cause a 1% slowdown of the
> example above
>
> real    0m2.182s
> user    0m2.129s
> sys     0m0.064s
>
> real    0m2.182s
> user    0m2.131s
> sys     0m0.064s
>
> real    0m2.182s
> user    0m2.124s
> sys     0m0.072s
>
> vs:
> real    0m2.204s
> user    0m2.158s
> sys     0m0.056s
>
> real    0m2.203s
> user    0m2.151s
> sys     0m0.063s
>
> real    0m2.204s
> user    0m2.167s
> sys     0m0.048s

Of course it does. Your example exhibits unaligned behaviour.


More information about the ffmpeg-devel mailing list