-
Notifications
You must be signed in to change notification settings - Fork 8k
drivers: video: ov2640 driver: Enhancing ov2640 driver #95171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
drivers: video: ov2640 driver: Enhancing ov2640 driver #95171
Conversation
Thanks for the contribution! I think it supports arbitrary scaling, so this could be a good fit for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically a copy paste from linux driver with some tweaks
Please notice the ov2640 driver in Linux has no dual-licensing, and GPLv2 must not be copied into Zephyr. There seems to not be a significant code added, so let's wait for another review
P.S. Also please consider the SonarQube warnings
drivers/video/ov2640.c
Outdated
OV2640_VIDEO_FORMAT_CAP(QQVGA_WIDTH, QQVGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* QQVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(QCIF_WIDTH, QCIF_HEIGHT, VIDEO_PIX_FMT_RGB565), /* QCIF */ | ||
OV2640_VIDEO_FORMAT_CAP(CIF_WIDTH, CIF_HEIGHT, VIDEO_PIX_FMT_RGB565), /* CIF */ | ||
OV2640_VIDEO_FORMAT_CAP(VGA_WIDTH, VGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* VGA */ | ||
OV2640_VIDEO_FORMAT_CAP(SVGA_WIDTH, SVGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* SVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(XGA_WIDTH, XGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* XVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(SXGA_WIDTH, SXGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* SXGA */ | ||
OV2640_VIDEO_FORMAT_CAP(UXGA_WIDTH, UXGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* UXGA */ | ||
OV2640_VIDEO_FORMAT_CAP(QQVGA_WIDTH, QQVGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* QQVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(QCIF_WIDTH, QCIF_HEIGHT, VIDEO_PIX_FMT_JPEG), /* QCIF */ | ||
OV2640_VIDEO_FORMAT_CAP(CIF_WIDTH, CIF_HEIGHT, VIDEO_PIX_FMT_JPEG), /* CIF */ | ||
OV2640_VIDEO_FORMAT_CAP(VGA_WIDTH, VGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* VGA */ | ||
OV2640_VIDEO_FORMAT_CAP(SVGA_WIDTH, SVGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* SVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(XGA_WIDTH, XGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* XVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(SXGA_WIDTH, SXGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* SXGA */ | ||
OV2640_VIDEO_FORMAT_CAP(UXGA_WIDTH, UXGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* UXGA */ | ||
{0}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if breaking these out to constants is wanted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be hard to remember what size is UXGA or QCIF, while 1600x1200 or 176x144 is obvious for the reader.
Maybe the goal was avoiding accidental typos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it would make sense to add numeric resolutions to the comments here, so they do not duplicate what's in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was done to match window setting, so if format is meant to be supported - it is known that there is a scaling/windowing setting for it
Thank you
Thank you for your comment |
Honestly, I just wanted to ease the pain for those still working with that type of sensors, it took me some time to figure this out
One more note: there is no possibility (seems to me) of having "any size" user wants, as there are a bunch of prescalers and dividers to be set to downsize properly, not every size fits into that combination |
drivers/video/ov2640.c
Outdated
#define UXGA_HSIZE (1600UL) | ||
#define UXGA_VSIZE (1200UL) | ||
|
||
#define VAL_SET(x, mask, rshift, lshift) ((((x) >> rshift) & mask) << lshift) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this different from FIELD_PREP()
? This would also break the chain from GPL code to Zephyr to modify this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks similar, but in FIELD_PREP() mask must be pre-computed properly, there is no *shift arguments
Thank you for pointing that out, I think in that case I can just plug in FIELD_PREP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no shift argument, but the macros can understand where the mask starts and ends, and shifts the value accordingly.
representing its field position and width [1]
To pre-compute the mask, you can use GENMASK(lsb, msb)
, these two are typically used together and allow to use the value from the datasheet without risk of typo by manual tweaking the masks:
#define THIS_FIELD_SET(x) FIELD_PREP(GENMASK(7, 3), x)
Or even better IMHO, just a plain transcription of the datasheet data without any smart:
#define THIS_FIELD_MASK GENMASK(7, 3)
Then in the code:
{THIS_ADDR, FIELD_PREP(THIS_FIELD_MASK, 323)},
drivers/video/ov2640.c
Outdated
LOG_INF("Selected resolution %s", win->name); | ||
|
||
/* Write DSP input registers */ | ||
ret |= ov2640_write_all(dev, uxga_regs, ARRAY_SIZE(uxga_regs)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For new code, would it be possible to use this even if it breaks the local style? Only if interested in helping with it, and no need to change the other locations.
ret = ov2640_write_all(dev, uxga_regs, ARRAY_SIZE(uxga_regs));
if (ret < 0) {
return ret;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not, let me plug this in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might work to turn |=
into a plain =
, now that you added the if (ret < 0)
check.
Sorry slightly long post to offer more context and offer choices to you as contributor.
I agree the current sensors did not evolve as fast as the API did. They all need to get some spring clean-up to facilitate collaboration.
The datasheet possibly promised it but Currently Zephyr Video APIs are still somewhat documented in Linux documentation for the semantics, there's only basic function API usage in Zephyr. This is expected to change soon. AFAIU, this macro does multiple things, which would ideally be dis-aggregated: {CTRLI, CTRLI_LP_DP | CTRLI_V_DIV_SET(v_div) | CTRLI_H_DIV_SET(h_div)}, // [binning]
{ZMOW, ZMOW_OUTW_SET(x)}, // Vertical [cropping]
{ZMOH, ZMOH_OUTH_SET(y)}, // Horizontal [cropping]
{ZMHH, ZMHH_OUTW_SET(x) | ZMHH_OUTH_SET(y)}, // V/H [scaling]
{R_DVP_SP, pclk_div}, // [link-frequency] That gives us 4 different APIs:
(+) the tiny VPU/ISP inside the image sensor becomes a tool the MCU can make use of For instance transfer a low-res image (strong binning, good for low-noise), run some image detection on it, and transfer a JPEG image cropped to the detection result at max resolution. If interested in trying, feel welcome, glad to help with that. Either way, thank you for your efforts on improving OV2640! Small low-power low-cost image sensors can do a lot with good drivers. :) Any bit help, and your current proposal does not increase maintenance burden. |
Ah, there we go, a WIP pull request showing some way to integrate cropping into an image sensor driver: |
Thank you for your contribution in this PR
I'll follow up on adding proper API later on I have a lot more stuff to commit later on, but just what to handle them one by one |
I confirm that's all. Thank you again! |
drivers/video/ov2640.c
Outdated
{CTRLI, CTRLI_LP_DP | CTRLI_V_DIV_SET(v_div) | CTRLI_H_DIV_SET(h_div)}, \ | ||
{ZMOW, ZMOW_OUTW_SET(x)}, {ZMOH, ZMOH_OUTH_SET(y)}, \ | ||
{ZMHH, ZMHH_OUTW_SET(x) | ZMHH_OUTH_SET(y)}, {R_DVP_SP, pclk_div}, {RESET, 0x00} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The XXXX(x)
macros are only used once, maybe this can be all put inline here:
#define OV2640_SIZE_REGS(x, y, v_div, h_div, pclk_div) \
{CTRLI, \
CTRLI_LP_DP | FIELD_PREP(CTRLI_V_DIV_MASK, v_div) | FIELD_PREP(CTRLI_H_DIV_MASK, h_div)}, \
{ZMOW, FIELD_PREP(ZMOW_OUTW_MASK, x)}, \
{ZMOH, FIELD_PREP(ZMOH_OUTH_MASK, y)}, \
{ZMHH, FIELD_PREP(ZMHH_OUTW_MASK, x) | FIELD_PREP(ZMHH_OUTH_MASK, y)}, \
{R_DVP_SP, pclk_div}, \
{RESET, 0x00}
But that's just some minor thing to try to reduce driver-specific macros, nothing blocking.
445e4b6
to
74e560a
Compare
74e560a
to
3355ed0
Compare
Kindly ask you to review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to do these two changes? This might be an occasion to get familiar with the Zephyr doc on contributing PRs to be all set for subsequent PRs:
- In a PR, introducing something is expected to not be fixed by the next commits, so while it's appreciated that you kept the formatting changes separate, it will need to have the right formatting directly for newly contributed code.
- You might need to put different 1st line for the commits, to avoid confusion of which commit does what. Something very short is ok.
- We might need to keep 240x240 for now, or update the various samples using ESP32, as it is the default
Sorry for the late request for change, this PR did stay quite some time without review.
Thank you for your patience and for helping with image sensor driver maintenance!
drivers/video/ov2640.c
Outdated
LOG_ERR("Couldn't find window size for desired resolution setting"); | ||
return -EINVAL; | ||
} | ||
LOG_INF("Selected resolution %s", win->name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By using %ux%u
here instead of textual name, it becomes possible to save ~60 bytes. Worth considering?
drivers/video/ov2640.c
Outdated
OV2640_VIDEO_FORMAT_CAP(160, 120, VIDEO_PIX_FMT_RGB565), /* QQVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(176, 144, VIDEO_PIX_FMT_RGB565), /* QCIF */ | ||
OV2640_VIDEO_FORMAT_CAP(240, 160, VIDEO_PIX_FMT_RGB565), /* HQVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(240, 240, VIDEO_PIX_FMT_RGB565), /* 240x240 */ | ||
OV2640_VIDEO_FORMAT_CAP(320, 240, VIDEO_PIX_FMT_RGB565), /* QVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(352, 288, VIDEO_PIX_FMT_RGB565), /* CIF */ | ||
OV2640_VIDEO_FORMAT_CAP(640, 480, VIDEO_PIX_FMT_RGB565), /* VGA */ | ||
OV2640_VIDEO_FORMAT_CAP(800, 600, VIDEO_PIX_FMT_RGB565), /* SVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(1024, 768, VIDEO_PIX_FMT_RGB565), /* XVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(1280, 1024, VIDEO_PIX_FMT_RGB565), /* SXGA */ | ||
OV2640_VIDEO_FORMAT_CAP(1600, 1200, VIDEO_PIX_FMT_RGB565), /* UXGA */ | ||
OV2640_VIDEO_FORMAT_CAP(160, 120, VIDEO_PIX_FMT_JPEG), /* QQVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(176, 144, VIDEO_PIX_FMT_JPEG), /* QCIF */ | ||
OV2640_VIDEO_FORMAT_CAP(240, 160, VIDEO_PIX_FMT_JPEG), /* HQVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(320, 240, VIDEO_PIX_FMT_JPEG), /* QVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(352, 288, VIDEO_PIX_FMT_JPEG), /* CIF */ | ||
OV2640_VIDEO_FORMAT_CAP(640, 480, VIDEO_PIX_FMT_JPEG), /* VGA */ | ||
OV2640_VIDEO_FORMAT_CAP(800, 600, VIDEO_PIX_FMT_JPEG), /* SVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(1024, 768, VIDEO_PIX_FMT_JPEG), /* XVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(1280, 1024, VIDEO_PIX_FMT_JPEG), /* SXGA */ | ||
OV2640_VIDEO_FORMAT_CAP(1600, 1200, VIDEO_PIX_FMT_JPEG), /* UXGA */ | ||
OV2640_VIDEO_FORMAT_CAP(QQVGA_WIDTH, QQVGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* 160 x 120 QQVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(QCIF_WIDTH, QCIF_HEIGHT, VIDEO_PIX_FMT_RGB565), /* 176 x 144 QCIF */ | ||
OV2640_VIDEO_FORMAT_CAP(CIF_WIDTH, CIF_HEIGHT, VIDEO_PIX_FMT_RGB565), /* 352 x 288 CIF */ | ||
OV2640_VIDEO_FORMAT_CAP(VGA_WIDTH, VGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* 640 x 480 VGA */ | ||
OV2640_VIDEO_FORMAT_CAP(SVGA_WIDTH, SVGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* 800 x 600 SVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(XGA_WIDTH, XGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* 1024 x 768 XVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(SXGA_WIDTH, SXGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* 1280 x 1024 SXGA */ | ||
OV2640_VIDEO_FORMAT_CAP(UXGA_WIDTH, UXGA_HEIGHT, VIDEO_PIX_FMT_RGB565), /* 1600 x 1200 UXGA */ | ||
OV2640_VIDEO_FORMAT_CAP(QQVGA_WIDTH, QQVGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* 160 x 120 QQVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(QCIF_WIDTH, QCIF_HEIGHT, VIDEO_PIX_FMT_JPEG), /* 176 x 144 QCIF */ | ||
OV2640_VIDEO_FORMAT_CAP(CIF_WIDTH, CIF_HEIGHT, VIDEO_PIX_FMT_JPEG), /* 352 x 288 CIF */ | ||
OV2640_VIDEO_FORMAT_CAP(VGA_WIDTH, VGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* 640 x 480 VGA */ | ||
OV2640_VIDEO_FORMAT_CAP(SVGA_WIDTH, SVGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* 800 x 600 SVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(XGA_WIDTH, XGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* 1024 x 768 XVGA */ | ||
OV2640_VIDEO_FORMAT_CAP(SXGA_WIDTH, SXGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* 1280 x 1024 SXGA */ | ||
OV2640_VIDEO_FORMAT_CAP(UXGA_WIDTH, UXGA_HEIGHT, VIDEO_PIX_FMT_JPEG), /* 1600 x 1200 UXGA */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this removes the 240x240 resolution used by Espressif to showcase their Zephyr camera support via the ESP32-S3 Eye: https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/drivers/video/capture/boards/esp32s3_eye_procpu.conf#L9-L10
CONFIG_VIDEO_FRAME_HEIGHT=240 | |
CONFIG_VIDEO_FRAME_WIDTH=240 |
But maybe that's not a problem if it's for something better.
Is the plan to move all the cropping/windowing support the video_set_selection()
API in a latter PR?
If so, it is tempting to only remove the formats once they can be supported again through a different API.
drivers/video/ov2640.c
Outdated
LOG_INF("Selected resolution %s", win->name); | ||
|
||
/* Write DSP input registers */ | ||
ret |= ov2640_write_all(dev, uxga_regs, ARRAY_SIZE(uxga_regs)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might work to turn |=
into a plain =
, now that you added the if (ret < 0)
check.
247c1ab
to
f836502
Compare
I did my best, and hopefully I satisfied all the requested changes this time 😄 |
drivers/video/ov2640.c
Outdated
static const struct ov2640_win_size ov2640_supported_win_sizes[] = { | ||
OV2640_SIZE(QQVGA_WIDTH, QQVGA_HEIGHT, ov2640_qqvga_regs), | ||
OV2640_SIZE(QCIF_WIDTH, QCIF_HEIGHT, ov2640_qcif_regs), | ||
OV2640_SIZE(240, 240, ov2640_qvga_regs), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to still use the QVGA registers even though the resolution is announced as 240x240.
As a result, the capture sample works with the ESP32 S3 Eye, but instead of looking like this (before):
It looks like this (after):
I first rebased your PR on top of #95958 then ran it with this:
west build -b esp32s3_eye/esp32s3/procpu samples/drivers/video/capture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what the problem is
Let me fix it first and I let you know once this is done
Thank you for going through verification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to add a ov2640_240x240_regs
that crops the width in the meantime that video_set_selection()
is introduced? It helps with getting a working demo of the ESP32 driver.
[EDIT: thanks! I will test again as soon as I get a chance]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed, please take a look
You may need to adjust these prescalers
static const struct ov2640_reg ov2640_240x240_regs[] = {
OV2640_ZOOM_CONFIG(240, 240, 2, 2, 4),
};
2, 2, 4
if that doesn't work, unfortunately I don't have that board so can't check
Thank you!
f836502
to
6b9c86a
Compare
@josuah |
6b9c86a
to
9f8d1ff
Compare
I do not have any comments, I'm not on the video maintainer team and just dropped some general C programming tips. If no reviews follow in a week, feel free to use |
Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased this on top of main
and tested again:
Before: the test circle is not centered even though picture taken in front of the sensor (as you described)
After: the test circle is now an ovale, wrong proportions (limitation where it's not possible to set the offset of the readout insofar
This is a driver/doc/hardware limitation for another.
Though, this is IMHO a big improvement over cropping, in particular for every other format.
More background in a follow-up discussion.
Thanks for the improvements (and for waiting), LGTM!
You will need to rebase on latest main to fix the new |
Thanks, will do rebase |
Enabling proper zoom/scaling for windowed resolutions; e.g. smaller than uxga That makes camera's ISP to downscale frame to a desired resolution Signed-off-by: Roman Pustobaiev <[email protected]>
Apply code formatting to some parts of the ov2640 driver Signed-off-by: Roman Pustobaiev <[email protected]>
9f8d1ff
to
d50b1bf
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. My understanding is that this will pick a resolution in the list in order to apply it to the sensor and that resolution might not be the exact resolution asked by the application
(checking for width >= and height >= instead of width == / height ==).
In such case, upon a set_fmt, the resolution actually applied might be different from the one requested.
This is ok, however the information should be given back to the application in such case by setting back the new resolution into the set_fmt fmt pointer.
#define OV2640_ZOOM_CONFIG(x, y, v_div, h_div, pclk_div) \ | ||
{CTRLI, \ | ||
CTRLI_LP_DP | FIELD_PREP(GENMASK(5, 3), v_div) | FIELD_PREP(GENMASK(2, 0), h_div)}, \ | ||
{ZMOW, FIELD_PREP(GENMASK(7, 0), (x) >> 2)}, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: indentation to fix for this line and below, since currently it makes it hard to easily understand that there is actually 5 registers being set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was mostly the clang format caused this, I'll try to change it
Thank you
{ZMOH, FIELD_PREP(GENMASK(7, 0), (y) >> 2)}, \ | ||
{ZMHH, FIELD_PREP(GENMASK(1, 0), (x) >> (8 + 2)) | \ | ||
FIELD_PREP(GENMASK(2, 2), (y) >> (8 + 2))}, \ | ||
{R_DVP_SP, pclk_div}, {RESET, 0x00} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: maybe keep only 1 register setting per line to make it easier to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That also came from clang-format
drivers/video/ov2640.c
Outdated
} | ||
|
||
static int ov2640_set_resolution(const struct device *dev, | ||
uint16_t img_width, uint16_t img_height) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not modified in this patch but since I noticed it I mention it here)
In several places within the driver, the width / height are uint16_t while in video API (and in some function within this driver), this is uint32_t, so I think this should be fixed.
The first issue is within the set_fmt into which a uint32_t is put into a uint16_t.
Thank you for pointing that out |
I think it should be together with the modification which lead to having the set format not same as the one requested. This lead to having the behavior modified. So I'd go with doing it in the existing commit. |
Enabling proper zoom/scaling for smaller resolutions (e.g. QQVGA)
This is basically a copy paste from linux driver with some tweaks
This patch may need some refactoring/cleaning up, but generally I have verified it function properly
I found that without this patch, if i enable low resolution format (e.g. QVGA/QQVGA) I basically receive cropped image (top left corner) not scaled, so it makes it difficult to receive meaningfull image from camera for further processing