Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02453e2a authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

libcameraservice: Support FFCs with reversed rotation logic

Double mirroring, how does it work? :(

This also does a revert of change I795b216228da46ee98efc8540ada1780d00b18d8,
("libcameraservice: Add exceptions to handle the FFC on the LGE star")
since it serves the same purpose in a better (and generic) way.

Change-Id: I2bcc770ad51bd185103956e80d1a13d5c81c5edd
parent b1eac42f
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -101,10 +101,6 @@ ifeq ($(BOARD_FIRST_CAMERA_FRONT_FACING),true)
    LOCAL_CFLAGS += -DFIRST_CAMERA_FACING=CAMERA_FACING_FRONT -DFIRST_CAMERA_ORIENTATION=0
endif

ifeq ($(BOARD_HAS_LGE_FFC), true)
    LOCAL_CFLAGS += -DBOARD_HAS_LGE_FFC
endif

ifeq ($(TARGET_USE_MOTO_CUSTOM_CAMERA_PARAMETERS),true)
    LOCAL_CFLAGS += -DMOTO_CUSTOM_PARAMETERS
endif
+4 −26
Original line number Diff line number Diff line
@@ -252,16 +252,6 @@ sp<ICamera> CameraService::connect(
        hardware->setParameters(params);
    }
#endif
#ifdef BOARD_HAS_LGE_FFC
    CameraParameters params(hardware->getParameters());
    if (cameraId == 1) {
        params.set("nv-flip-mode","vertical");
    } else {
        params.set("nv-flip-mode","off");
    }
    hardware->setParameters(params);
#endif


    CameraInfo info;
    HAL_getCameraInfo(cameraId, &info);
@@ -1119,14 +1109,6 @@ status_t CameraService::Client::setParameters(const String8& params) {

    CameraParameters p(params);

#ifdef BOARD_HAS_LGE_FFC
    /* Do not set nvidia focus area to 0 */
    if(p.get("nv-areas-to-focus")!= NULL &&
       !strncmp(p.get("nv-areas-to-focus"),"0",1)) {
        p.remove("nv-areas-to-focus");
    }
#endif

    return mHardware->setParameters(p);
}

@@ -1623,20 +1605,16 @@ void CameraService::Client::copyFrameAndPostCopiedFrame(
}

int CameraService::Client::getOrientation(int degrees, bool mirror) {
#ifdef BOARD_HAS_LGE_FFC
    /* FLIP_* generate weird behaviors that don't include flipping */
    LOGV("Asking orientation %d with %d",degrees,mirror);
    if (mirror && 
          degrees == 270 || degrees == 90)  // ROTATE_90 just for these orientations
            return HAL_TRANSFORM_ROT_90;
    mirror = 0;
#endif
    if (!mirror) {
        if (degrees == 0) return 0;
        else if (degrees == 90) return HAL_TRANSFORM_ROT_90;
        else if (degrees == 180) return HAL_TRANSFORM_ROT_180;
        else if (degrees == 270) return HAL_TRANSFORM_ROT_270;
    } else {  // Do mirror (horizontal flip)
#ifdef REVERSE_FFC_MIRROR_LOGIC
        degrees += 180;
        degrees %= 360;
#endif
        if (degrees == 0) {           // FLIP_H and ROT_0
            return HAL_TRANSFORM_FLIP_H;
        } else if (degrees == 90) {   // FLIP_H and ROT_90