Opened 20 months ago

Closed 18 months ago

Last modified 18 months ago

#9873 closed defect (fixed)

line stride does not appear to always match width in frei0r

Reported by: Brendan Hack Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: frei0r
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I am trying to run a frei0r filter that transforms pixels around the frame (rather than just changing their colour) and on certain frame resolutions I get garbage output. It looks like the provided frame has a stride that does not match the frame width like frei0r requires. This is a regression as this functionality works for all resolutions in ffmpeg 5.0.1.

Test data is an image of resolution 1800x1200 (test.jpg) and the same image at 400x266 (test-400.jpg).

The bug was introduced in commit 17a59a634c39b00a680c6ebbaea58db95594d13d and affected all resolutions. I am testing using the simple flippo frei0r plugin that just flips the image horizontally or vertically. In these tests I flip horizontally.

Checkout to commit 17a59a634c39b00a680c6ebbaea58db95594d13d and test as follows:

$ ffmpeg -i test.jpg -filter frei0r=flippo:y -y test-ff-flip-g17a59a634c.jpg
$ ffmpeg -i test-400.jpg -filter frei0r=flippo:y -y test-ff-flip-400-g17a59a634c.jpg

Both of these images come out corrupted.

Commit d353909e773ba8a8201fa13d6c35251351dd567a purports to fix this by copying to a frei0r compliant frame however this only fixes the problem for the 400 width image. The 1800 is still corrupt.

Checkout to commit d353909e773ba8a8201fa13d6c35251351dd567a and test as follows:

$ ffmpeg -i test.jpg -filter frei0r=flippo:y -y test-ff-flip-gd353909e77.jpg
$ ffmpeg -i test-400.jpg -filter frei0r=flippo:y -y test-ff-flip-400-gd353909e77.jpg

Here the 400 image is good but not the 1800.

The same tests run in the current master c469c3c3b18fbacd6ee0165573034d2a0408b83f produce the same results.

Checkout to commit c469c3c3b18fbacd6ee0165573034d2a0408b83f and test as follows:

$ ffmpeg -i test.jpg -filter frei0r=flippo:y -y test-ff-flip-HEAD.jpg
$ ffmpeg -i test-400.jpg -filter frei0r=flippo:y -y test-ff-flip-400-HEAD.jpg

Here the 400 image is good but not the 1800.

$ ffmpeg -v 9 -loglevel 99 -i test.png
ffmpeg version N-107787-gc469c3c3b1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/home/bendy/.local --arch=amd64 --enable-gpl --disable-stripping --enable-frei0r --enable-shared
  libavutil      57. 33.101 / 57. 33.101
  libavcodec     59. 42.101 / 59. 42.101
  libavformat    59. 30.100 / 59. 30.100
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 46.103 /  8. 46.103
  libswscale      6.  8.102 /  6.  8.102
  libswresample   4.  8.100 /  4.  8.100
  libpostproc    56.  7.100 / 56.  7.100
Input #0, image2, from 'test.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 162876 kb/s
  Stream #0:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 1800x1200 [SAR 1:1 DAR 3:2], 25 fps, 25 tbr, 25 tbn
At least one output file must be specified

Attachments (9)

test.jpg (795.3 KB ) - added by Brendan Hack 20 months ago.
test-400.jpg (45.6 KB ) - added by Brendan Hack 20 months ago.
test-ff-flip-g17a59a634c.jpg (550.3 KB ) - added by Brendan Hack 20 months ago.
test-ff-flip-gd353909e77.jpg (439.0 KB ) - added by Brendan Hack 20 months ago.
test-ff-flip-HEAD.jpg (439.0 KB ) - added by Brendan Hack 20 months ago.
test-ff-flip-400-g17a59a634c.jpg (50.6 KB ) - added by Brendan Hack 20 months ago.
test-ff-flip-400-HEAD.jpg (28.0 KB ) - added by Brendan Hack 20 months ago.
test-ff-flip-400-gd353909e77.jpg (28.0 KB ) - added by Brendan Hack 20 months ago.
ffmpeg-20220814-184032.log (36.5 KB ) - added by Brendan Hack 20 months ago.

Change History (11)

by Brendan Hack, 20 months ago

Attachment: test.jpg added

by Brendan Hack, 20 months ago

Attachment: test-400.jpg added

by Brendan Hack, 20 months ago

by Brendan Hack, 20 months ago

by Brendan Hack, 20 months ago

Attachment: test-ff-flip-HEAD.jpg added

by Brendan Hack, 20 months ago

by Brendan Hack, 20 months ago

Attachment: test-ff-flip-400-HEAD.jpg added

by Brendan Hack, 20 months ago

by Brendan Hack, 20 months ago

Attachment: ffmpeg-20220814-184032.log added

comment:1 by Elon Musk, 18 months ago

Resolution: fixed
Status: newclosed

comment:2 by Carl Eugen Hoyos, 18 months ago

Keywords: frei0r added
Note: See TracTickets for help on using tickets.