diff options
author | Chien-Yu Chen <cychen@google.com> | 2017-08-30 21:26:20 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-08-30 21:26:20 +0000 |
commit | 4842f2aff85df3621460f68908361f458d1f67e7 (patch) | |
tree | bbcc6b909bf35bd424511a6092fa6588a751d512 | |
parent | 2e046585ec950d3c29da924452533e7d8eeea5c0 (diff) | |
parent | 022898c89918f2c936672e5f48266b34dfaa184b (diff) | |
download | easel-4842f2aff85df3621460f68908361f458d1f67e7.tar.gz |
Merge "pbcamera: Support postview" into oc-mr1-dev
-rw-r--r-- | camera/include/HdrPlusTypes.h | 5 | ||||
-rw-r--r-- | camera/libhdrplusclient/HdrPlusClientUtils.cpp | 18 | ||||
-rw-r--r-- | camera/libhdrplusclient/include/HdrPlusClientListener.h | 6 |
3 files changed, 27 insertions, 2 deletions
diff --git a/camera/include/HdrPlusTypes.h b/camera/include/HdrPlusTypes.h index 310f57e..aa68206 100644 --- a/camera/include/HdrPlusTypes.h +++ b/camera/include/HdrPlusTypes.h @@ -404,17 +404,20 @@ struct FrameMetadata { */ struct RequestMetadata { std::array<int32_t, 4> cropRegion; // android.scaler.cropRegion (x_min, y_min, width, height) + bool postviewEnable; // com.google.nexus.experimental2017.stats.postview_enable // Check if the contents of lhs and rhs are equal. For vector and array variables, two are // equal if their elements are equal at the same position. bool operator==(const RequestMetadata& rhs) const { - return cropRegion == rhs.cropRegion; + return cropRegion == rhs.cropRegion && + postviewEnable == rhs.postviewEnable; } // Convert this static metadata to a string and append it to the specified string. void appendToString(std::string *strOut) const { if (strOut == nullptr) return; metadatautils::appendVectorOrArrayToString(strOut, "cropRegion", cropRegion); + metadatautils::appendValueToString(strOut, "postviewEnable", postviewEnable); } }; diff --git a/camera/libhdrplusclient/HdrPlusClientUtils.cpp b/camera/libhdrplusclient/HdrPlusClientUtils.cpp index 53b06af..1fb6838 100644 --- a/camera/libhdrplusclient/HdrPlusClientUtils.cpp +++ b/camera/libhdrplusclient/HdrPlusClientUtils.cpp @@ -56,6 +56,21 @@ static status_t getRgb(uint8_t *r, uint8_t *g, uint8_t* b, uint32_t x, uint32_t *b = std::min(std::max(yc + 1.772431f * uc - 0.006137f * vc, 0.0f), 255.0f); return OK; } + case HAL_PIXEL_FORMAT_RGB_888: + { + // Check the stream configuration has 1 plane. + if (streamConfig.image.planes.size() != 1) { + ALOGE("%s: RGB_888 should have 1 plane but it has %zu", __FUNCTION__, + streamConfig.image.planes.size()); + return BAD_VALUE; + } + + uint32_t offset = y * streamConfig.image.planes[0].stride + x * 3; + *r = ((uint8_t*)buffer.data)[offset]; + *g = ((uint8_t*)buffer.data)[offset + 1]; + *b = ((uint8_t*)buffer.data)[offset + 2]; + return OK; + } default: ALOGE("%s: Format %d is not supported.", __FUNCTION__, streamConfig.image.format); return BAD_VALUE; @@ -64,7 +79,8 @@ static status_t getRgb(uint8_t *r, uint8_t *g, uint8_t* b, uint32_t x, uint32_t status_t writePpm(const std::string &filename, const pbcamera::StreamConfiguration &streamConfig, const pbcamera::StreamBuffer &buffer) { - if (streamConfig.image.format != HAL_PIXEL_FORMAT_YCrCb_420_SP) { + if (streamConfig.image.format != HAL_PIXEL_FORMAT_YCrCb_420_SP && + streamConfig.image.format != HAL_PIXEL_FORMAT_RGB_888) { ALOGE("%s: format 0x%x is not supported.", __FUNCTION__, streamConfig.image.format); return BAD_VALUE; } diff --git a/camera/libhdrplusclient/include/HdrPlusClientListener.h b/camera/libhdrplusclient/include/HdrPlusClientListener.h index 7209944..e1e2c97 100644 --- a/camera/libhdrplusclient/include/HdrPlusClientListener.h +++ b/camera/libhdrplusclient/include/HdrPlusClientListener.h @@ -75,6 +75,12 @@ public: * apSensorTimestampNs is the AP sensor timestamp of the base frame, in nanoseconds. */ virtual void onShutter(uint32_t requestId, int64_t apSensorTimestampNs) = 0; + + /* + * Invoked when the postview for a request is ready. + */ + virtual void onPostview(uint32_t requestId, std::unique_ptr<std::vector<uint8_t>> postview, + uint32_t width, uint32_t height, uint32_t stride, int32_t format) = 0; }; } // namespace android |