summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camera/AppCallbackNotifier.cpp16
-rw-r--r--camera/Encoder_libjpeg.cpp11
-rw-r--r--camera/OMXCameraAdapter/OMXAlgo.cpp3
-rwxr-xr-xcamera/OMXCameraAdapter/OMXCameraAdapter.cpp1
-rw-r--r--camera/OMXCameraAdapter/OMXCapture.cpp2
-rwxr-xr-xcamera/inc/Encoder_libjpeg.h2
6 files changed, 27 insertions, 8 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 0240fb0..7a6054f 100644
--- a/camera/Encoder_libjpeg.cpp
+++ b/camera/Encoder_libjpeg.cpp
@@ -357,6 +357,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;
@@ -366,6 +367,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;
@@ -408,7 +411,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;
@@ -421,7 +424,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) {
@@ -429,9 +432,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 &params,
/// 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 ee818ae..aa32ede 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 9ba438c..38eb2f8 100644
--- a/camera/OMXCameraAdapter/OMXCapture.cpp
+++ b/camera/OMXCameraAdapter/OMXCapture.cpp
@@ -57,7 +57,7 @@ status_t OMXCameraAdapter::setParametersCapture(const CameraParameters &params,
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/inc/Encoder_libjpeg.h b/camera/inc/Encoder_libjpeg.h
index e3e9ac5..fef873f 100755
--- a/camera/inc/Encoder_libjpeg.h
+++ b/camera/inc/Encoder_libjpeg.h
@@ -97,6 +97,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;
};