summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/CameraHal/camera_test.h10
-rw-r--r--test/CameraHal/camera_test_menu.cpp122
2 files changed, 124 insertions, 8 deletions
diff --git a/test/CameraHal/camera_test.h b/test/CameraHal/camera_test.h
index f23ad3d..166c620 100644
--- a/test/CameraHal/camera_test.h
+++ b/test/CameraHal/camera_test.h
@@ -68,7 +68,7 @@
#define KEY_MECHANICAL_MISALIGNMENT_CORRECTION "mechanical-misalignment-correction"
//TI extensions for enable/disable algos
-#define KEY_ALGO_FIXED_GAMMA "ti-algo-fixed-gamma"
+#define KEY_ALGO_EXTERNAL_GAMMA "ti-algo-external-gamma"
#define KEY_ALGO_NSF1 "ti-algo-nsf1"
#define KEY_ALGO_NSF2 "ti-algo-nsf2"
#define KEY_ALGO_SHARPENING "ti-algo-sharpening"
@@ -78,6 +78,8 @@
#define KEY_TAP_OUT_SURFACES "tap-out"
#define KEY_TAP_IN_SURFACE "tap-in"
+#define KEY_GAMMA_TABLE "gamma-table"
+
#define BRACKETING_IDX_DEFAULT 0
#define BRACKETING_IDX_STREAM 1
#define BRACKETING_STREAM_BUFFERS 9
@@ -231,6 +233,12 @@ typedef struct param_NamedExpBracketList_t {
const char *value;
} param_NamedExpBracketList;
+typedef struct param_GammaTblList_t {
+ const char *desc;
+ const char *r;
+ const char *g;
+ const char *b;
+} param_GammaTblList;
char * get_cycle_cmd(const char *aSrc);
void trim_script_cmd(char *cmd);
diff --git a/test/CameraHal/camera_test_menu.cpp b/test/CameraHal/camera_test_menu.cpp
index 8d75710..a3c55b6 100644
--- a/test/CameraHal/camera_test_menu.cpp
+++ b/test/CameraHal/camera_test_menu.cpp
@@ -522,13 +522,13 @@ bool firstTime = true;
bool firstTimeStereo = true;
//TI extensions for enable/disable algos
-const char *algoFixedGamma[] = {CameraParameters::FALSE, CameraParameters::TRUE};
+const char *algoExternalGamma[] = {CameraParameters::FALSE, CameraParameters::TRUE};
const char *algoNSF1[] = {CameraParameters::FALSE, CameraParameters::TRUE};
const char *algoNSF2[] = {CameraParameters::FALSE, CameraParameters::TRUE};
const char *algoSharpening[] = {CameraParameters::FALSE, CameraParameters::TRUE};
const char *algoThreeLinColorMap[] = {CameraParameters::FALSE, CameraParameters::TRUE};
const char *algoGIC[] = {CameraParameters::FALSE, CameraParameters::TRUE};
-int algoFixedGammaIDX = 1;
+int algoExternalGammaIDX = 0;
int algoNSF1IDX = 1;
int algoNSF2IDX = 1;
int algoSharpeningIDX = 1;
@@ -539,6 +539,88 @@ int algoGICIDX = 1;
bool bufferSourceInputReset = false;
bool bufferSourceOutputReset = false;
+/** Gamma table */
+const char *gammaTbl22 = "("
+ "0:8,8:12,20:8,28:8,36:8,44:12,56:8,64:8,72:8,80:12,92:4,96:8,104:4,108:8,116:8,124:8,"
+ "132:4,136:8,144:4,148:8,156:4,160:8,168:4,172:4,176:4,180:8,188:4,192:8,200:4,204:4,208:4,212:4,"
+ "216:4,220:4,224:4,228:8,236:4,240:4,244:4,248:4,252:4,256:4,260:4,264:4,268:0,268:4,272:4,276:4,"
+ "280:4,284:4,288:4,292:4,296:4,300:4,304:0,304:4,308:4,312:4,316:4,320:4,324:0,324:4,328:4,332:4,"
+ "336:0,336:4,340:4,344:4,348:0,348:4,352:4,356:4,360:0,360:4,364:4,368:4,372:0,372:4,376:0,376:4,"
+ "380:4,384:4,388:0,388:4,392:0,392:4,396:4,400:4,404:0,404:4,408:0,408:4,412:0,412:4,416:4,420:4,"
+ "424:0,424:4,428:0,428:4,432:0,432:4,436:4,440:4,444:0,444:4,448:0,448:4,452:0,452:4,456:0,456:4,"
+ "460:0,460:4,464:0,464:4,468:4,472:4,476:0,476:4,480:0,480:4,484:0,484:4,488:0,488:4,492:0,492:4,"
+ "496:0,496:4,500:0,500:4,504:0,504:4,508:0,508:4,512:0,512:4,516:0,516:4,520:0,520:4,524:0,524:4,"
+ "528:0,528:4,532:0,532:4,536:0,536:4,540:0,540:4,544:0,544:4,548:0,548:4,552:0,552:4,556:0,556:4,"
+ "560:0,560:4,564:0,564:4,568:0,568:4,572:0,572:4,576:0,576:4,580:0,580:0,580:0,580:4,584:0,584:4,"
+ "588:0,588:4,592:0,592:4,596:0,596:4,600:0,600:4,604:0,604:4,608:0,608:0,608:0,608:4,612:0,612:4,"
+ "616:0,616:4,620:0,620:4,624:0,624:4,628:0,628:4,632:0,632:0,632:0,632:4,636:0,636:4,640:0,640:4,"
+ "644:0,644:4,648:0,648:0,648:0,648:4,652:0,652:4,656:0,656:4,660:0,660:4,664:0,664:0,664:0,664:4,"
+ "668:0,668:4,672:0,672:4,676:0,676:4,680:0,680:0,680:0,680:4,684:0,684:4,688:0,688:4,692:0,692:0,"
+ "692:0,692:4,696:0,696:4,700:0,700:4,704:0,704:0,704:0,704:4,708:0,708:4,712:0,712:4,716:0,716:0,"
+ "716:0,716:4,720:0,720:4,724:0,724:0,724:0,724:4,728:0,728:4,732:0,732:4,736:0,736:0,736:0,736:4,"
+ "740:0,740:4,744:0,744:0,744:0,744:4,748:0,748:4,752:0,752:0,752:0,752:4,756:0,756:4,760:0,760:4,"
+ "764:0,764:0,764:0,764:4,768:0,768:4,772:0,772:0,772:0,772:4,776:0,776:4,780:0,780:0,780:0,780:4,"
+ "784:0,784:4,788:0,788:0,788:0,788:4,792:0,792:4,796:0,796:0,796:0,796:4,800:0,800:0,800:0,800:4,"
+ "804:0,804:4,808:0,808:0,808:0,808:4,812:0,812:4,816:0,816:0,816:0,816:4,820:0,820:4,824:0,824:0,"
+ "824:0,824:4,828:0,828:0,828:0,828:4,832:0,832:4,836:0,836:0,836:0,836:4,840:0,840:4,844:0,844:0,"
+ "844:0,844:4,848:0,848:0,848:0,848:4,852:0,852:4,856:0,856:0,856:0,856:4,860:0,860:0,860:0,860:4,"
+ "864:0,864:4,868:0,868:0,868:0,868:4,872:0,872:0,872:0,872:4,876:0,876:0,876:0,876:4,880:0,880:4,"
+ "884:0,884:0,884:0,884:4,888:0,888:0,888:0,888:4,892:0,892:4,896:0,896:0,896:0,896:4,900:0,900:0,"
+ "900:0,900:4,904:0,904:0,904:0,904:4,908:0,908:4,912:0,912:0,912:0,912:4,916:0,916:0,916:0,916:4,"
+ "920:0,920:0,920:0,920:4,924:0,924:0,924:0,924:4,928:0,928:4,932:0,932:0,932:0,932:4,936:0,936:0,"
+ "936:0,936:4,940:0,940:0,940:0,940:4,944:0,944:0,944:0,944:4,948:0,948:0,948:0,948:4,952:0,952:0,"
+ "952:0,952:4,956:0,956:4,960:0,960:0,960:0,960:4,964:0,964:0,964:0,964:4,968:0,968:0,968:0,968:4,"
+ "972:0,972:0,972:0,972:4,976:0,976:0,976:0,976:4,980:0,980:0,980:0,980:4,984:0,984:0,984:0,984:4,"
+ "988:0,988:0,988:0,988:4,992:0,992:0,992:0,992:4,996:0,996:0,996:0,996:4,1000:0,1000:0,1000:0,1000:4,"
+ "1004:0,1004:0,1004:0,1004:4,1008:0,1008:0,1008:0,1008:4,1012:0,1012:4,1016:0,1016:0,1016:0,1016:4,1020:0,1020:0"
+ ")";
+const char *gammaTbl0 = "("
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0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4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,"
+ "4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0,4:0"
+ ")";
+const param_GammaTblList_t manualGammaModes[] = {
+ {"Off", NULL, NULL, NULL},
+ {"White", gammaTbl22, gammaTbl22, gammaTbl22},
+ {"Yellow", gammaTbl22, gammaTbl22, gammaTbl0},
+ {"Cyan", gammaTbl0, gammaTbl22, gammaTbl22},
+ {"Green", gammaTbl0, gammaTbl22, gammaTbl0},
+ {"Magenta", gammaTbl22, gammaTbl0, gammaTbl22},
+ {"Red", gammaTbl22, gammaTbl0, gammaTbl0},
+ {"Blue", gammaTbl0, gammaTbl0, gammaTbl22},
+ {"Black", gammaTbl0, gammaTbl0, gammaTbl0}
+};
+int manualGammaModeIDX = 0;
+
/** Calculate delay from a reference time */
unsigned long long timeval_delay(const timeval *ref) {
unsigned long long st, end, delay;
@@ -2179,13 +2261,15 @@ void initDefaults() {
manualExp = manualExpMin;
manualGain = manualGainMin;
- algoFixedGammaIDX = 1;
+ algoExternalGammaIDX = 0;
algoNSF1IDX = 1;
algoNSF2IDX = 1;
algoSharpeningIDX = 1;
algoThreeLinColorMapIDX = 1;
algoGICIDX = 1;
+ manualGammaModeIDX = 0;
+
params.set(params.KEY_VIDEO_STABILIZATION, params.FALSE);
params.set("vnf", params.FALSE);
params.setPreviewSize(preview_Array[previewSizeIDX]->width, preview_Array[previewSizeIDX]->height);
@@ -2437,12 +2521,13 @@ int menu_algo() {
if (print_menu) {
printf("\n\n== ALGO ENABLE/DISABLE MENU ============\n\n");
- printf(" a. Fixed Gamma: %s\n", algoFixedGamma[algoFixedGammaIDX]);
+ printf(" a. External Gamma: %s\n", algoExternalGamma[algoExternalGammaIDX]);
printf(" s. NSF1: %s\n", algoNSF1[algoNSF1IDX]);
printf(" d. NSF2: %s\n", algoNSF2[algoNSF2IDX]);
printf(" f. Sharpening: %s\n", algoSharpening[algoSharpeningIDX]);
printf(" g. Color Conversion: %s\n", algoThreeLinColorMap[algoThreeLinColorMapIDX]);
printf(" h. Green Inballance Correction: %s\n", algoGIC[algoGICIDX]);
+ printf(" j. Manual gamma table: %s\n", manualGammaModes[manualGammaModeIDX].desc);
printf("\n");
printf(" q. Return to main menu\n");
printf("\n");
@@ -2458,9 +2543,9 @@ int menu_algo() {
case 'a':
case 'A':
- algoFixedGammaIDX++;
- algoFixedGammaIDX %= ARRAY_SIZE(algoFixedGamma);
- params.set(KEY_ALGO_FIXED_GAMMA, (algoFixedGamma[algoFixedGammaIDX]));
+ algoExternalGammaIDX++;
+ algoExternalGammaIDX %= ARRAY_SIZE(algoExternalGamma);
+ params.set(KEY_ALGO_EXTERNAL_GAMMA, (algoExternalGamma[algoExternalGammaIDX]));
if ( hardwareActive )
camera->setParameters(params.flatten());
@@ -2522,6 +2607,29 @@ int menu_algo() {
break;
+ case 'j':
+ case 'J':
+ manualGammaModeIDX++;
+ manualGammaModeIDX %= ARRAY_SIZE(manualGammaModes);
+ if ( (NULL != manualGammaModes[manualGammaModeIDX].r) &&
+ (NULL != manualGammaModes[manualGammaModeIDX].g) &&
+ (NULL != manualGammaModes[manualGammaModeIDX].b) ) {
+ String8 Val;
+ Val.append(manualGammaModes[manualGammaModeIDX].r);
+ Val.append(",");
+ Val.append(manualGammaModes[manualGammaModeIDX].g);
+ Val.append(",");
+ Val.append(manualGammaModes[manualGammaModeIDX].b);
+ params.set(KEY_GAMMA_TABLE, Val);
+ } else {
+ params.remove(KEY_GAMMA_TABLE);
+ }
+
+ if ( hardwareActive )
+ camera->setParameters(params.flatten());
+
+ break;
+
case 'Q':
case 'q':
return -1;