Re: [PATCH v4 14/36] [media] v4l2-mc: add a function to inherit controls from a pipeline

From: Pavel Machek
Date: Fri Mar 10 2017 - 16:55:36 EST


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
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature