[Bug 724521] New: [v4l2] Inconvenient handling of V4L2_FRMSIZE_STEPWISE

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Sun Feb 16 19:14:43 PST 2014


https://bugzilla.gnome.org/show_bug.cgi?id=724521
  GStreamer | gst-plugins-good | git

           Summary: [v4l2] Inconvenient handling of V4L2_FRMSIZE_STEPWISE
    Classification: Platform
           Product: GStreamer
           Version: git
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-good
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: pbludov at altergeo.ru
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


Some v4l2 driver can return the list of frame sizes as follows:

 *   Discrete: A list of discrete sizes.
 *   Step-wise: The width/height is a range with fixed step.
 *   Continuous: This is a special case of the step-wise type above.
     The step_width and step_height values are set to 1.

Most often there is discrete and continuous types. They're both ok.

How implemented the third way? There
   
http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/sys/v4l2/gstv4l2object.c#n2212
it coded as

if (size.type == V4L2_FRMSIZE_TYPE_STEPWISE) {

    for (w = size.stepwise.min_width, h = size.stepwise.min_height;
        w <= size.stepwise.max_width && h <= size.stepwise.max_height;
        w += size.stepwise.step_width, h += size.stepwise.step_height) {

      tmp =
          gst_v4l2_object_probe_caps_for_format_and_size (v4l2object,
          pixelformat, w, h, template);

      if (tmp)
        results = g_list_prepend (results, tmp);

    }
  }

What is wrong with it? Let's see all cases:
$grep -n -A 10 -B 10 -r '--include=*.c' V4L2_FRMSIZE_TYPE_STEPWISE

drivers/media/platform/vivi.c-51    #define MAX_WIDTH 1920
drivers/media/platform/vivi.c-52    #define MAX_HEIGHT 1200    
drivers/media/platform/vivi.c-1048    static const struct v4l2_frmsize_stepwise
sizes = {
drivers/media/platform/vivi.c-1049        48, MAX_WIDTH, 4,
drivers/media/platform/vivi.c-1050        32, MAX_HEIGHT, 1
drivers/media/platform/vivi.c-1051    };
drivers/media/platform/vivi.c:1061    fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
drivers/media/platform/vivi.c-1062    fsize->stepwise = sizes;

We have 469 frame sizes from 48x32 till 1920x500

drivers/media/usb/em28xx/em28xx-video.c-1477    /* Report a continuous range */
drivers/media/usb/em28xx/em28xx-video.c:1478    fsize->type =
V4L2_FRMSIZE_TYPE_STEPWISE;
drivers/media/usb/em28xx/em28xx-video.c-1479    scale_to_size(dev,
EM28XX_HVSCALE_MAX, EM28XX_HVSCALE_MAX,
drivers/media/usb/em28xx/em28xx-video.c-1480             
&fsize->stepwise.min_width, &fsize->stepwise.min_height);
drivers/media/usb/em28xx/em28xx-video.c-1481    if (fsize->stepwise.min_width <
48)
drivers/media/usb/em28xx/em28xx-video.c-1482        fsize->stepwise.min_width =
48;
drivers/media/usb/em28xx/em28xx-video.c-1483    if (fsize->stepwise.min_height
< 38)
drivers/media/usb/em28xx/em28xx-video.c-1484        fsize->stepwise.min_height
= 38;
drivers/media/usb/em28xx/em28xx-video.c-1485    fsize->stepwise.max_width =
maxw;
drivers/media/usb/em28xx/em28xx-video.c-1486    fsize->stepwise.max_height =
maxh;
drivers/media/usb/em28xx/em28xx-video.c-1487    fsize->stepwise.step_width = 1;
drivers/media/usb/em28xx/em28xx-video.c-1488    fsize->stepwise.step_height =
1;

We have 539 frame sizes from 48x38 till 586x576 

drivers/media/usb/sn9c102/sn9c102_core.c:2495    frmsize.type =
V4L2_FRMSIZE_TYPE_STEPWISE;
drivers/media/usb/sn9c102/sn9c102_core.c-2496    frmsize.stepwise.min_width =
frmsize.stepwise.step_width = 16;
drivers/media/usb/sn9c102/sn9c102_core.c-2497    frmsize.stepwise.min_height =
frmsize.stepwise.step_height = 16;
drivers/media/usb/sn9c102/sn9c102_core.c-2498    frmsize.stepwise.max_width =
cam->sensor.cropcap.bounds.width;
drivers/media/usb/sn9c102/sn9c102_core.c-2499    frmsize.stepwise.max_height =
cam->sensor.cropcap.bounds.height;
drivers/media/usb/sn9c102/sn9c102_core.c-2500    memset(&frmsize.reserved, 0,
sizeof(frmsize.reserved));

We have 30 frame sizes from 16x16 till 480x480 

drivers/media/usb/gspca/stk1135.c:636    fsize->type =
V4L2_FRMSIZE_TYPE_STEPWISE;
drivers/media/usb/gspca/stk1135.c-637    fsize->stepwise.min_width = 32;
drivers/media/usb/gspca/stk1135.c-638    fsize->stepwise.min_height = 32;
drivers/media/usb/gspca/stk1135.c-639    fsize->stepwise.max_width = 1280;
drivers/media/usb/gspca/stk1135.c-640    fsize->stepwise.max_height = 1024;
drivers/media/usb/gspca/stk1135.c-641    fsize->stepwise.step_width = 2;
drivers/media/usb/gspca/stk1135.c-642    fsize->stepwise.step_height = 2;

We have 497 frame sizes from 32x32 till 1024x1024

Do you see? All of them are limited to square sizes, except the vivi,
which is even worse.
I think the best way is to handle V4L2_FRMSIZE_TYPE_STEPWISE in the same
way as V4L2_FRMSIZE_TYPE_CONTINUOUS and ignore the step.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list