Message ID | 20170310174228.3fe39100@vento.lan (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi! > Argh! that is indeed a bug at libv4l (and maybe at gstreamer). > > I guess that the always_needs_conversion logic was meant to be used to > really odd proprietary formats, e. g: > > /* Vendor-specific formats */ > #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ > #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ > #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ > ... > > I suspect that nobody uses libv4l2 with MC-based V4L2 devices. That's > likely why nobody reported this bug before (that I know of). > > In any case, for non-proprietary formats, the default should be to > always offer both the emulated format and the original one. > > I suspect that the enclosed patch should fix the issue with bayer formats. ... > @@ -178,7 +178,7 @@ struct v4lconvert_data *v4lconvert_create_with_dev_ops(int fd, void *dev_ops_pri > /* This keeps tracks of devices which have only formats for which apps > most likely will need conversion and we can thus safely add software > processing controls without a performance impact. */ > - int always_needs_conversion = 1; > + int always_needs_conversion = 0; > > if (!data) { > fprintf(stderr, "libv4lconvert: error: out of memory!\n"); > @@ -208,8 +208,8 @@ struct v4lconvert_data *v4lconvert_create_with_dev_ops(int fd, void *dev_ops_pri > if (j < ARRAY_SIZE(supported_src_pixfmts)) { > data->supported_src_formats |= 1ULL << j; > v4lconvert_get_framesizes(data, fmt.pixelformat, j); > - if (!supported_src_pixfmts[j].needs_conversion) > - always_needs_conversion = 0; > + if (supported_src_pixfmts[j].needs_conversion) > + always_needs_conversion = 1; > } else > always_needs_conversion = 0; > } Is the else still needed? You changed default to 0... Pavel
diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c index da718918b030..2e5458fa420d 100644 --- a/lib/libv4lconvert/libv4lconvert.c +++ b/lib/libv4lconvert/libv4lconvert.c @@ -118,10 +118,10 @@ static const struct v4lconvert_pixfmt supported_src_pixfmts[] = { { V4L2_PIX_FMT_OV511, 0, 7, 7, 1 }, { V4L2_PIX_FMT_OV518, 0, 7, 7, 1 }, /* uncompressed bayer */ - { V4L2_PIX_FMT_SBGGR8, 8, 8, 8, 1 }, - { V4L2_PIX_FMT_SGBRG8, 8, 8, 8, 1 }, - { V4L2_PIX_FMT_SGRBG8, 8, 8, 8, 1 }, - { V4L2_PIX_FMT_SRGGB8, 8, 8, 8, 1 }, + { V4L2_PIX_FMT_SBGGR8, 8, 8, 8, 0 }, + { V4L2_PIX_FMT_SGBRG8, 8, 8, 8, 0 }, + { V4L2_PIX_FMT_SGRBG8, 8, 8, 8, 0 }, + { V4L2_PIX_FMT_SRGGB8, 8, 8, 8, 0 }, { V4L2_PIX_FMT_STV0680, 8, 8, 8, 1 }, /* compressed bayer */ { V4L2_PIX_FMT_SPCA561, 0, 9, 9, 1 }, @@ -178,7 +178,7 @@ struct v4lconvert_data *v4lconvert_create_with_dev_ops(int fd, void *dev_ops_pri /* This keeps tracks of devices which have only formats for which apps most likely will need conversion and we can thus safely add software processing controls without a performance impact. */ - int always_needs_conversion = 1; + int always_needs_conversion = 0; if (!data) { fprintf(stderr, "libv4lconvert: error: out of memory!\n"); @@ -208,8 +208,8 @@ struct v4lconvert_data *v4lconvert_create_with_dev_ops(int fd, void *dev_ops_pri if (j < ARRAY_SIZE(supported_src_pixfmts)) { data->supported_src_formats |= 1ULL << j; v4lconvert_get_framesizes(data, fmt.pixelformat, j); - if (!supported_src_pixfmts[j].needs_conversion) - always_needs_conversion = 0; + if (supported_src_pixfmts[j].needs_conversion) + always_needs_conversion = 1; } else always_needs_conversion = 0; }