[libcamera-devel] android: mm: cros_camera_buffer: Fix wrong indexing in plane()
diff mbox series

Message ID 20210616085923.2888083-1-hiroh@chromium.org
State Accepted
Commit e4e3af642e03b57123c472ce743fdf8eb08e016a
Headers show
Series
  • [libcamera-devel] android: mm: cros_camera_buffer: Fix wrong indexing in plane()
Related show

Commit Message

Hirokazu Honda June 16, 2021, 8:59 a.m. UTC
CameraBuffer::plane() should be accessed in zero based index.
Fix the wrong indexing in CameraBuffer::plane() in
cros_camera_buffer.cpp.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
---
 src/android/mm/cros_camera_buffer.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Hirokazu Honda June 21, 2021, 2:41 a.m. UTC | #1
gentle ping for review.

On Wed, Jun 16, 2021 at 5:59 PM Hirokazu Honda <hiroh@chromium.org> wrote:

> CameraBuffer::plane() should be accessed in zero based index.
> Fix the wrong indexing in CameraBuffer::plane() in
> cros_camera_buffer.cpp.
>
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> ---
>  src/android/mm/cros_camera_buffer.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/android/mm/cros_camera_buffer.cpp
> b/src/android/mm/cros_camera_buffer.cpp
> index 59e26d1b..c4157606 100644
> --- a/src/android/mm/cros_camera_buffer.cpp
> +++ b/src/android/mm/cros_camera_buffer.cpp
> @@ -113,13 +113,13 @@ Span<uint8_t> CameraBuffer::Private::plane(unsigned
> int plane)
>                 break;
>         default:
>                 switch (plane) {
> -               case 1:
> +               case 0:
>                         addr = mem.ycbcr.y;
>                         break;
> -               case 2:
> +               case 1:
>                         addr = mem.ycbcr.cb;
>                         break;
> -               case 3:
> +               case 2:
>                         addr = mem.ycbcr.cr;
>                         break;
>                 }
> --
> 2.32.0.272.g935e593368-goog
>
>
Hirokazu Honda June 25, 2021, 2:39 a.m. UTC | #2
gentle ping for review :)

On Mon, Jun 21, 2021 at 11:41 AM Hirokazu Honda <hiroh@chromium.org> wrote:
>
> gentle ping for review.
>
> On Wed, Jun 16, 2021 at 5:59 PM Hirokazu Honda <hiroh@chromium.org> wrote:
>>
>> CameraBuffer::plane() should be accessed in zero based index.
>> Fix the wrong indexing in CameraBuffer::plane() in
>> cros_camera_buffer.cpp.
>>
>> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
>> ---
>>  src/android/mm/cros_camera_buffer.cpp | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/android/mm/cros_camera_buffer.cpp b/src/android/mm/cros_camera_buffer.cpp
>> index 59e26d1b..c4157606 100644
>> --- a/src/android/mm/cros_camera_buffer.cpp
>> +++ b/src/android/mm/cros_camera_buffer.cpp
>> @@ -113,13 +113,13 @@ Span<uint8_t> CameraBuffer::Private::plane(unsigned int plane)
>>                 break;
>>         default:
>>                 switch (plane) {
>> -               case 1:
>> +               case 0:
>>                         addr = mem.ycbcr.y;
>>                         break;
>> -               case 2:
>> +               case 1:
>>                         addr = mem.ycbcr.cb;
>>                         break;
>> -               case 3:
>> +               case 2:
>>                         addr = mem.ycbcr.cr;
>>                         break;
>>                 }
>> --
>> 2.32.0.272.g935e593368-goog
>>
Laurent Pinchart June 25, 2021, 3:24 a.m. UTC | #3
Hi Hiro,

Thank you for the patch, and sorry for the delay. Sometimes the simplest
fix, that should be easy to review, still fall through the cracks :-S

On Fri, Jun 25, 2021 at 11:39:41AM +0900, Hirokazu Honda wrote:
> gentle ping for review :)
> 
> On Mon, Jun 21, 2021 at 11:41 AM Hirokazu Honda wrote:
> >
> > gentle ping for review.
> >
> > On Wed, Jun 16, 2021 at 5:59 PM Hirokazu Honda wrote:
> >>
> >> CameraBuffer::plane() should be accessed in zero based index.
> >> Fix the wrong indexing in CameraBuffer::plane() in
> >> cros_camera_buffer.cpp.
> >>
> >> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> >> ---
> >>  src/android/mm/cros_camera_buffer.cpp | 6 +++---
> >>  1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/src/android/mm/cros_camera_buffer.cpp b/src/android/mm/cros_camera_buffer.cpp
> >> index 59e26d1b..c4157606 100644
> >> --- a/src/android/mm/cros_camera_buffer.cpp
> >> +++ b/src/android/mm/cros_camera_buffer.cpp
> >> @@ -113,13 +113,13 @@ Span<uint8_t> CameraBuffer::Private::plane(unsigned int plane)
> >>                 break;
> >>         default:
> >>                 switch (plane) {
> >> -               case 1:
> >> +               case 0:
> >>                         addr = mem.ycbcr.y;
> >>                         break;
> >> -               case 2:
> >> +               case 1:
> >>                         addr = mem.ycbcr.cb;
> >>                         break;
> >> -               case 3:
> >> +               case 2:
> >>                         addr = mem.ycbcr.cr;
> >>                         break;
> >>                 }
Paul Elder June 25, 2021, 9:14 a.m. UTC | #4
Hi Hiro,

Sorry for the delay.

On Wed, Jun 16, 2021 at 05:59:23PM +0900, Hirokazu Honda wrote:
> CameraBuffer::plane() should be accessed in zero based index.
> Fix the wrong indexing in CameraBuffer::plane() in
> cros_camera_buffer.cpp.
> 
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/android/mm/cros_camera_buffer.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/android/mm/cros_camera_buffer.cpp b/src/android/mm/cros_camera_buffer.cpp
> index 59e26d1b..c4157606 100644
> --- a/src/android/mm/cros_camera_buffer.cpp
> +++ b/src/android/mm/cros_camera_buffer.cpp
> @@ -113,13 +113,13 @@ Span<uint8_t> CameraBuffer::Private::plane(unsigned int plane)
>  		break;
>  	default:
>  		switch (plane) {
> -		case 1:
> +		case 0:
>  			addr = mem.ycbcr.y;
>  			break;
> -		case 2:
> +		case 1:
>  			addr = mem.ycbcr.cb;
>  			break;
> -		case 3:
> +		case 2:
>  			addr = mem.ycbcr.cr;
>  			break;
>  		}
> -- 
> 2.32.0.272.g935e593368-goog
>

Patch
diff mbox series

diff --git a/src/android/mm/cros_camera_buffer.cpp b/src/android/mm/cros_camera_buffer.cpp
index 59e26d1b..c4157606 100644
--- a/src/android/mm/cros_camera_buffer.cpp
+++ b/src/android/mm/cros_camera_buffer.cpp
@@ -113,13 +113,13 @@  Span<uint8_t> CameraBuffer::Private::plane(unsigned int plane)
 		break;
 	default:
 		switch (plane) {
-		case 1:
+		case 0:
 			addr = mem.ycbcr.y;
 			break;
-		case 2:
+		case 1:
 			addr = mem.ycbcr.cb;
 			break;
-		case 3:
+		case 2:
 			addr = mem.ycbcr.cr;
 			break;
 		}