diff options
author | Yin-Chia Yeh <yinchiayeh@google.com> | 2017-09-20 23:33:31 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-09-20 23:33:31 +0000 |
commit | 57b0a0a1f969960c419918ba2c55fbb8081b3920 (patch) | |
tree | 3cc26f9275bfc17346d865260903fc2e09d92a61 /camera/QCamera2/HAL3/QCamera3Channel.cpp | |
parent | a4fcebc7d1e4fb95f2f29c8ec4cf9680c1c64d1f (diff) | |
parent | eade08a0a8e1e13d14d5d3f36d94419d3741cfd6 (diff) | |
download | bullhead-57b0a0a1f969960c419918ba2c55fbb8081b3920.tar.gz |
Merge "Camera: fix LSB 2 bits fetching bug" into oc-mr1-dev
am: eade08a0a8
Change-Id: Ib279179b5bf1d7e0757f7241ce308fef4ae360a0
Diffstat (limited to 'camera/QCamera2/HAL3/QCamera3Channel.cpp')
-rw-r--r-- | camera/QCamera2/HAL3/QCamera3Channel.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.cpp b/camera/QCamera2/HAL3/QCamera3Channel.cpp index cb31953..bfeb46a 100644 --- a/camera/QCamera2/HAL3/QCamera3Channel.cpp +++ b/camera/QCamera2/HAL3/QCamera3Channel.cpp @@ -1974,6 +1974,8 @@ void QCamera3RawChannel::convertMipiToRaw16(mm_camera_buf_def_t *frame) uint32_t raw16_stride = ((uint32_t)dim.width + 15U) & ~15U; uint16_t* raw16_buffer = (uint16_t *)frame->buffer; + uint8_t first_quintuple[5]; + memcpy(first_quintuple, raw16_buffer, sizeof(first_quintuple)); // Some raw processing may be needed prior to conversion. static bool raw_proc_lib_load_attempted = false; @@ -2007,13 +2009,19 @@ void QCamera3RawChannel::convertMipiToRaw16(mm_camera_buf_def_t *frame) for (int32_t xs = dim.width - 1; xs >= 0; xs--) { uint32_t x = (uint32_t)xs; uint8_t upper_8bit = row_start[5*(x/4)+x%4]; - uint8_t lower_2bit = ((row_start[5*(x/4)+4] >> (x%4)) & 0x3); + uint8_t lower_2bit = ((row_start[5*(x/4)+4] >> ((x%4) << 1)) & 0x3); uint16_t raw16_pixel = (uint16_t)(((uint16_t)upper_8bit)<<2 | (uint16_t)lower_2bit); raw16_buffer[y*raw16_stride+x] = raw16_pixel; } } + + // Re-convert the first 2 pixels of the buffer because the loop above messes + // them up by reading the first quintuple while modifying it. + raw16_buffer[0] = ((uint16_t)first_quintuple[0]<<2) | (first_quintuple[4] & 0x3); + raw16_buffer[1] = ((uint16_t)first_quintuple[1]<<2) | ((first_quintuple[4] >> 2) & 0x3); + } else { ALOGE("%s: Could not find stream", __func__); } |