Message ID | 20200902130846.55910-5-jacopo@jmondi.org |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Jacopo, On 02/09/2020 14:08, Jacopo Mondi wrote: > We assumed HAL_PIXEL_FORMAT_BLOB is always mapped to libcamera::MJPEG > and at the moment this is true. To protect against future changes in the > mapping, inspect the Android format instead of the libcamera one. > I think I recall choosing to compare against the libcamera pixel format "libcamera::MJPEG" as I believed it was more readable/expressive than 'HAL_PIXEL_FORMAT_BLOB' which means JPEG without saying 'j p e g'. Again, no actual fault in this patch, just it's directly different to what I think was an active decision I had made previously. > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > src/android/camera_device.cpp | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > index 01f4b3a45566..a917404016e7 100644 > --- a/src/android/camera_device.cpp > +++ b/src/android/camera_device.cpp > @@ -1216,7 +1216,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) > stream->priv = static_cast<void *>(&streams_[i]); > > /* Defer handling of MJPEG streams until all others are known. */ > - if (format == formats::MJPEG) > + if (stream->format == HAL_PIXEL_FORMAT_BLOB) > continue; > > StreamConfiguration streamConfiguration; > @@ -1230,10 +1230,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) > /* Now handle MJPEG streams, adding a new stream if required. */ > for (unsigned int i = 0; i < stream_list->num_streams; ++i) { > camera3_stream_t *stream = stream_list->streams[i]; > - PixelFormat format = toPixelFormat(stream->format); > bool match = false; > > - if (format != formats::MJPEG) > + if (stream->format != HAL_PIXEL_FORMAT_BLOB) > continue; > > /* Search for a compatible stream */ >
Hi Kieran On Wed, Sep 02, 2020 at 02:27:31PM +0100, Kieran Bingham wrote: > Hi Jacopo, > > On 02/09/2020 14:08, Jacopo Mondi wrote: > > We assumed HAL_PIXEL_FORMAT_BLOB is always mapped to libcamera::MJPEG > > and at the moment this is true. To protect against future changes in the > > mapping, inspect the Android format instead of the libcamera one. > > > > I think I recall choosing to compare against the libcamera pixel format > "libcamera::MJPEG" as I believed it was more readable/expressive than > 'HAL_PIXEL_FORMAT_BLOB' which means JPEG without saying 'j p e g'. > > > Again, no actual fault in this patch, just it's directly different to > what I think was an active decision I had made previously. I as well don't see a reson to make BLOB_ to anything different than MJPEG. But that's an assumption and could be a wrong one. Also, future considerations apart, I think we're here iterating the camera3_streams, and thus it makes sense to check for their characteristics instead using what we have built on top. Maybe it's a matter of tastes... > > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > > --- > > src/android/camera_device.cpp | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > > index 01f4b3a45566..a917404016e7 100644 > > --- a/src/android/camera_device.cpp > > +++ b/src/android/camera_device.cpp > > @@ -1216,7 +1216,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) > > stream->priv = static_cast<void *>(&streams_[i]); > > > > /* Defer handling of MJPEG streams until all others are known. */ > > - if (format == formats::MJPEG) > > + if (stream->format == HAL_PIXEL_FORMAT_BLOB) > > continue; > > > > StreamConfiguration streamConfiguration; > > @@ -1230,10 +1230,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) > > /* Now handle MJPEG streams, adding a new stream if required. */ > > for (unsigned int i = 0; i < stream_list->num_streams; ++i) { > > camera3_stream_t *stream = stream_list->streams[i]; > > - PixelFormat format = toPixelFormat(stream->format); > > bool match = false; > > > > - if (format != formats::MJPEG) > > + if (stream->format != HAL_PIXEL_FORMAT_BLOB) > > continue; > > > > /* Search for a compatible stream */ > > > > -- > Regards > -- > Kieran
Hi Jacopo, On 02/09/2020 14:45, Jacopo Mondi wrote: > Hi Kieran > > On Wed, Sep 02, 2020 at 02:27:31PM +0100, Kieran Bingham wrote: >> Hi Jacopo, >> >> On 02/09/2020 14:08, Jacopo Mondi wrote: >>> We assumed HAL_PIXEL_FORMAT_BLOB is always mapped to libcamera::MJPEG >>> and at the moment this is true. To protect against future changes in the >>> mapping, inspect the Android format instead of the libcamera one. >>> >> >> I think I recall choosing to compare against the libcamera pixel format >> "libcamera::MJPEG" as I believed it was more readable/expressive than >> 'HAL_PIXEL_FORMAT_BLOB' which means JPEG without saying 'j p e g'. >> >> >> Again, no actual fault in this patch, just it's directly different to >> what I think was an active decision I had made previously. > > I as well don't see a reson to make BLOB_ to anything different than > MJPEG. But that's an assumption and could be a wrong one. > > Also, future considerations apart, I think we're here iterating the > camera3_streams, and thus it makes sense to check for their > characteristics instead using what we have built on top. Maybe it's a > matter of tastes... Possibly, anyway, I wouldn't block this patch. Like I said - this is still correct - just different from how I did it. So if you want to keep it: Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > >> >> >>> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> >>> --- >>> src/android/camera_device.cpp | 5 ++--- >>> 1 file changed, 2 insertions(+), 3 deletions(-) >>> >>> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp >>> index 01f4b3a45566..a917404016e7 100644 >>> --- a/src/android/camera_device.cpp >>> +++ b/src/android/camera_device.cpp >>> @@ -1216,7 +1216,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) >>> stream->priv = static_cast<void *>(&streams_[i]); >>> >>> /* Defer handling of MJPEG streams until all others are known. */ >>> - if (format == formats::MJPEG) >>> + if (stream->format == HAL_PIXEL_FORMAT_BLOB) >>> continue; >>> >>> StreamConfiguration streamConfiguration; >>> @@ -1230,10 +1230,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) >>> /* Now handle MJPEG streams, adding a new stream if required. */ >>> for (unsigned int i = 0; i < stream_list->num_streams; ++i) { >>> camera3_stream_t *stream = stream_list->streams[i]; >>> - PixelFormat format = toPixelFormat(stream->format); >>> bool match = false; >>> >>> - if (format != formats::MJPEG) >>> + if (stream->format != HAL_PIXEL_FORMAT_BLOB) >>> continue; >>> >>> /* Search for a compatible stream */ >>> >> >> -- >> Regards >> -- >> Kieran
Hi Jacopo, Thanks for your patch. On 2020-09-02 15:08:43 +0200, Jacopo Mondi wrote: > We assumed HAL_PIXEL_FORMAT_BLOB is always mapped to libcamera::MJPEG > and at the moment this is true. To protect against future changes in the > mapping, inspect the Android format instead of the libcamera one. > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> I have no strong opinion on this solution or the existing one as pointed out by Kieran, but for what it's worth. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > --- > src/android/camera_device.cpp | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > index 01f4b3a45566..a917404016e7 100644 > --- a/src/android/camera_device.cpp > +++ b/src/android/camera_device.cpp > @@ -1216,7 +1216,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) > stream->priv = static_cast<void *>(&streams_[i]); > > /* Defer handling of MJPEG streams until all others are known. */ > - if (format == formats::MJPEG) > + if (stream->format == HAL_PIXEL_FORMAT_BLOB) > continue; > > StreamConfiguration streamConfiguration; > @@ -1230,10 +1230,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) > /* Now handle MJPEG streams, adding a new stream if required. */ > for (unsigned int i = 0; i < stream_list->num_streams; ++i) { > camera3_stream_t *stream = stream_list->streams[i]; > - PixelFormat format = toPixelFormat(stream->format); > bool match = false; > > - if (format != formats::MJPEG) > + if (stream->format != HAL_PIXEL_FORMAT_BLOB) > continue; > > /* Search for a compatible stream */ > -- > 2.28.0 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 01f4b3a45566..a917404016e7 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1216,7 +1216,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) stream->priv = static_cast<void *>(&streams_[i]); /* Defer handling of MJPEG streams until all others are known. */ - if (format == formats::MJPEG) + if (stream->format == HAL_PIXEL_FORMAT_BLOB) continue; StreamConfiguration streamConfiguration; @@ -1230,10 +1230,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) /* Now handle MJPEG streams, adding a new stream if required. */ for (unsigned int i = 0; i < stream_list->num_streams; ++i) { camera3_stream_t *stream = stream_list->streams[i]; - PixelFormat format = toPixelFormat(stream->format); bool match = false; - if (format != formats::MJPEG) + if (stream->format != HAL_PIXEL_FORMAT_BLOB) continue; /* Search for a compatible stream */
We assumed HAL_PIXEL_FORMAT_BLOB is always mapped to libcamera::MJPEG and at the moment this is true. To protect against future changes in the mapping, inspect the Android format instead of the libcamera one. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- src/android/camera_device.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)