diff options
-rw-r--r-- | camera/AppCallbackNotifier.cpp | 16 | ||||
-rw-r--r-- | camera/Encoder_libjpeg.cpp | 11 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXAlgo.cpp | 3 | ||||
-rwxr-xr-x | camera/OMXCameraAdapter/OMXCameraAdapter.cpp | 1 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXCapture.cpp | 2 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXFocus.cpp | 11 | ||||
-rwxr-xr-x | camera/inc/Encoder_libjpeg.h | 2 |
7 files changed, 37 insertions, 9 deletions
diff --git a/camera/AppCallbackNotifier.cpp b/camera/AppCallbackNotifier.cpp index 2914307..bfdd671 100644 --- a/camera/AppCallbackNotifier.cpp +++ b/camera/AppCallbackNotifier.cpp @@ -844,16 +844,26 @@ void AppCallbackNotifier::notifyFrame() main_jpeg = (Encoder_libjpeg::params*) malloc(sizeof(Encoder_libjpeg::params)); + + // Video snapshot with LDCNSF on adds a few bytes start offset + // and a few bytes on every line. They must be skipped. + int rightCrop = frame->mAlignment/2 - frame->mWidth; + + CAMHAL_LOGDB("Video snapshot right crop = %d", rightCrop); + CAMHAL_LOGDB("Video snapshot offset = %d", frame->mOffset); + if (main_jpeg) { main_jpeg->src = (uint8_t*) frame->mBuffer; main_jpeg->src_size = frame->mLength; main_jpeg->dst = (uint8_t*) buf; main_jpeg->dst_size = frame->mLength; main_jpeg->quality = encode_quality; - main_jpeg->in_width = frame->mWidth; + main_jpeg->in_width = frame->mAlignment/2; // use stride here main_jpeg->in_height = frame->mHeight; - main_jpeg->out_width = frame->mWidth; + main_jpeg->out_width = frame->mAlignment/2; main_jpeg->out_height = frame->mHeight; + main_jpeg->right_crop = rightCrop; + main_jpeg->start_offset = frame->mOffset; main_jpeg->format = CameraParameters::PIXEL_FORMAT_YUV422I; } @@ -882,6 +892,8 @@ void AppCallbackNotifier::notifyFrame() tn_jpeg->in_height = height; tn_jpeg->out_width = tn_width; tn_jpeg->out_height = tn_height; + tn_jpeg->right_crop = 0; + tn_jpeg->start_offset = 0; tn_jpeg->format = CameraParameters::PIXEL_FORMAT_YUV420SP;; } diff --git a/camera/Encoder_libjpeg.cpp b/camera/Encoder_libjpeg.cpp index 40b237b..ae20edb 100644 --- a/camera/Encoder_libjpeg.cpp +++ b/camera/Encoder_libjpeg.cpp @@ -365,6 +365,7 @@ size_t Encoder_libjpeg::encode(params* input) { int out_width = 0, in_width = 0; int out_height = 0, in_height = 0; int bpp = 2; // for uyvy + int right_crop = 0, start_offset = 0; if (!input) { return 0; @@ -374,6 +375,8 @@ size_t Encoder_libjpeg::encode(params* input) { in_width = input->in_width; out_height = input->out_height; in_height = input->in_height; + right_crop = input->right_crop; + start_offset = input->start_offset; src = input->src; input->jpeg_size = 0; @@ -416,7 +419,7 @@ size_t Encoder_libjpeg::encode(params* input) { input->dst_size, src); cinfo.dest = &dest_mgr; - cinfo.image_width = out_width; + cinfo.image_width = out_width - right_crop; cinfo.image_height = out_height; cinfo.input_components = 3; cinfo.in_color_space = JCS_YCbCr; @@ -429,7 +432,7 @@ size_t Encoder_libjpeg::encode(params* input) { jpeg_start_compress(&cinfo, TRUE); row_tmp = (uint8_t*)malloc(out_width * 3); - row_src = src; + row_src = src + start_offset; row_uv = src + out_width * out_height * bpp; while ((cinfo.next_scanline < cinfo.image_height) && !mCancelEncoding) { @@ -437,9 +440,9 @@ size_t Encoder_libjpeg::encode(params* input) { // convert input yuv format to yuv444 if (strcmp(input->format, CameraParameters::PIXEL_FORMAT_YUV420SP) == 0) { - nv21_to_yuv(row_tmp, row_src, row_uv, out_width); + nv21_to_yuv(row_tmp, row_src, row_uv, out_width - right_crop); } else { - uyvy_to_yuv(row_tmp, (uint32_t*)row_src, out_width); + uyvy_to_yuv(row_tmp, (uint32_t*)row_src, out_width - right_crop); } row[0] = row_tmp; diff --git a/camera/OMXCameraAdapter/OMXAlgo.cpp b/camera/OMXCameraAdapter/OMXAlgo.cpp index c19e046..5924dde 100644 --- a/camera/OMXCameraAdapter/OMXAlgo.cpp +++ b/camera/OMXCameraAdapter/OMXAlgo.cpp @@ -83,7 +83,8 @@ status_t OMXCameraAdapter::setParametersAlgo(const CameraParameters ¶ms, /// Configure IPP, LDCNSF, GBCE and GLBCE only in HQ mode IPPMode ipp; - if((mCapMode == OMXCameraAdapter::HIGH_QUALITY) || (mCapMode == OMXCameraAdapter::HIGH_QUALITY_ZSL)) + if((mCapMode == OMXCameraAdapter::HIGH_QUALITY) || (mCapMode == OMXCameraAdapter::HIGH_QUALITY_ZSL) + || (mCapMode == OMXCameraAdapter::VIDEO_MODE) ) { if ( (valstr = params.get(TICameraParameters::KEY_IPP)) != NULL ) { diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp index c5dff6c..edb97f8 100755 --- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp +++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp @@ -864,6 +864,7 @@ status_t OMXCameraAdapter::setFormat(OMX_U32 port, OMXCameraPortParameters &port GOTO_EXIT_IF((eError!=OMX_ErrorNone), eError); portParams.mBufSize = portCheck.nBufferSize; + portParams.mStride = portCheck.format.image.nStride; if ( OMX_CAMERA_PORT_IMAGE_OUT_IMAGE == port ) { diff --git a/camera/OMXCameraAdapter/OMXCapture.cpp b/camera/OMXCameraAdapter/OMXCapture.cpp index 43d0725..3480619 100644 --- a/camera/OMXCameraAdapter/OMXCapture.cpp +++ b/camera/OMXCameraAdapter/OMXCapture.cpp @@ -57,7 +57,7 @@ status_t OMXCameraAdapter::setParametersCapture(const CameraParameters ¶ms, cap->mWidth = w; cap->mHeight = h; //TODO: Support more pixelformats - cap->mStride = 2; + //cap->mStride = 2; CAMHAL_LOGVB("Image: cap.mWidth = %d", (int)cap->mWidth); CAMHAL_LOGVB("Image: cap.mHeight = %d", (int)cap->mHeight); diff --git a/camera/OMXCameraAdapter/OMXFocus.cpp b/camera/OMXCameraAdapter/OMXFocus.cpp index 30ce3c1..b48cfec 100644 --- a/camera/OMXCameraAdapter/OMXFocus.cpp +++ b/camera/OMXCameraAdapter/OMXFocus.cpp @@ -153,7 +153,8 @@ status_t OMXCameraAdapter::doAutoFocus() } if ( (focusControl.eFocusControl == OMX_IMAGE_FocusControlAuto - && focusStatus.eFocusStatus == OMX_FocusStatusRequest) || + && (focusStatus.eFocusStatus == OMX_FocusStatusRequest + || focusStatus.eFocusStatus == OMX_FocusStatusUnableToReach) ) || (mParameters3A.Focus != (OMX_IMAGE_FOCUSCONTROLTYPE)OMX_IMAGE_FocusControlAuto) ) { OMX_INIT_STRUCT_PTR (&bOMX, OMX_CONFIG_BOOLEANTYPE); @@ -170,6 +171,14 @@ status_t OMXCameraAdapter::doAutoFocus() OMX_IndexConfigCommonFocusStatus, mDoAFSem); + // force AF, Ducati will take care of whether CAF + // or AF will be performed, depending on light conditions + if ( focusControl.eFocusControl == OMX_IMAGE_FocusControlAuto + && focusStatus.eFocusStatus == OMX_FocusStatusUnableToReach ) + { + focusControl.eFocusControl = OMX_IMAGE_FocusControlAutoLock; + } + if ( focusControl.eFocusControl != OMX_IMAGE_FocusControlAuto ) { eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp, diff --git a/camera/inc/Encoder_libjpeg.h b/camera/inc/Encoder_libjpeg.h index e4dfc0f..457a0dc 100755 --- a/camera/inc/Encoder_libjpeg.h +++ b/camera/inc/Encoder_libjpeg.h @@ -113,6 +113,8 @@ class Encoder_libjpeg : public Thread { int in_height; int out_width; int out_height; + int right_crop; + int start_offset; const char* format; size_t jpeg_size; }; |