summaryrefslogtreecommitdiff
authorbrian.zhu <brian.zhu@amlogic.com>2013-12-16 10:37:16 (GMT)
committer tao.dong <tao.dong@amlogic.com>2013-12-27 02:27:19 (GMT)
commit3450410dfcc025b18163361ce048783d2d76e609 (patch)
treeecfe18de4c46d2085107994a386f7c43ea8e8b54
parentb22446982033ec7c0142f0453cead8a0e323bf7b (diff)
downloadcamera-3450410dfcc025b18163361ce048783d2d76e609.zip
camera-3450410dfcc025b18163361ce048783d2d76e609.tar.gz
camera-3450410dfcc025b18163361ce048783d2d76e609.tar.bz2
PD #84534 change the memcpy for 1080p canvas mode camera
Diffstat
-rwxr-xr-xV4LCameraAdapter/V4LCameraAdapter.cpp10
-rwxr-xr-xutils/util.cpp38
-rwxr-xr-xutils/util.h3
3 files changed, 48 insertions, 3 deletions
diff --git a/V4LCameraAdapter/V4LCameraAdapter.cpp b/V4LCameraAdapter/V4LCameraAdapter.cpp
index 8ba4e43..ca1cb6e 100755
--- a/V4LCameraAdapter/V4LCameraAdapter.cpp
+++ b/V4LCameraAdapter/V4LCameraAdapter.cpp
@@ -1550,7 +1550,7 @@ int V4LCameraAdapter::previewThread()
fillThisBuffer((uint8_t*) mPreviewBufs.keyAt(mPreviewIdxs.valueFor(index)), CameraFrame::PREVIEW_FRAME_SYNC);
//CAMHAL_LOGEA("jpeg decode failed");
return -1;
- }
+ }
frame.mLength = width*height*3/2;
}else{
if(DEFAULT_PREVIEW_PIXEL_FORMAT == V4L2_PIX_FMT_YUYV){ // 422I
@@ -1569,13 +1569,17 @@ int V4LCameraAdapter::previewThread()
if ( CameraFrame::PIXEL_FMT_NV21 == mPixelFormat){
if (frame.mLength == mVideoInfo->buf.length) {
memcpy(dest,src,frame.mLength);
+ }else if((mVideoInfo->canvas_mode == true)&&(width == 1920)&&(height == 1080)){
+ nv21_memcpy_canvas1080 (dest, src, width, height);
}else{
nv21_memcpy_align32 (dest, src, width, height);
}
}else{
if (frame.mLength == mVideoInfo->buf.length) {
yv12_adjust_memcpy(dest,src,width,height);
- } else {
+ }else if((mVideoInfo->canvas_mode == true)&&(width == 1920)&&(height == 1080)){
+ yv12_memcpy_canvas1080 (dest, src, width, height);
+ }else{
yv12_memcpy_align32 (dest, src, width, height);
}
}
@@ -1915,7 +1919,7 @@ int V4LCameraAdapter::pictureThread()
memcpy (dest, src, frame.mLength);
}else{
rgb24_memcpy( dest, src, width, height);
- CAMHAL_LOGVB("w*h*3=%d, mLenght=%d\n", width*height*3, mVideoInfo->buf.length);
+ CAMHAL_LOGVB("w*h*3=%d, mLength=%d\n", width*height*3, mVideoInfo->buf.length);
}
#endif
}else if(DEFAULT_IMAGE_CAPTURE_PIXEL_FORMAT == V4L2_PIX_FMT_YUYV){ // 422I
diff --git a/utils/util.cpp b/utils/util.cpp
index 069392c..4af2fb5 100755
--- a/utils/util.cpp
+++ b/utils/util.cpp
@@ -383,3 +383,41 @@ void yv12_adjust_memcpy(unsigned char *dst, unsigned char *src, int width, int h
dst+=stride;
}
}
+
+void nv21_memcpy_canvas1080(unsigned char *dst, unsigned char *src, int width, int height)
+{
+ int h;
+ for (h=0; h<height; h++){
+ memcpy( dst, src, width);
+ dst += width;
+ src += width;
+ }
+ src+=width*8;
+ for (h=0; h<height/2; h++){
+ memcpy( dst, src, width);
+ dst += width;
+ src += width;
+ }
+}
+
+void yv12_memcpy_canvas1080(unsigned char *dst, unsigned char *src, int width, int height)
+{
+ int h;
+ for (h=0; h<height; h++){
+ memcpy( dst, src, width);
+ dst += width;
+ src += width;
+ }
+ src+=width*8;
+ for (h=0; h<height/2; h++){
+ memcpy( dst, src, width/2);
+ dst += width/2;
+ src += width/2;
+ }
+ src+=width*2;
+ for (h=0; h<height/2; h++){
+ memcpy( dst, src, width/2);
+ dst += width/2;
+ src += width/2;
+ }
+}
diff --git a/utils/util.h b/utils/util.h
index f0ab08c..b646beb 100755
--- a/utils/util.h
+++ b/utils/util.h
@@ -12,4 +12,7 @@ void yuyv_to_yv12(unsigned char *src, unsigned char *dst, int width, int height)
void rgb24_memcpy(unsigned char *dst, unsigned char *src, int width, int height);
void nv21_memcpy_align32(unsigned char *dst, unsigned char *src, int width, int height);
void yv12_memcpy_align32(unsigned char *dst, unsigned char *src, int width, int height);
+
+void nv21_memcpy_canvas1080(unsigned char *dst, unsigned char *src, int width, int height);
+void yv12_memcpy_canvas1080(unsigned char *dst, unsigned char *src, int width, int height);
#endif /* AML_CAMERA_HARDWARE_INCLUDE_*/