After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 767921 - videoscale: artifacts on still video
videoscale: artifacts on still video
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.8.1
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-06-21 19:16 UTC by Ezequiel Garcia
Modified: 2017-12-27 14:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Image with artifacts (11.00 KB, image/jpeg)
2016-06-21 19:17 UTC, Ezequiel Garcia
Details
Image without artifacts (11.02 KB, image/jpeg)
2016-06-21 19:19 UTC, Ezequiel Garcia
Details
I420 scaled image, with Wim's first fix (53.54 KB, image/jpeg)
2016-06-22 19:39 UTC, Ezequiel Garcia
Details
YUY2 scaled image with Wim's first fix (62.02 KB, image/jpeg)
2016-06-22 19:39 UTC, Ezequiel Garcia
Details

Description Ezequiel Garcia 2016-06-21 19:16:11 UTC
It seems that using videoscale to downscale interleaved still video, I420 format, would produce artifacts. The original image does not have any artifacts.

I can reproduce it with this pipeline:

gst-launch-1.0 -v v4l2src norm=NTSC device=/dev/video0 ! videoconvert ! video/x-raw,format=I420,width=720,height=480 ! videoscale ! video/x-raw,width=360,height=240 ! jpegenc ! multifilesink location=bad-%d.jpg

Where as these pipelines produce no-artifacted frames:

gst-launch-1.0 -v v4l2src norm=NTSC device=/dev/video0 ! videoconvert ! deinterlace method=weave ! video/x-raw,format=I420,width=720,height=480 ! videoconvert ! videoscale ! video/x-raw,width=360,height=240 ! jpegenc ! multifilesink location=good-%d.jpg

gst-launch-1.0 -v v4l2src norm=NTSC device=/dev/video0 ! videoconvert ! video/x-raw,format=YUY2,width=720,height=480 ! videoconvert ! videoscale ! video/x-raw,width=360,height=240 ! jpegenc ! multifilesink location=good-%d.jpg
Comment 1 Ezequiel Garcia 2016-06-21 19:17:42 UTC
Created attachment 330157 [details]
Image with artifacts
Comment 2 Ezequiel Garcia 2016-06-21 19:19:01 UTC
Created attachment 330160 [details]
Image without artifacts
Comment 3 Wim Taymans 2016-06-22 14:22:43 UTC
please check if this fixes it:

commit 5e752f4edad15cb090608f45c10161398ba58fee
Author: Wim Taymans <wtaymans@redhat.com>
Date:   Wed Jun 22 16:02:37 2016 +0200

    video-converter: fix interlaced scaling some more
    
    Fix problem with the line cache where it would forget the first line in
    the cache in some cases.
    Keep as much backlog as we have taps. This generally works better and we
    could do even better by calculating the overlap in all taps.
    Allocated enough lines for the line cache.
    Use only half the number of taps for the interlaced lines because we
    only have half the number of lines.
    The pixel shift should be relative to the new output pixel size so scale
    it.
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=767921
Comment 4 Ezequiel Garcia 2016-06-22 19:38:53 UTC
I backported the commit into my 1.8.1 build, and the result is better. However, a pipeline that scales YUY2 frames still produces better results than a pipeline scaling I420.

Pipelines being used to compare:

gst-launch-1.0 -v v4l2src norm=NTSC device=/dev/video0 num-buffers=3 ! videoconvert ! video/x-raw,format=I420,width=720,height=480 ! videoscale ! video/x-raw,width=360,height=240 ! jpegenc quality=100 ! multifilesink location=i420-%d.jpg

gst-launch-1.0 -v v4l2src norm=NTSC device=/dev/video0 num-buffers=3 ! videoconvert ! video/x-raw,format=YUY2,width=720,height=480 ! videoscale ! video/x-raw,width=360,height=240 ! jpegenc quality=100 ! multifilesink location=yuy2-%d.jpg
Comment 5 Ezequiel Garcia 2016-06-22 19:39:29 UTC
Created attachment 330211 [details]
I420 scaled image, with Wim's first fix
Comment 6 Ezequiel Garcia 2016-06-22 19:39:53 UTC
Created attachment 330212 [details]
YUY2 scaled image with Wim's first fix
Comment 7 Ezequiel Garcia 2016-08-05 04:11:26 UTC
Any news about this?

I'm about to give up and hack v4l2src plugin to allow forcing the caps to progressive. So far, progressive frames don't have this artifact (even if there isn't a proper deinterlacing). This makes sense because this issue has nothing to do with deinterlace, given it's present on still images.

If there isn't anything better, this fix should be merged, as it mildly improves the situation.
Comment 8 Ezequiel Garcia 2017-12-27 14:14:34 UTC
Closed for lack of activity. I've added a patch to force caps to progressive.