Re: [PATCH v4 23/32] media: ov2680: Implement selection support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 2, 2023 at 8:31 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>
> Implement selection support. Modelled after ov5693 selection support,
> but allow setting sizes smaller than crop-size through set_fmt() since
> that was already allowed.

...

>  struct ov2680_mode {
> +       struct v4l2_rect                crop;
>         struct v4l2_mbus_framefmt       fmt;
>         struct v4l2_fract               frame_interval;
>         bool                            binning;

>  };

It might be useful to run pahole to check if you can make it shorter
and for how many bytes.

...

> -       width = min_t(unsigned int, ALIGN(format->format.width, 2),
> -                     OV2680_NATIVE_WIDTH);
> -       height = min_t(unsigned int, ALIGN(format->format.height, 2),
> -                      OV2680_NATIVE_HEIGHT);

Ah, short-live min_t(), but still...

...

> +       /* Make sure the crop rectangle isn't outside the bounds of the array */
> +       rect.width = min_t(unsigned int, rect.width,
> +                          OV2680_NATIVE_WIDTH - rect.left);
> +       rect.height = min_t(unsigned int, rect.height,
> +                           OV2680_NATIVE_HEIGHT - rect.top);

And here?

-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux