|
|
@ -19,7 +19,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include <utils/Errors.h>
|
|
|
|
#include <utils/Errors.h>
|
|
|
|
#include <array>
|
|
|
|
#include <array>
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "camera/CameraMetadata.h"
|
|
|
|
#include "camera/CameraMetadata.h"
|
|
|
|
#include "device3/CoordinateMapper.h"
|
|
|
|
#include "device3/CoordinateMapper.h"
|
|
|
@ -36,7 +35,9 @@ namespace camera3 {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class ZoomRatioMapper : private CoordinateMapper {
|
|
|
|
class ZoomRatioMapper : private CoordinateMapper {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
ZoomRatioMapper();
|
|
|
|
ZoomRatioMapper() = default;
|
|
|
|
|
|
|
|
ZoomRatioMapper(const CameraMetadata *deviceInfo,
|
|
|
|
|
|
|
|
bool supportNativeZoomRatio, bool usePrecorrectArray);
|
|
|
|
ZoomRatioMapper(const ZoomRatioMapper& other) :
|
|
|
|
ZoomRatioMapper(const ZoomRatioMapper& other) :
|
|
|
|
mHalSupportsZoomRatio(other.mHalSupportsZoomRatio),
|
|
|
|
mHalSupportsZoomRatio(other.mHalSupportsZoomRatio),
|
|
|
|
mArrayWidth(other.mArrayWidth), mArrayHeight(other.mArrayHeight) {}
|
|
|
|
mArrayWidth(other.mArrayWidth), mArrayHeight(other.mArrayHeight) {}
|
|
|
@ -52,16 +53,6 @@ class ZoomRatioMapper : private CoordinateMapper {
|
|
|
|
static status_t overrideZoomRatioTags(
|
|
|
|
static status_t overrideZoomRatioTags(
|
|
|
|
CameraMetadata* deviceInfo, bool* supportNativeZoomRatio);
|
|
|
|
CameraMetadata* deviceInfo, bool* supportNativeZoomRatio);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Initialize zoom ratio mapper with static metadata.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Note:
|
|
|
|
|
|
|
|
* This function may modify the static metadata with zoomRatio related
|
|
|
|
|
|
|
|
* tags.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
status_t initZoomRatioTags(const CameraMetadata *deviceInfo,
|
|
|
|
|
|
|
|
bool supportNativeZoomRatio, bool usePrecorrectArray);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Update capture request to handle both cropRegion and zoomRatio.
|
|
|
|
* Update capture request to handle both cropRegion and zoomRatio.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -82,16 +73,16 @@ class ZoomRatioMapper : private CoordinateMapper {
|
|
|
|
void scaleCoordinates(int32_t* coordPairs, int coordCount,
|
|
|
|
void scaleCoordinates(int32_t* coordPairs, int coordCount,
|
|
|
|
float scaleRatio, ClampMode clamp);
|
|
|
|
float scaleRatio, ClampMode clamp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isValid() { return mIsValid; }
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
|
|
|
|
// const after construction
|
|
|
|
bool mHalSupportsZoomRatio;
|
|
|
|
bool mHalSupportsZoomRatio;
|
|
|
|
|
|
|
|
|
|
|
|
// active array / pre-correction array dimension
|
|
|
|
// active array / pre-correction array dimension
|
|
|
|
int32_t mArrayWidth, mArrayHeight;
|
|
|
|
int32_t mArrayWidth, mArrayHeight;
|
|
|
|
|
|
|
|
|
|
|
|
mutable std::mutex mMutex;
|
|
|
|
bool mIsValid = false;
|
|
|
|
|
|
|
|
|
|
|
|
float deriveZoomRatio(const CameraMetadata* metadata);
|
|
|
|
float deriveZoomRatio(const CameraMetadata* metadata);
|
|
|
|
|
|
|
|
|
|
|
|
void scaleRects(int32_t* rects, int rectCount, float scaleRatio);
|
|
|
|
void scaleRects(int32_t* rects, int rectCount, float scaleRatio);
|
|
|
|
|
|
|
|
|
|
|
|
status_t separateZoomFromCropLocked(CameraMetadata* metadata, bool isResult);
|
|
|
|
status_t separateZoomFromCropLocked(CameraMetadata* metadata, bool isResult);
|
|
|
|