Skip to content

Commit

Permalink
change the orientation of 90deg to 270 for preview
Browse files Browse the repository at this point in the history
  • Loading branch information
gkdeepa committed Nov 3, 2021
1 parent a5a2929 commit 59d6ad5
Showing 1 changed file with 108 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
From 750a6d205960e2edaaa3e5b7ff8400bbac2daac5 Mon Sep 17 00:00:00 2001
From: gkdeepa <[email protected]>
Date: Wed, 3 Nov 2021 14:11:10 +0530
Subject: [PATCH] check orientation in camera 90deg case

Tracked-On:
---
...ck-orientation-in-camera-180deg-case.patch | 50 +++++++++++++++++++
.../api1/client2/Parameters.cpp | 10 ++--
2 files changed, 56 insertions(+), 4 deletions(-)
create mode 100644 services/camera/libcameraservice/api1/0001-check-orientation-in-camera-180deg-case.patch

diff --git a/services/camera/libcameraservice/api1/0001-check-orientation-in-camera-180deg-case.patch b/services/camera/libcameraservice/api1/0001-check-orientation-in-camera-180deg-case.patch
new file mode 100644
index 0000000000..42b83e5fa1
--- /dev/null
+++ b/services/camera/libcameraservice/api1/0001-check-orientation-in-camera-180deg-case.patch
@@ -0,0 +1,50 @@
+From 9aa1a62d7206fdd32ea61eaecea46a58d5915686 Mon Sep 17 00:00:00 2001
+From: gkdeepa <[email protected]>
+Date: Wed, 3 Nov 2021 14:11:10 +0530
+Subject: [PATCH] check orientation in camera 180deg case
+
+Tracked-On:
+---
+ .../camera/libcameraservice/api1/client2/Parameters.cpp | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp
+index dbc863b3ad..9979610ca0 100644
+--- a/services/camera/libcameraservice/api1/client2/Parameters.cpp
++++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp
+@@ -16,7 +16,7 @@
+
+ #define LOG_TAG "Camera2-Parameters"
+ #define ATRACE_TAG ATRACE_TAG_CAMERA
+-// #define LOG_NDEBUG 0
++#define LOG_NDEBUG 0
+
+ #include <utils/Log.h>
+ #include <utils/Trace.h>
+@@ -2828,10 +2828,12 @@ bool Parameters::boolFromString(const char *boolStr) {
+ }
+
+ int Parameters::degToTransform(int degrees, bool mirror) {
++ ALOGE("degrees and mirror %d %d ",degrees, mirror);
+ 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 == 180) return HAL_TRANSFORM_ROT_180;
++ else if (degrees == 180) return 0;
+ else if (degrees == 270) return HAL_TRANSFORM_ROT_270;
+ } else { // Do mirror (horizontal flip)
+ if (degrees == 0) { // FLIP_H and ROT_0
+@@ -2839,7 +2841,8 @@ int Parameters::degToTransform(int degrees, bool mirror) {
+ } else if (degrees == 90) { // FLIP_H and ROT_90
+ return HAL_TRANSFORM_FLIP_H | HAL_TRANSFORM_ROT_90;
+ } else if (degrees == 180) { // FLIP_H and ROT_180
+- return HAL_TRANSFORM_FLIP_V;
++ return 0;
++ //return HAL_TRANSFORM_FLIP_V;
+ } else if (degrees == 270) { // FLIP_H and ROT_270
+ return HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_ROT_90;
+ }
+--
+2.17.1
+
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp
index dbc863b3ad..487e7cd426 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.cpp
+++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp
@@ -16,7 +16,7 @@

#define LOG_TAG "Camera2-Parameters"
#define ATRACE_TAG ATRACE_TAG_CAMERA
-// #define LOG_NDEBUG 0
+#define LOG_NDEBUG 0

#include <utils/Log.h>
#include <utils/Trace.h>
@@ -2828,18 +2828,20 @@ bool Parameters::boolFromString(const char *boolStr) {
}

int Parameters::degToTransform(int degrees, bool mirror) {
+ ALOGE("degrees and mirror %d %d ",degrees, mirror);
if (!mirror) {
if (degrees == 0) return 0;
- else if (degrees == 90) return HAL_TRANSFORM_ROT_90;
+ else if (degrees == 90) return HAL_TRANSFORM_ROT_270;
else if (degrees == 180) return HAL_TRANSFORM_ROT_180;
else if (degrees == 270) return HAL_TRANSFORM_ROT_270;
} else { // Do mirror (horizontal flip)
if (degrees == 0) { // FLIP_H and ROT_0
return HAL_TRANSFORM_FLIP_H;
} else if (degrees == 90) { // FLIP_H and ROT_90
- return HAL_TRANSFORM_FLIP_H | HAL_TRANSFORM_ROT_90;
+ return HAL_TRANSFORM_FLIP_H ;
} else if (degrees == 180) { // FLIP_H and ROT_180
- return HAL_TRANSFORM_FLIP_V;
+ return 0;
+ //return HAL_TRANSFORM_FLIP_V;
} else if (degrees == 270) { // FLIP_H and ROT_270
return HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_ROT_90;
}
--
2.17.1

0 comments on commit 59d6ad5

Please sign in to comment.