string ofxRPiCameraVideoGrabber::currentStateToString() { stringstream info; info << "sharpness " << getSharpness() << endl; info << "contrast " << getContrast() << endl; info << "brightness " << getBrightness() << endl; info << "saturation " << getSaturation() << endl; info << "ISO " << getISO() << endl; info << "AutoISO " << getAutoISO() << endl; info << "DRE " << getDRE() << endl; info << "cropRectangle " << getCropRectangle() << endl; info << "zoomLevelNormalized " << getZoomLevelNormalized() << endl; info << "mirror " << getMirror() << endl; info << "rotation " << getRotation() << endl; info << "imageFilter " << getImageFilter() << endl; info << "exposurePreset " << getExposurePreset() << endl; info << "evCompensation " << getEvCompensation() << endl; info << "autoShutter " << getAutoShutter() << endl; info << "shutterSpeed " << getShutterSpeed() << endl; info << "meteringType " << getMeteringType() << endl; info << "SoftwareSaturationEnabled " << isSoftwareSaturationEnabled() << endl; info << "SoftwareSharpeningEnabled " << isSoftwareSharpeningEnabled() << endl; //OMXCameraSettings info << omxCameraSettings.toString() << endl; return info.str(); }
void QCamVesta::refreshPictureSettings() { QCamV4L2::refreshPictureSettings(); QCamV4L2::refreshPictureSettings(); // second call needed. if not some value are not properly restored. int tmp; emit(sharpnessChange(getSharpness())); emit(noiseRemovalChange(getNoiseRemoval())); emit(gainChange(getGain())); setProperty("CompressionWished",tmp=getCompression()); emit(compressionChange(tmp)); setProperty("Gama",tmp=getGama()); emit gamaChange(tmp); getWhiteBalance(); }
/* run in a thread (SDL overlay)*/ void *main_loop(void *data) { struct ALL_DATA *all_data = (struct ALL_DATA *) data; struct VidState *s = all_data->s; struct paRecordData *pdata = all_data->pdata; struct GLOBAL *global = all_data->global; struct focusData *AFdata = all_data->AFdata; struct vdIn *videoIn = all_data->videoIn; struct particle* particles = NULL; //for the particles video effect SDL_Event event; /*the main SDL surface*/ SDL_Surface *pscreen = NULL; SDL_Overlay *overlay = NULL; SDL_Rect drect; int width = global->width; int height = global->height; int format = global->format; SAMPLE vuPeak[2]; // The maximum vuLevel seen recently int vuPeakFreeze[2]; // The vuPeak values will be frozen for this many frames. vuPeak[0] = vuPeak[1] = 0; vuPeakFreeze[0] = vuPeakFreeze[1] = 0; BYTE *p = NULL; Control *focus_control = NULL; int last_focus = 0; if (global->AFcontrol) { focus_control = get_ctrl_by_id(s->control_list, AFdata->id); get_ctrl(videoIn->fd, s->control_list, AFdata->id, all_data); last_focus = focus_control->value; /*make sure we wait for focus to settle on first check*/ if (last_focus < 0) last_focus = AFdata->f_max; } gboolean capVid = FALSE; gboolean signalquit = FALSE; /*------------------------------ SDL init video ---------------------*/ if(!global->no_display) { overlay = video_init(data, &(pscreen)); if(overlay == NULL) { g_print("FATAL: Couldn't create yuv overlay - please disable hardware accelaration\n"); signalquit = TRUE; /*exit video thread*/ } else { p = (unsigned char *) overlay->pixels[0]; drect.x = 0; drect.y = 0; drect.w = pscreen->w; drect.h = pscreen->h; } } while (!signalquit) { __LOCK_MUTEX(__VMUTEX); capVid = videoIn->capVid; signalquit = videoIn->signalquit; __UNLOCK_MUTEX(__VMUTEX); /*-------------------------- Grab Frame ----------------------------------*/ if (uvcGrab(videoIn, format, width, height, &global->fps, &global->fps_num) < 0) { g_printerr("Error grabbing image \n"); continue; } else { if(!videoIn->timestamp) { global->skip_n++; //skip this frame } if(capVid) { if(global->framecount < 1) { /*reset video start time to first frame capture time */ global->Vidstarttime = videoIn->timestamp; /** set current time for audio ts(0) reference (MONOTONIC) * only used if we have no audio capture before video */ __LOCK_MUTEX(__AMUTEX); pdata->ts_ref = ns_time_monotonic(); __UNLOCK_MUTEX(__AMUTEX); //printf("video ts ref: %llu audio ts_ ref: %llu\n",global->Vidstarttime, pdata->ts_ref); global->v_ts = 0; } else { global->v_ts = videoIn->timestamp - global->Vidstarttime; /*always use the last frame time stamp for video stop time*/ global->Vidstoptime = videoIn->timestamp; } } if (global->FpsCount && !global->no_display) {/* sets fps count in window title bar */ global->frmCount++; if (global->DispFps>0) { /*set every 2 sec*/ g_snprintf(global->WVcaption,24,"GUVCVideo - %3.2f fps",global->DispFps); SDL_WM_SetCaption(global->WVcaption, NULL); global->frmCount=0;/*resets*/ global->DispFps=0; } } /*---------------- autofocus control ------------------*/ if (global->AFcontrol && (global->autofocus || AFdata->setFocus)) { /*AFdata = NULL if no focus control*/ if (AFdata->focus < 0) { /*starting autofocus*/ AFdata->focus = AFdata->left; /*start left*/ focus_control->value = AFdata->focus; if (set_ctrl (videoIn->fd, s->control_list, AFdata->id) != 0) g_printerr("ERROR: couldn't set focus to %d\n", AFdata->focus); /*number of frames until focus is stable*/ /*1.4 ms focus time - every 1 step*/ AFdata->focus_wait = (int) abs(AFdata->focus-last_focus)*1.4/(1000/global->fps)+1; last_focus = AFdata->focus; } else { if (AFdata->focus_wait == 0) { AFdata->sharpness=getSharpness (videoIn->framebuffer, width, height, 5); if (global->debug) g_print("sharp=%d focus_sharp=%d foc=%d right=%d left=%d ind=%d flag=%d\n", AFdata->sharpness,AFdata->focus_sharpness, AFdata->focus, AFdata->right, AFdata->left, AFdata->ind, AFdata->flag); AFdata->focus=getFocusVal (AFdata); if ((AFdata->focus != last_focus)) { focus_control->value = AFdata->focus; if (set_ctrl (videoIn->fd, s->control_list, AFdata->id) != 0) g_printerr("ERROR: couldn't set focus to %d\n", AFdata->focus); /*number of frames until focus is stable*/ /*1.4 ms focus time - every 1 step*/ AFdata->focus_wait = (int) abs(AFdata->focus-last_focus)*1.4/(1000/global->fps)+1; } last_focus = AFdata->focus; } else { AFdata->focus_wait--; if (global->debug) g_print("Wait Frame: %d\n",AFdata->focus_wait); } } } } /*------------------------- Filter Frame ---------------------------------*/ __LOCK_MUTEX(__GMUTEX); if(global->Frame_Flags>0) { if((global->Frame_Flags & YUV_PARTICLES)==YUV_PARTICLES) particles = particles_effect(videoIn->framebuffer, width, height, 20, 4, particles); if((global->Frame_Flags & YUV_MIRROR)==YUV_MIRROR) yuyv_mirror(videoIn->framebuffer, width, height); if((global->Frame_Flags & YUV_UPTURN)==YUV_UPTURN) yuyv_upturn(videoIn->framebuffer, width, height); if((global->Frame_Flags & YUV_NEGATE)==YUV_NEGATE) yuyv_negative (videoIn->framebuffer, width, height); if((global->Frame_Flags & YUV_MONOCR)==YUV_MONOCR) yuyv_monochrome (videoIn->framebuffer, width, height); if((global->Frame_Flags & YUV_PIECES)==YUV_PIECES) pieces (videoIn->framebuffer, width, height, 16 ); } __UNLOCK_MUTEX(__GMUTEX); /*-------------------------capture Image----------------------------------*/ if (videoIn->capImage) { /* * format and resolution can change(enabled) while capturing the frame * but you would need to be speedy gonzalez to press two buttons * at almost the same time :D */ int ret = 0; if((ret=store_picture(all_data)) < 0) g_printerr("saved image to:%s ...Failed \n",videoIn->ImageFName); else if (!ret && global->debug) g_print("saved image to:%s ...OK \n",videoIn->ImageFName); videoIn->capImage=FALSE; } /*---------------------------capture Video---------------------------------*/ if (capVid && !(global->skip_n)) { __LOCK_MUTEX(__VMUTEX); if(videoIn->VidCapStop) videoIn->VidCapStop = FALSE; __UNLOCK_MUTEX(__VMUTEX); int res=0; /* format and resolution don't change(disabled) while capturing video * store_video_frame may sleep if needed to avoid buffer overrun */ if((res=store_video_frame(all_data))<0) g_printerr("WARNING: droped frame (%i)\n",res); } /*video and audio capture have stopped */ else { __LOCK_MUTEX(__VMUTEX); if(!(videoIn->VidCapStop)) videoIn->VidCapStop=TRUE; __UNLOCK_MUTEX(__VMUTEX); } /* decrease skip frame count */ if (global->skip_n > 0) { if (global->debug && capVid) g_print("skiping frame %d...\n", global->skip_n); global->skip_n--; } __LOCK_MUTEX( __AMUTEX ); if (global->Sound_enable && capVid) pdata->skip_n = global->skip_n; __UNLOCK_MUTEX( __AMUTEX ); /*------------------------- Display Frame --------------------------------*/ if(!global->no_display) { if (global->osdFlags && pdata->audio_buff[0]) { draw_vu_meter(width, height, vuPeak, vuPeakFreeze, data); } SDL_LockYUVOverlay(overlay); memcpy(p, videoIn->framebuffer, width * height * 2); SDL_UnlockYUVOverlay(overlay); SDL_DisplayYUVOverlay(overlay, &drect); /*------------------------- Read Key events ------------------------------*/ /* Poll for events */ while( SDL_PollEvent(&event) ) { //printf("event type:%i event key:%i\n", event.type, event.key.keysym.scancode); if(event.type==SDL_KEYDOWN) { if (videoIn->PanTilt) { switch( event.key.keysym.sym ) { /* Keyboard event */ /* Pass the event data onto PrintKeyInfo() */ case SDLK_DOWN: /*Tilt Down*/ uvcPanTilt (videoIn->fd, s->control_list, 0, 1); break; case SDLK_UP: /*Tilt UP*/ uvcPanTilt (videoIn->fd, s->control_list, 0, -1); break; case SDLK_LEFT: /*Pan Left*/ uvcPanTilt (videoIn->fd, s->control_list, 1, 1); break; case SDLK_RIGHT: /*Pan Right*/ uvcPanTilt (videoIn->fd, s->control_list, 1, -1); break; default: break; } } switch( event.key.keysym.scancode ) { case 220: /*webcam button*/ //gdk_threads_enter(); if (all_data->global->default_action == 0) g_main_context_invoke(NULL, image_capture_callback, (gpointer) all_data); else g_main_context_invoke(NULL, video_capture_callback, (gpointer) all_data); break; } switch( event.key.keysym.sym ) { case SDLK_q: //shutDown g_timeout_add(200, shutd_timer, all_data); g_print("q pressed - Quiting...\n"); break; case SDLK_SPACE: { if(global->AFcontrol > 0) setfocus_clicked(NULL, all_data); } break; case SDLK_i: g_main_context_invoke(NULL, image_capture_callback, (gpointer) all_data); break; case SDLK_v: g_main_context_invoke(NULL, video_capture_callback, (gpointer) all_data); break; default: break; } } if(event.type==SDL_VIDEORESIZE) { pscreen = SDL_SetVideoMode(event.resize.w, event.resize.h, global->bpp, SDL_VIDEO_Flags); drect.w = event.resize.w; drect.h = event.resize.h; } if(event.type==SDL_QUIT) { //shutDown g_timeout_add(200, shutd_timer, all_data); } } } /* if set make the thread sleep - default no sleep (full throttle)*/ if(global->vid_sleep) sleep_ms(global->vid_sleep); /*------------------------------------------*/ /* restart video (new resolution/format) */ /*------------------------------------------*/ if (global->change_res) { g_print("setting new resolution (%d x %d)\n", global->width, global->height); /*clean up */ if(particles) g_free(particles); particles = NULL; if (global->debug) g_print("cleaning buffer allocations\n"); fflush(NULL);//flush all output buffers if(!global->no_display) { SDL_FreeYUVOverlay(overlay); overlay = NULL; } /*init device*/ restart_v4l2(videoIn, global); /*set new resolution for video thread*/ width = global->width; height = global->height; format = global->format; /* restart SDL with new values*/ if(!global->no_display) { overlay = video_init(data, &(pscreen)); if(overlay == NULL) { g_print("FATAL: Couldn't create yuv overlay - please disable hardware accelaration\n"); signalquit = TRUE; /*exit video thread*/ } else { if (global->debug) g_print("yuv overlay created (%ix%i).\n", overlay->w, overlay->h); p = (unsigned char *) overlay->pixels[0]; drect.x = 0; drect.y = 0; drect.w = pscreen->w; drect.h = pscreen->h; global->change_res = FALSE; } } else global->change_res = FALSE; } }/*loop end*/ __LOCK_MUTEX(__VMUTEX); capVid = videoIn->capVid; __UNLOCK_MUTEX(__VMUTEX); /*check if thread exited while in Video capture mode*/ if (capVid) { /*stop capture*/ if (global->debug) g_print("stoping Video capture\n"); //global->Vidstoptime = ns_time_monotonic(); /*this is set in IO thread*/ videoIn->VidCapStop=TRUE; capVid = FALSE; __LOCK_MUTEX(__VMUTEX); videoIn->capVid = capVid; __UNLOCK_MUTEX(__VMUTEX); __LOCK_MUTEX(__AMUTEX); pdata->capVid = capVid; __UNLOCK_MUTEX(__AMUTEX); /*join IO thread*/ if (global->debug) g_print("Shuting Down IO Thread\n"); __THREAD_JOIN( all_data->IO_thread ); if (global->debug) g_print("IO Thread finished\n"); } if (global->debug) g_print("Thread terminated...\n"); p = NULL; if(particles) g_free(particles); particles=NULL; if (global->debug) g_print("cleaning Thread allocations: 100%%\n"); fflush(NULL);//flush all output buffers if(!global->no_display) { if(overlay) SDL_FreeYUVOverlay(overlay); //SDL_FreeSurface(pscreen); SDL_Quit(); } if (global->debug) g_print("Video thread completed\n"); global = NULL; AFdata = NULL; videoIn = NULL; return ((void *) 0); }
//[20091123 exif Ratnesh void CameraHal::CreateExif(unsigned char* pInThumbnailData,int Inthumbsize,unsigned char* pOutExifBuf,int& OutExifSize,int flag) { int w =0, h = 0; int orientationValue = getOrientation(); HAL_PRINT("CreateExif orientationValue = %d \n", orientationValue); ExifCreator* mExifCreator = new ExifCreator(); unsigned int ExifSize = 0; ExifInfoStructure ExifInfo; char ver_date[5] = {NULL,}; unsigned short tempISO = 0; struct v4l2_exif exifobj; // To read values from driver if(mCameraIndex==MAIN_CAMERA) { getExifInfoFromDriver(&exifobj); } memset(&ExifInfo, NULL, sizeof(ExifInfoStructure)); strcpy( (char *)&ExifInfo.maker, "SAMSUNG"); strcpy( (char *)&ExifInfo.model, "GT-I9003"); mParameters.getPreviewSize(&w, &h); mParameters.getPictureSize((int*)&ExifInfo.imageWidth , (int*)&ExifInfo.imageHeight); mParameters.getPictureSize((int*)&ExifInfo.pixelXDimension, (int*)&ExifInfo.pixelYDimension); struct tm *t = NULL; time_t nTime; time(&nTime); t = localtime(&nTime); if(t != NULL) { sprintf((char *)&ExifInfo.dateTimeOriginal, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); sprintf((char *)&ExifInfo.dateTimeDigitized, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); sprintf((char *)&ExifInfo.dateTime, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); } if(mCameraIndex==MAIN_CAMERA) { int cam_ver = GetCamera_version(); ExifInfo.Camversion[0] = (cam_ver & 0xFF); ExifInfo.Camversion[1] = ((cam_ver >> 8) & 0xFF); ExifInfo.Camversion[2] = ((cam_ver >> 16) & 0xFF); ExifInfo.Camversion[3] = ((cam_ver >> 24) & 0xFF); HAL_PRINT("CreateExif GetCamera_version =[%x][%x][%x][%x]\n", ExifInfo.Camversion[2],ExifInfo.Camversion[3],ExifInfo.Camversion[0],ExifInfo.Camversion[1]); sprintf((char *)&ExifInfo.software, "fw %02d.%02d prm %02d.%02d", ExifInfo.Camversion[2],ExifInfo.Camversion[3],ExifInfo.Camversion[0],ExifInfo.Camversion[1]); if(mThumbnailWidth > 0 && mThumbnailHeight > 0) { ExifInfo.hasThumbnail = true; ExifInfo.thumbStream = pInThumbnailData; ExifInfo.thumbSize = Inthumbsize; ExifInfo.thumbImageWidth = mThumbnailWidth; ExifInfo.thumbImageHeight = mThumbnailHeight; } else { ExifInfo.hasThumbnail = false; } ExifInfo.exposureProgram = 3; ExifInfo.exposureMode = 0; ExifInfo.contrast = convertToExifLMH(getContrast(), 2); ExifInfo.fNumber.numerator = 26; ExifInfo.fNumber.denominator = 10; ExifInfo.aperture.numerator = 26; ExifInfo.aperture.denominator = 10; ExifInfo.maxAperture.numerator = 26; ExifInfo.maxAperture.denominator = 10; ExifInfo.focalLength.numerator = 3430; ExifInfo.focalLength.denominator = 1000; //[ 2010 05 01 exif ExifInfo.shutterSpeed.numerator = exifobj.TV_Value; ExifInfo.shutterSpeed.denominator = 100; ExifInfo.exposureTime.numerator = 1; ExifInfo.exposureTime.denominator = (unsigned int)pow(2.0, ((double)exifobj.TV_Value/100.0)); //] ExifInfo.brightness.numerator = 5; ExifInfo.brightness.denominator = 9; ExifInfo.iso = 1; ExifInfo.flash = 0; // default value // Flash // bit 0 -whether the flash fired // bit 1,2 -status of returned light // bit 3,4 - indicating the camera's flash mode // bit 5 -presence of a flash function // bit 6 - red-eye mode // refer to flash_mode[] at CameraHal.cpp // off = 1 // on = 2 // auto = 3 // Todo : Need to implement how HAL can recognize existance of flash // if( ! isFlashExist ) // pseudo code // ExifInfo.flash = 32; // bit 5 - No flash function. // else { LOGD("createExif - flashmode = %d flash result = %d", mPreviousFlashMode, ExifInfo.flash); // bit 0 ExifInfo.flash = ExifInfo.flash | exifobj.flash; // bit 3,4 if(mPreviousFlashMode == 3) // Flashmode auto ExifInfo.flash = ExifInfo.flash |24; // bit 6 // Todo : Need to implement about red-eye // if(mPreviousFlashMode == ??) // Flashmode red-eye // ExifInfo.flash = ExifInfo.flash | 64; } HAL_PRINT("Main Orientation = %d\n",orientationValue); switch(orientationValue) { case 0: ExifInfo.orientation = 1 ; break; case 90: ExifInfo.orientation = 6 ; break; case 180: ExifInfo.orientation = 3 ; break; case 270: ExifInfo.orientation = 8 ; break; default: ExifInfo.orientation = 1 ; break; } //[ 2010 05 01 exif double calIsoValue = 0; calIsoValue = pow(2.0,((double)exifobj.SV_Value/100.0))*3.125; //] if(calIsoValue < 8.909) { tempISO = 0; } else if(calIsoValue >=8.909 && calIsoValue < 11.22) { tempISO = 10; } else if(calIsoValue >=11.22 && calIsoValue < 14.14) { tempISO = 12; } else if(calIsoValue >=14.14 && calIsoValue < 17.82) { tempISO = 16; } else if(calIsoValue >=17.82 && calIsoValue < 22.45) { tempISO = 20; } else if(calIsoValue >=22.45 && calIsoValue < 28.28) { tempISO = 25; } else if(calIsoValue >=28.28 && calIsoValue < 35.64) { tempISO = 32; } else if(calIsoValue >=35.64 && calIsoValue < 44.90) { tempISO = 40; } else if(calIsoValue >=44.90 && calIsoValue < 56.57) { tempISO = 50; } else if(calIsoValue >=56.57 && calIsoValue < 71.27) { tempISO = 64; } else if(calIsoValue >=71.27 && calIsoValue < 89.09) { tempISO = 80; } else if(calIsoValue >=89.09 && calIsoValue < 112.2) { tempISO = 100; } else if(calIsoValue >=112.2 && calIsoValue < 141.4) { tempISO = 125; } else if(calIsoValue >=141.4 && calIsoValue < 178.2) { tempISO = 160; } else if(calIsoValue >=178.2 && calIsoValue < 224.5) { tempISO = 200; } else if(calIsoValue >=224.5 && calIsoValue < 282.8) { tempISO = 250; } else if(calIsoValue >=282.8 && calIsoValue < 356.4) { tempISO = 320; } else if(calIsoValue >=356.4 && calIsoValue < 449.0) { tempISO = 400; } else if(calIsoValue >=449.0 && calIsoValue < 565.7) { tempISO = 500; } else if(calIsoValue >=565.7 && calIsoValue < 712.7) { tempISO = 640; } else if(calIsoValue >=712.7 && calIsoValue < 890.9) { tempISO = 800; } else if(calIsoValue >=890.9 && calIsoValue < 1122) { tempISO = 1000; } else if(calIsoValue >=1122 && calIsoValue < 1414) { tempISO = 1250; } else if(calIsoValue >=1414 && calIsoValue < 1782) { tempISO = 160; } else if(calIsoValue >=1782 && calIsoValue < 2245) { tempISO = 2000; } else if(calIsoValue >=2245 && calIsoValue < 2828) { tempISO = 2500; } else if(calIsoValue >=2828 && calIsoValue < 3564) { tempISO = 3200; } else if(calIsoValue >=3564 && calIsoValue < 4490) { tempISO = 4000; } else if(calIsoValue >=4490 && calIsoValue < 5657) { tempISO = 5000; } else if(calIsoValue >=5657 && calIsoValue < 7127) { tempISO = 6400; } else { tempISO = 8000; } if(mPreviousSceneMode <= 1) { ExifInfo.meteringMode = mPreviousMetering; if(mPreviousWB <= 1) { ExifInfo.whiteBalance = 0; } else { ExifInfo.whiteBalance = 1; } ExifInfo.saturation = convertToExifLMH(getSaturation(), 2); ExifInfo.sharpness = convertToExifLMH(getSharpness(), 2); switch(mPreviousISO) { case 2: ExifInfo.isoSpeedRating = 50; break; case 3: ExifInfo.isoSpeedRating = 100; break; case 4: ExifInfo.isoSpeedRating = 200; break; case 5: ExifInfo.isoSpeedRating = 400; break; case 6: ExifInfo.isoSpeedRating = 800; break; default: ExifInfo.isoSpeedRating = tempISO; break; } switch(getBrightness()) { case 0: ExifInfo.exposureBias.numerator = -20; break; case 1: ExifInfo.exposureBias.numerator = -15; break; case 2: ExifInfo.exposureBias.numerator = -10; break; case 3: ExifInfo.exposureBias.numerator = -5; break; case 4: ExifInfo.exposureBias.numerator = 0; break; case 5: ExifInfo.exposureBias.numerator = 5; break; case 6: ExifInfo.exposureBias.numerator = 10; break; case 7: ExifInfo.exposureBias.numerator = 15; break; case 8: ExifInfo.exposureBias.numerator = 20; break; default: ExifInfo.exposureBias.numerator = 0; break; } ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 0; } else { switch(mPreviousSceneMode) { case 3://sunset ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 1; ExifInfo.saturation = 0; ExifInfo.sharpness = 0; ExifInfo.isoSpeedRating = tempISO; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 4; break; case 4://dawn ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 1; ExifInfo.saturation = 0; ExifInfo.sharpness = 0; ExifInfo.isoSpeedRating = tempISO; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 4; break; case 5://candlelight ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 1; ExifInfo.saturation = 0; ExifInfo.sharpness = 0; ExifInfo.isoSpeedRating = tempISO; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 4; break; case 6://beach & snow ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 0; ExifInfo.saturation = 2; ExifInfo.sharpness = 0; ExifInfo.isoSpeedRating = 50; ExifInfo.exposureBias.numerator = 10; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 1; break; case 7://againstlight ExifInfo.whiteBalance = 0; ExifInfo.saturation = 0; ExifInfo.sharpness = 0; ExifInfo.isoSpeedRating = tempISO; if(mPreviousFlashMode <= 1) { ExifInfo.meteringMode = 3; } else { ExifInfo.meteringMode = 2; } ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 4; break; case 8://text ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 0; ExifInfo.saturation = 0; ExifInfo.sharpness = 2; ExifInfo.isoSpeedRating = tempISO; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 4; break; case 9://night ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 0; ExifInfo.saturation = 0; ExifInfo.sharpness = 0; ExifInfo.isoSpeedRating = tempISO; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 3; break; case 10://landscape ExifInfo.meteringMode = 5; ExifInfo.whiteBalance = 0; ExifInfo.saturation = 2; ExifInfo.sharpness = 2; ExifInfo.isoSpeedRating = tempISO; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 1; break; case 11://fireworks ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 0; ExifInfo.saturation = 0; ExifInfo.sharpness = 0; ExifInfo.isoSpeedRating = 50; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 4; break; case 12://portrait ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 0; ExifInfo.saturation = 0; ExifInfo.sharpness = 1; ExifInfo.isoSpeedRating = tempISO; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 2; break; case 13://fallcolor ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 0; ExifInfo.saturation = 2; ExifInfo.sharpness = 0; ExifInfo.isoSpeedRating = tempISO; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 4; break; case 14://indoors ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 0; ExifInfo.saturation = 2; ExifInfo.sharpness = 0; ExifInfo.isoSpeedRating = 200; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 4; break; case 15://sports ExifInfo.meteringMode = 2; ExifInfo.whiteBalance = 0; ExifInfo.saturation = 0; ExifInfo.sharpness = 0; ExifInfo.isoSpeedRating = tempISO; ExifInfo.exposureBias.numerator = 0; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = 4; break; } } }
void QCamVesta::setNoiseRemoval(int val) { if (-1 == ioctl(device_, VIDIOCPWCSDYNNOISE, &val)) { perror("VIDIOCPWCGDYNNOISE"); } emit(sharpnessChange(getSharpness())); }
//[20091123 exif Ratnesh void CameraHal::CreateExif(unsigned char* pInThumbnailData, int Inthumbsize, unsigned char* pOutExifBuf, int& OutExifSize, int flag) { // 0 90 180 270 360 const int MAIN_ORIENTATION[] = { 1, 6, 3, 8, 1}; const int FRONT_ORIENTATION[] = { 3, 6, 1, 8, 3}; ExifCreator* mExifCreator = new ExifCreator(); unsigned int ExifSize = 0; ExifInfoStructure ExifInfo; char ver_date[5] = {NULL,}; unsigned short tempISO = 0; struct v4l2_exif exifobj; int orientationValue = getOrientation(); LOGV("CreateExif orientationValue = %d \n", orientationValue); memset(&ExifInfo, NULL, sizeof(ExifInfoStructure)); strcpy( (char *)&ExifInfo.maker, "SAMSUNG"); mParameters.getPictureSize((int*)&ExifInfo.imageWidth , (int*)&ExifInfo.imageHeight); mParameters.getPictureSize((int*)&ExifInfo.pixelXDimension, (int*)&ExifInfo.pixelYDimension); struct tm *t = NULL; time_t nTime; time(&nTime); t = localtime(&nTime); if(t != NULL) { sprintf((char *)&ExifInfo.dateTimeOriginal, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); sprintf((char *)&ExifInfo.dateTimeDigitized, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); sprintf((char *)&ExifInfo.dateTime, "%4d:%02d:%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); } if(mCameraIndex==MAIN_CAMERA) { if(orientationValue<=360) ExifInfo.orientation = MAIN_ORIENTATION[orientationValue/90]; else ExifInfo.orientation = 0; getExifInfoFromDriver(&exifobj); strcpy( (char *)&ExifInfo.model, "GT-I8320 M4MO"); int cam_ver = GetCamera_version(); ExifInfo.Camversion[0] = (cam_ver & 0xFF); ExifInfo.Camversion[1] = ((cam_ver >> 8) & 0xFF); //HAL_PRINT("CreateExif GetCamera_version =[%x][%x][%x][%x]\n", ExifInfo.Camversion[2],ExifInfo.Camversion[3],ExifInfo.Camversion[0],ExifInfo.Camversion[1]); sprintf((char *)&ExifInfo.software, "%02X%02X", ExifInfo.Camversion[1], ExifInfo.Camversion[0]); // TODO: get thumbnail offset of m4mo jpeg data // if(mThumbnailWidth > 0 && mThumbnailHeight > 0) // { // ExifInfo.hasThumbnail = true; // ExifInfo.thumbStream = pInThumbnailData; // ExifInfo.thumbSize = Inthumbsize; // ExifInfo.thumbImageWidth = mThumbnailWidth; // ExifInfo.thumbImageHeight = mThumbnailHeight; // } // else { ExifInfo.hasThumbnail = false; } ExifInfo.exposureProgram = 3; ExifInfo.exposureMode = 0; ExifInfo.contrast = convertToExifLMH(getContrast(), 2); ExifInfo.fNumber.numerator = 26; ExifInfo.fNumber.denominator = 10; ExifInfo.aperture.numerator = 26; ExifInfo.aperture.denominator = 10; ExifInfo.maxAperture.numerator = 26; ExifInfo.maxAperture.denominator = 10; ExifInfo.focalLength.numerator = 4610; ExifInfo.focalLength.denominator = 1000; //[ 2010 05 01 exif ExifInfo.shutterSpeed.numerator = exifobj.shutter_speed_numerator; ExifInfo.shutterSpeed.denominator = exifobj.shutter_speed_denominator; ExifInfo.exposureTime.numerator = exifobj.exposure_time_numerator; ExifInfo.exposureTime.denominator = exifobj.exposure_time_denominator; //] ExifInfo.brightness.numerator = exifobj.brigtness_numerator; ExifInfo.brightness.denominator = exifobj.brightness_denominator; ExifInfo.iso = 1; ExifInfo.isoSpeedRating = roundIso(exifobj.iso); // Flash // bit 0 -whether the flash fired // bit 1,2 -status of returned light // bit 3,4 - indicating the camera's flash mode // bit 5 -presence of a flash function // bit 6 - red-eye mode // refer to flash_mode[] at CameraHal.cpp // off = 1 // on = 2 // auto = 3 ExifInfo.flash = exifobj.flash | (mPreviousFlashMode == 3)?(3<<4):0; // default value ExifInfo.whiteBalance = (mPreviousWB <= 1)?0:1; ExifInfo.meteringMode = mPreviousMetering; ExifInfo.saturation = convertToExifLMH(getSaturation(), 2); ExifInfo.sharpness = convertToExifLMH(getSharpness(), 2); ExifInfo.exposureBias.numerator = (getBrightness()-4)*5; ExifInfo.exposureBias.denominator = 10; ExifInfo.sceneCaptureType = mPreviousSceneMode; // ExifInfo.meteringMode = 2; // ExifInfo.whiteBalance = 1; // ExifInfo.saturation = 0; // ExifInfo.sharpness = 0; // ExifInfo.isoSpeedRating = tempISO; // ExifInfo.exposureBias.numerator = 0; // ExifInfo.exposureBias.denominator = 10; // ExifInfo.sceneCaptureType = 4; } else // VGA Camera { if(orientationValue<=360)