diff --git a/libcamera/QualcommCameraHardware.cpp b/libcamera/QualcommCameraHardware.cpp index 15cd54b..58eda93 100644 --- a/libcamera/QualcommCameraHardware.cpp +++ b/libcamera/QualcommCameraHardware.cpp @@ -32,6 +32,8 @@ #include #include "raw2jpeg.h" +// #define iLog(fmt, args...) LOGD(fmt, ##args) + #define LIKELY(exp) __builtin_expect(!!(exp), 1) #define UNLIKELY(exp) __builtin_expect(!!(exp), 0) @@ -850,19 +852,19 @@ void QualcommCameraHardware::runJpegEncodeThread(void *data) npt = NULL ; } - writeExif( mRawHeap->mHeap->base(), mJpegHeap->mHeap->base(), mJpegSize, &mJpegSize, rotation , npt ); + // writeExif( mRawHeap->mHeap->base(), mJpegHeap->mHeap->base(), mJpegSize, &mJpegSize, rotation , npt ); int jpeg_quality = mParameters.getInt("jpeg-quality"); - LOGV("Kalim: Inicio conversion a JPEG ----------------------------------------------------------------------------------------------"); - LOGV("KalimochoAz jpeg convert, current jpeg main img quality =%d", jpeg_quality); - LOGV("KalimochoAz jpeg convert, current jpeg main img Height =%d", mRawHeight); - LOGV("KalimochoAz jpeg convert, current jpeg main img Width =%d", mRawWidth); - if( yuv420_save2jpeg((unsigned char*) mJpegHeap->mHeap->base(), mRawHeap->mHeap->base(), mRawWidth, mRawHeight, jpeg_quality) ) + LOGD("Kalim: Inicio conversion a JPEG ----------------------------------------------------------------------------------------------"); + LOGD("KalimochoAz jpeg convert, current jpeg main img quality =%d", jpeg_quality); + LOGD("KalimochoAz jpeg convert, current jpeg main img Height =%d", mRawHeight); + LOGD("KalimochoAz jpeg convert, current jpeg main img Width =%d", mRawWidth); + if( yuv420_save2jpeg((unsigned char*) mJpegHeap->mHeap->base(), mRawHeap->mHeap->base(), mRawWidth, mRawHeight, jpeg_quality, &mJpegSize) ) LOGV("Kalim: JpegConvetida Correctamente ***********************************************************************************************************"); else LOGV("Kalim: Fallo de conversion a JPEG xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); - + LOGD("KalimochoAz jpeg convert, current jpeg main img jpegSize =%d ........", mJpegSize); receiveJpegPicture(); } @@ -1606,9 +1608,9 @@ CameraParameters QualcommCameraHardware::getParameters() const extern "C" sp openCameraHardware() { - LOGV("*-------------------------------------------------------------------------------------*"); - LOGV("[M a@openCameraHardware: call createInstance v: %s",version); - LOGV("*-------------------------------------------------------------------------------------*"); + LOGD("*-------------------------------------------------------------------------------------*"); + LOGD("[M a@openCameraHardware: call createInstance v: %s",version); + LOGD("*-------------------------------------------------------------------------------------*"); return QualcommCameraHardware::createInstance(); } diff --git a/libcamera/QualcommCameraHardware.h b/libcamera/QualcommCameraHardware.h index a6c4593..5be2500 100644 --- a/libcamera/QualcommCameraHardware.h +++ b/libcamera/QualcommCameraHardware.h @@ -28,7 +28,7 @@ extern "C" { #include "msm_camera.h" } -#define version "10.12.11" +#define version "11.04.01" #define MSM_CAMERA_CONTROL "/dev/msm_camera/msm_camera0" #define JPEG_EVENT_DONE 0 /* guess */ diff --git a/libcamera/jpegConvert.cpp b/libcamera/jpegConvert.cpp index c44f296..db74f33 100644 --- a/libcamera/jpegConvert.cpp +++ b/libcamera/jpegConvert.cpp @@ -29,11 +29,10 @@ YuvToJpegEncoder::YuvToJpegEncoder(int* strides) : fStrides(strides) { } bool YuvToJpegEncoder::encode(unsigned char* dest, void* inYuv, int width, - int height, int* offsets, int jpegQuality) { + int height, int* offsets, int jpegQuality, uint32_t* mSize) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; long unsigned int image_size; - unsigned char* ucDest; // Warning, this is ONLY valid for YUV420SP (ImageFormat.NV21 in android) image_size = (width*height*1.5); @@ -53,6 +52,8 @@ bool YuvToJpegEncoder::encode(unsigned char* dest, void* inYuv, int width, jpeg_finish_compress(&cinfo); + *mSize = (uint32_t) image_size; + mJpegTam = (uint32_t) image_size; return true; } @@ -145,7 +146,7 @@ void Yuv420SpToJpegEncoder::configSamplingFactors(jpeg_compress_struct* cinfo) { /////////////////////////////////////////////////////////////////////////////// -int yuv420_save2jpeg(unsigned char *dest, void *src, int width, int height, int quality) { +int yuv420_save2jpeg(unsigned char *dest, void *src, int width, int height, int quality, uint32_t *mSize) { int imgStrides[2], imgOffsets[2]; // Convert the RAW data to JPEG @@ -159,7 +160,7 @@ int yuv420_save2jpeg(unsigned char *dest, void *src, int width, int height, int // in android imgOffsets[0] = 0; imgOffsets[1] = width*height; - encoder->encode(dest, src, width, height, imgOffsets, quality); + encoder->encode(dest, src, width, height, imgOffsets, quality, mSize); delete encoder; diff --git a/libcamera/jpegConvert.h b/libcamera/jpegConvert.h index 3731bbf..ea47982 100644 --- a/libcamera/jpegConvert.h +++ b/libcamera/jpegConvert.h @@ -29,8 +29,8 @@ public: * @return true if successfully compressed the stream. */ bool encode(unsigned char* dest, void* inYuv, int width, - int height, int* offsets, int jpegQuality); - + int height, int* offsets, int jpegQuality, uint32_t* mSize); + uint32_t mJpegTam; virtual ~YuvToJpegEncoder() {} protected: diff --git a/libcamera/raw2jpeg.h b/libcamera/raw2jpeg.h index ae5209f..e3b50f8 100644 --- a/libcamera/raw2jpeg.h +++ b/libcamera/raw2jpeg.h @@ -1 +1 @@ -int yuv420_save2jpeg(unsigned char *dest, void *src, int width, int height, int quality); +int yuv420_save2jpeg(unsigned char *dest, void *src, int width, int height, int quality, uint32_t *mSize);