diff options
author | junjiez <junjiez@codeaurora.org> | 2017-06-22 14:41:57 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-07-03 23:11:09 -0700 |
commit | c5e2b3837655ce92c638c2363330c5a4d1b8176c (patch) | |
tree | fd2b44a4b7fdb1a1b5e7390da4705b6477a6755a /src/com/android/camera/MediaSaveService.java | |
parent | 2b2d7f4c6cffdc6ad6bc0b6ef459271291c99aea (diff) | |
download | android_packages_apps_Snap-c5e2b3837655ce92c638c2363330c5a4d1b8176c.tar.gz android_packages_apps_Snap-c5e2b3837655ce92c638c2363330c5a4d1b8176c.tar.bz2 android_packages_apps_Snap-c5e2b3837655ce92c638c2363330c5a4d1b8176c.zip |
SnapdragonCamera:RTB_snapshot
1.pack the bokeh image, origin image, depthmap
into jpeg with XMP information.
2.Fix the blur degree is not changed when
swipe the seek bar.
Change-Id: I05d31ccd2a5d50f4df2fcda2549822eb2ead67ec
Diffstat (limited to 'src/com/android/camera/MediaSaveService.java')
-rwxr-xr-x[-rw-r--r--] | src/com/android/camera/MediaSaveService.java | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/src/com/android/camera/MediaSaveService.java b/src/com/android/camera/MediaSaveService.java index 00f5a4777..e3980f752 100644..100755 --- a/src/com/android/camera/MediaSaveService.java +++ b/src/com/android/camera/MediaSaveService.java @@ -161,7 +161,7 @@ public class MediaSaveService extends Service { t.execute(); } - public void addClearsightImage(byte[] clearsight, GImage bayer, GDepth.DepthMap depthMap, + public void addXmpImage(byte[] mainImage, GImage bayer, GDepth gDepth, String title, long date, Location loc, int width, int height, int orientation, ExifInterface exif, OnMediaSavedListener l, ContentResolver resolver, String pictureFormat) { @@ -169,11 +169,11 @@ public class MediaSaveService extends Service { Log.e(TAG, "Cannot add image when the queue is full"); return; } - ClearsightImageSaveTask t = new ClearsightImageSaveTask(clearsight, bayer, depthMap, + XmpImageSaveTask t = new XmpImageSaveTask(mainImage, bayer, gDepth, title, date, (loc == null) ? null : new Location(loc), width, height, orientation, exif, resolver, l, pictureFormat); - mMemoryUse += clearsight.length; + mMemoryUse += mainImage.length; if (isQueueFull()) { onQueueFull(); } @@ -382,11 +382,9 @@ public class MediaSaveService extends Service { } } - private class ClearsightImageSaveTask extends AsyncTask <Void, Void, Uri> { - private byte[] clearsight; - private byte[] depth; + private class XmpImageSaveTask extends AsyncTask <Void, Void, Uri> { + private byte[] mainImage; private GImage bayer; - private GDepth.DepthMap depthMap; private GDepth gDepth; private byte[] data; private String title; @@ -399,14 +397,14 @@ public class MediaSaveService extends Service { private OnMediaSavedListener listener; private String pictureFormat; - public ClearsightImageSaveTask(byte[] clearsight, GImage bayer,GDepth.DepthMap depthMap, - String title, long date, Location loc, - int width, int height, int orientation, - ExifInterface exif, ContentResolver resolver, - OnMediaSavedListener listener, String pictureFormat) { - this.clearsight = clearsight; + public XmpImageSaveTask(byte[] mainImage, GImage bayer, GDepth gDepth, + String title, long date, Location loc, + int width, int height, int orientation, + ExifInterface exif, ContentResolver resolver, + OnMediaSavedListener listener, String pictureFormat) { + this.mainImage = mainImage; + this.gDepth = gDepth; this.bayer = bayer; - this.depthMap = depthMap; this.title = title; this.date = date; this.loc = loc; @@ -417,8 +415,6 @@ public class MediaSaveService extends Service { this.resolver = resolver; this.listener = listener; this.pictureFormat = pictureFormat; - - gDepth = null; } @Override @@ -428,13 +424,9 @@ public class MediaSaveService extends Service { @Override protected Uri doInBackground(Void... v) { - if ( depthMap != null ) { - depthMap.buffer = converToJpegByte(depthMap.rawDepth, depthMap.width, depthMap.height); - gDepth = GDepth.createGDepth(depthMap); - } - data = embedGDepthAndBayerInClearSight(clearsight); + data = embedGDepthAndBayerInClearSight(mainImage); if ( data == null ) { - data = clearsight; + data = mainImage; Log.e(TAG, "embedGDepthAndBayerInClearSight fail"); } @@ -458,22 +450,6 @@ public class MediaSaveService extends Service { if (isQueueFull() != previouslyFull) onQueueAvailable(); } - private byte[] converToJpegByte(byte[] depthBuf, int width, int height) { - int[] colors = new int[depthBuf.length]; - for(int i=0; i < colors.length; ++i) { - colors[i] = (256+depthBuf[i])%256; - } - Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); - for( int y=0; y < height; ++y ) { - for( int x=0; x < width; ++x) { - int c = colors[y*width+x]; - bitmap.setPixel(x, y, Color.rgb(c, c, c)); - } - } - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); - return baos.toByteArray(); - } private byte[] embedGDepthAndBayerInClearSight(byte[] clearSightImageBytes) { Log.d(TAG, "embedGDepthInClearSight"); |