Speed up camera on photo recording

- Speed up camera recording using Emilio technical. ( create tmpfs system )
- Modified geolocation recording in jpg file.

Change-Id: Ia42fc0ee3c6e44c5c8915f333860b9a7611513ec
This commit is contained in:
KalimochoAz 2011-06-12 08:03:25 +02:00
parent c5568a5383
commit be772dfa0d
3 changed files with 32 additions and 41 deletions

View File

@ -37,6 +37,10 @@ on boot
chown system system /sys/class/leds/button-backlight/brightness
chown system system /sys/class/leds/lcd-backlight/brightness
# mount tmp cache system to speed up photo taking
mkdir /cache/tmp 0666 system system
mount tmpfs tmpfs /cache/tmp
# Revise su permisions to ensure all users can use it
chmod 06755 /system/xbin/su

View File

@ -15,7 +15,7 @@ LOCAL_MODULE_TAGS:=optional
LOCAL_SRC_FILES:= QualcommCameraHardware.cpp exifwriter.c jdatadst.cpp jpegConvert.cpp
LOCAL_CFLAGS:= -DDLOPEN_LIBMMCAMERA=$(DLOPEN_LIBMMCAMERA)
LOCAL_CFLAGS:= -DDLOPEN_LIBMMCAMERA=$(DLOPEN_LIBMMCAMERA) -O2
LOCAL_C_INCLUDES+= \
vendor/qcom/proprietary/mm-camera/common \

View File

@ -2,7 +2,7 @@
#include "jhead.h"
#define LOG_TAG "ExifWriterCamera"
//#define LOG_NDEBUG 0
// #define LOG_NDEBUG 0
#include <utils/Log.h>
@ -17,6 +17,10 @@
#define TAG_ORIENTATION 0x0112
#define TAG_MAKE 0x010F
#define TAG_MODEL 0x0110
#define TAG_IMAGE_WIDTH 0x0100
#define TAG_IMAGE_LENGTH 0x0101
#define TAG_EXIF_VERSION 0x9000
#define EXIF_TOTAL_DATA 2
float *float2degminsec( float deg )
@ -127,7 +131,7 @@ static void dump_to_file(const char *fname,
}
void writeExif( void *origData, void *destData , int origSize , uint32_t *resultSize, int orientation,camera_position_type *pt ) {
const char *filename = "/data/temp.jpg";
const char *filename = "/cache/tmp/temp.jpg";
dump_to_file( filename, (uint8_t *)origData, origSize );
LOGV("WRITE EXIF Filename %s", filename);
@ -149,7 +153,7 @@ void writeExif( void *origData, void *destData , int origSize , uint32_t *result
}
ExifElement_t *t = (ExifElement_t *)malloc( sizeof(ExifElement_t)*(3+gpsTag) );
ExifElement_t *t = (ExifElement_t *)malloc( sizeof(ExifElement_t)*(EXIF_TOTAL_DATA+gpsTag) );
ExifElement_t *it = t;
// Store file date/time.
@ -159,31 +163,21 @@ void writeExif( void *origData, void *destData , int origSize , uint32_t *result
unsigned short v;
LOGV("EXIF Orientation %d º", orientation);
if( orientation == 90 ) {
(*it).Value = "6";
(*it).Value = "6\0";
} else if( orientation == 180 ) {
(*it).Value = "3";
(*it).Value = "3\0";
} else {
(*it).Value = "1";
(*it).Value = "1\0";
}
(*it).GpsTag = FALSE;
it++;
(*it).Tag = TAG_MAKE;
(*it).Format = FMT_STRING;
(*it).Value = "HTC";
(*it).DataLength = 8;
(*it).GpsTag = FALSE;
it++;
(*it).Tag = TAG_MODEL;
(*it).Format = FMT_STRING;
(*it).Value = "Tattoo with CyanogenMOD";
(*it).DataLength = 18;
(*it).Value = "Tattoo with CyanogenMOD\0";
(*it).DataLength = 24;
(*it).GpsTag = FALSE;
if( pt != NULL ) {
LOGV("pt->latitude == %f", pt->latitude );
LOGV("pt->longitude == %f", pt->longitude );
@ -193,70 +187,61 @@ void writeExif( void *origData, void *destData , int origSize , uint32_t *result
(*it).Tag = 0x01;
(*it).Format = FMT_STRING;
if( pt->latitude > 0 ) {
(*it).Value = "N";
(*it).Value = "N\0";
} else {
(*it).Value = "S";
(*it).Value = "S\0";
}
(*it).DataLength = 2;
(*it).GpsTag = TRUE;
it++;
char *mylat = coord2degminsec( pt->latitude );
LOGV("writeExif: La latitud queda en: %s", mylat);
(*it).Value = coord2degminsec( pt->latitude );
LOGV("writeExif: La latitud queda en: %s", (*it).Value);
(*it).Tag = 0x02;
(*it).Format = FMT_URATIONAL;
(*it).Value = mylat;
(*it).DataLength = 3;
(*it).GpsTag = TRUE;
free( mylat );
it++;
(*it).Tag = 0x03;
(*it).Format = FMT_STRING;
if( (*pt).longitude > 0 ) {
(*it).Value = "E";
(*it).Value = "E\0";
} else {
(*it).Value = "W";
(*it).Value = "W\0";
}
(*it).DataLength = 2;
(*it).GpsTag = TRUE;
it++;
char *mylong = coord2degminsec( (*pt).longitude );
LOGV("writeExif: La longitud queda en: %s", mylong);
(*it).Value = coord2degminsec( pt->longitude );
LOGV("writeExif: La longitud queda en: %s", (*it).Value);
(*it).Tag = 0x04;
(*it).Format = FMT_URATIONAL;
(*it).Value = mylong;
(*it).DataLength = 3;
(*it).GpsTag = TRUE;
free( mylong );
it++;
(*it).Tag = 0x05;
(*it).Format = FMT_USHORT;
if( (*pt).altitude > 0 ) {
(*it).Value = "0";
(*it).Value = "0\0";
} else {
(*it).Value = "1";
(*it).Value = "1\0";
}
(*it).DataLength = 1;
(*it).GpsTag = TRUE;
it++;
char *myalt = float2rationnal( fabs( (*pt).altitude ) );
LOGV("writeExif: La altitud queda en: %s", myalt);
(*it).Value = float2rationnal( fabs( pt->altitude ) );
LOGV("writeExif: La altitud queda en: %s", (*it).Value);
(*it).Tag = 0x06;
(*it).Format = FMT_SRATIONAL;
(*it).Value = myalt;
(*it).DataLength = 1;
(*it).GpsTag = TRUE;
free( myalt );
}
{
@ -275,7 +260,7 @@ void writeExif( void *origData, void *destData , int origSize , uint32_t *result
int res = ReadJpegFile(filename, (ReadMode_t)ReadMode );
LOGV("READ EXIF Filename %s", filename);
create_EXIF( t, 3, gpsTag);
create_EXIF( t, EXIF_TOTAL_DATA, gpsTag);
WriteJpegFile(filename);
chmod( filename, S_IRWXU );
@ -290,5 +275,7 @@ void writeExif( void *origData, void *destData , int origSize , uint32_t *result
int read = fread( destData, 1, (*resultSize), src );
free( t );
unlink( filename );
}