summaryrefslogtreecommitdiff
authorBrian Zhu <brian.zhu@amlogic.com>2016-10-28 14:30:56 (GMT)
committer Brian zhu <brian.zhu@amlogic.com>2016-10-28 14:34:26 (GMT)
commitab2d169dcfdad840a268655ec15907a33c19e4c3 (patch)
treec9eb46c47a532fec6f65606350a6024b8865f96b
parent36f76f1612b5fbdd00b15f3a2c88e113b6861e72 (diff)
downloadcamera-ab2d169dcfdad840a268655ec15907a33c19e4c3.zip
camera-ab2d169dcfdad840a268655ec15907a33c19e4c3.tar.gz
camera-ab2d169dcfdad840a268655ec15907a33c19e4c3.tar.bz2
PD#133846 Use jpeg_decode function for android N and ConvertMjpegToNV21 for earlier android version
Change-Id: I5fce66d3d0b120d03dcdae0eef7ae6a844d7c9fe
Diffstat
-rw-r--r--[-rwxr-xr-x]inc/mjpeg/defs.h2
-rw-r--r--v3/Android.mk5
-rw-r--r--v3/fake-pipeline2/Sensor.cpp12
3 files changed, 18 insertions, 1 deletions
diff --git a/inc/mjpeg/defs.h b/inc/mjpeg/defs.h
index b286a08..244e125 100755..100644
--- a/inc/mjpeg/defs.h
+++ b/inc/mjpeg/defs.h
@@ -40,7 +40,7 @@ typedef int8_t INT8;
typedef uint8_t UINT8;
typedef int16_t INT16;
typedef uint16_t UINT16;
-typedef int32_t INT32;
+//typedef int32_t INT32;
typedef uint32_t UINT32;
typedef int64_t INT64;
typedef uint64_t UINT64;
diff --git a/v3/Android.mk b/v3/Android.mk
index 335bbd3..8ab9013 100644
--- a/v3/Android.mk
+++ b/v3/Android.mk
@@ -67,6 +67,8 @@ LOCAL_SHARED_LIBRARIES += \
LOCAL_STATIC_LIBRARIES := \
libyuv_static \
+LOCAL_CFLAGS += -DANDROID_PLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
+
LOCAL_KK=0
ifeq ($(GPU_TYPE),t83x)
LOCAL_KK:=1
@@ -92,6 +94,7 @@ LOCAL_C_INCLUDES += external/jpeg \
$(LOCAL_PATH)/inc \
$(call include-path-for, camera) \
$(TOP)/external/expat/lib \
+ $(LOCAL_PATH)/../inc/mjpeg/ \
LOCAL_SRC_FILES := \
EmulatedCameraHal.cpp \
@@ -121,6 +124,8 @@ LOCAL_SRC_FILES := \
fake-pipeline2/camera_hw.cpp \
VendorTags.cpp \
LoadXml.cpp \
+ ../mjpeg/jpegdec.c \
+ ../mjpeg/colorspaces.c \
ifeq ($(TARGET_PRODUCT),vbox_x86)
LOCAL_MODULE := camera.vbox_x86
diff --git a/v3/fake-pipeline2/Sensor.cpp b/v3/fake-pipeline2/Sensor.cpp
index 1338a14..c8d4c56 100644
--- a/v3/fake-pipeline2/Sensor.cpp
+++ b/v3/fake-pipeline2/Sensor.cpp
@@ -41,6 +41,10 @@
#include <sys/time.h>
+extern "C"{
+ #include "jutils.h"
+}
+
#define ARRAY_SIZE(x) (sizeof((x))/sizeof(((x)[0])))
@@ -1980,9 +1984,13 @@ void Sensor::captureRGB(uint8_t *img, uint32_t gain, uint32_t stride) {
ALOGE("new buffer failed!\n");
return;
}
+#if ANDROID_PLATFORM_SDK_VERSION > 23
+ if (jpeg_decode(&tmp_buffer, src, width, height, V4L2_PIX_FMT_NV21) != 0) {
+#else
if (ConvertMjpegToNV21(src, vinfo->picture.buf.bytesused, tmp_buffer,
width, tmp_buffer + width * height, (width + 1) / 2, width,
height, width, height, libyuv::FOURCC_MJPG) != 0) {
+#endif
DBG_LOGA("Decode MJPEG frame failed\n");
putback_picture_frame(vinfo);
usleep(5000);
@@ -2240,9 +2248,13 @@ void Sensor::captureNV21(StreamBuffer b, uint32_t gain) {
uint32_t width = vinfo->preview.format.fmt.pix.width;
uint32_t height = vinfo->preview.format.fmt.pix.height;
memset(mTemp_buffer, 0 , width * height * 3/2);
+#if ANDROID_PLATFORM_SDK_VERSION > 23
+ if (jpeg_decode(&mTemp_buffer, src, width, height, V4L2_PIX_FMT_NV21) != 0) {
+#else
if (ConvertMjpegToNV21(src, vinfo->preview.buf.bytesused, mTemp_buffer,
width, mTemp_buffer + width * height, (width + 1) / 2, width,
height, width, height, libyuv::FOURCC_MJPG) != 0) {
+#endif
putback_frame(vinfo);
ALOGE("%s , %d , Decode MJPEG frame failed \n", __FUNCTION__ , __LINE__);
continue;