diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2013-11-22 10:34:29 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2013-11-22 10:34:29 -0800 |
commit | b9a62053cf74025a43c8baa118d52729e38cc176 (patch) | |
tree | bbe2ad61de5f44c01f07e53f4bb1a7632f3ad4f9 | |
parent | 2befc3edc583afb43a4f6740f0af0534eac8e9d5 (diff) | |
parent | 828bd482a1aeacf96d5f3a3e0701029d9f890c5f (diff) | |
download | android_device_generic_goldfish-b9a62053cf74025a43c8baa118d52729e38cc176.tar.gz android_device_generic_goldfish-b9a62053cf74025a43c8baa118d52729e38cc176.tar.bz2 android_device_generic_goldfish-b9a62053cf74025a43c8baa118d52729e38cc176.zip |
Merge commit '828bd482a1aeacf96d5f3a3e0701029d9f890c5f' into HEAD
-rw-r--r-- | camera/EmulatedFakeCamera2.cpp | 19 | ||||
-rw-r--r-- | camera/EmulatedFakeCamera3.cpp | 13 | ||||
-rw-r--r-- | camera/fake-pipeline2/Sensor.cpp | 54 | ||||
-rw-r--r-- | camera/fake-pipeline2/Sensor.h | 4 | ||||
-rw-r--r-- | camera/media_codecs.xml | 5 | ||||
-rw-r--r-- | fstab.goldfish | 2 | ||||
-rw-r--r-- | init.goldfish.rc | 9 | ||||
-rw-r--r-- | opengl/system/egl/egl.cpp | 2 | ||||
-rw-r--r-- | opengl/system/gralloc/gralloc.cpp | 10 |
9 files changed, 62 insertions, 56 deletions
diff --git a/camera/EmulatedFakeCamera2.cpp b/camera/EmulatedFakeCamera2.cpp index f7e8ed0..f007a86 100644 --- a/camera/EmulatedFakeCamera2.cpp +++ b/camera/EmulatedFakeCamera2.cpp @@ -911,7 +911,7 @@ bool EmulatedFakeCamera2::ConfigureThread::setupCapture() { mNextNeedsJpeg = false; ALOGV("Configure: Setting up buffers for capture"); for (size_t i = 0; i < streams.count; i++) { - int streamId = streams.data.u8[i]; + int streamId = streams.data.i32[i]; const Stream &s = mParent->getStreamInfo(streamId); if (s.format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) { ALOGE("%s: Stream %d does not have a concrete pixel format, but " @@ -1041,7 +1041,7 @@ bool EmulatedFakeCamera2::ConfigureThread::setupReprocess() { ALOGV("Configure: Setting up input buffers for reprocess"); for (size_t i = 0; i < reprocessStreams.count; i++) { - int streamId = reprocessStreams.data.u8[i]; + int streamId = reprocessStreams.data.i32[i]; const ReprocessStream &s = mParent->getReprocessStreamInfo(streamId); if (s.format != HAL_PIXEL_FORMAT_RGB_888) { ALOGE("%s: Only ZSL reprocessing supported!", @@ -1070,7 +1070,7 @@ bool EmulatedFakeCamera2::ConfigureThread::setupReprocess() { ALOGV("Configure: Setting up output buffers for reprocess"); for (size_t i = 0; i < streams.count; i++) { - int streamId = streams.data.u8[i]; + int streamId = streams.data.i32[i]; const Stream &s = mParent->getStreamInfo(streamId); if (s.format != HAL_PIXEL_FORMAT_BLOB) { // TODO: Support reprocess to YUV @@ -2201,11 +2201,6 @@ status_t EmulatedFakeCamera2::constructStaticInfo( ADD_OR_SIZE(ANDROID_LENS_INFO_SHADING_MAP_SIZE, lensShadingMapSize, sizeof(lensShadingMapSize)/sizeof(int32_t)); - static const float lensShadingMap[3 * 1 * 1 ] = - { 1.f, 1.f, 1.f }; - ADD_OR_SIZE(ANDROID_LENS_INFO_SHADING_MAP, lensShadingMap, - sizeof(lensShadingMap)/sizeof(float)); - // Identity transform static const int32_t geometricCorrectionMapSize[] = {2, 2}; ADD_OR_SIZE(ANDROID_LENS_INFO_GEOMETRIC_CORRECTION_MAP_SIZE, @@ -2248,10 +2243,10 @@ status_t EmulatedFakeCamera2::constructStaticInfo( ADD_OR_SIZE(ANDROID_SENSOR_INFO_MAX_FRAME_DURATION, &Sensor::kFrameDurationRange[1], 1); - ADD_OR_SIZE(ANDROID_SENSOR_INFO_AVAILABLE_SENSITIVITIES, - Sensor::kAvailableSensitivities, - sizeof(Sensor::kAvailableSensitivities) - /sizeof(uint32_t)); + ADD_OR_SIZE(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE, + Sensor::kSensitivityRange, + sizeof(Sensor::kSensitivityRange) + /sizeof(int32_t)); ADD_OR_SIZE(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, &Sensor::kColorFilterArrangement, 1); diff --git a/camera/EmulatedFakeCamera3.cpp b/camera/EmulatedFakeCamera3.cpp index 154cbc6..0274aad 100644 --- a/camera/EmulatedFakeCamera3.cpp +++ b/camera/EmulatedFakeCamera3.cpp @@ -1062,11 +1062,6 @@ status_t EmulatedFakeCamera3::constructStaticInfo() { info.update(ANDROID_LENS_INFO_SHADING_MAP_SIZE, lensShadingMapSize, sizeof(lensShadingMapSize)/sizeof(int32_t)); - static const float lensShadingMap[3 * 1 * 1 ] = - { 1.f, 1.f, 1.f }; - info.update(ANDROID_LENS_INFO_SHADING_MAP, lensShadingMap, - sizeof(lensShadingMap)/sizeof(float)); - // Identity transform static const int32_t geometricCorrectionMapSize[] = {2, 2}; info.update(ANDROID_LENS_INFO_GEOMETRIC_CORRECTION_MAP_SIZE, @@ -1109,10 +1104,10 @@ status_t EmulatedFakeCamera3::constructStaticInfo() { info.update(ANDROID_SENSOR_INFO_MAX_FRAME_DURATION, &Sensor::kFrameDurationRange[1], 1); - info.update(ANDROID_SENSOR_INFO_AVAILABLE_SENSITIVITIES, - (int32_t*)Sensor::kAvailableSensitivities, - sizeof(Sensor::kAvailableSensitivities) - /sizeof(uint32_t)); + info.update(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE, + Sensor::kSensitivityRange, + sizeof(Sensor::kSensitivityRange) + /sizeof(int32_t)); info.update(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, &Sensor::kColorFilterArrangement, 1); diff --git a/camera/fake-pipeline2/Sensor.cpp b/camera/fake-pipeline2/Sensor.cpp index 3f9f318..aa54ef4 100644 --- a/camera/fake-pipeline2/Sensor.cpp +++ b/camera/fake-pipeline2/Sensor.cpp @@ -77,8 +77,7 @@ const float Sensor::kReadNoiseVarAfterGain = const nsecs_t Sensor::kRowReadoutTime = Sensor::kFrameDurationRange[0] / Sensor::kResolution[1]; -const uint32_t Sensor::kAvailableSensitivities[5] = - {100, 200, 400, 800, 1600}; +const int32_t Sensor::kSensitivityRange[2] = {100, 1600}; const uint32_t Sensor::kDefaultSensitivity = 100; /** A few utility functions for math, normal distributions */ @@ -485,37 +484,56 @@ void Sensor::captureRGB(uint8_t *img, uint32_t gain, uint32_t stride) { void Sensor::captureNV21(uint8_t *img, uint32_t gain, uint32_t stride) { float totalGain = gain/100.0 * kBaseGainFactor; + // Using fixed-point math with 6 bits of fractional precision. // In fixed-point math, calculate total scaling from electrons to 8bpp - int scale64x = 64 * totalGain * 255 / kMaxRawValue; + const int scale64x = 64 * totalGain * 255 / kMaxRawValue; + // In fixed-point math, saturation point of sensor after gain + const int saturationPoint = 64 * 255; + // Fixed-point coefficients for RGB-YUV transform + // Based on JFIF RGB->YUV transform. + // Cb/Cr offset scaled by 64x twice since they're applied post-multiply + const int rgbToY[] = {19, 37, 7}; + const int rgbToCb[] = {-10,-21, 32, 524288}; + const int rgbToCr[] = {32,-26, -5, 524288}; + // Scale back to 8bpp non-fixed-point + const int scaleOut = 64; + const int scaleOutSq = scaleOut * scaleOut; // after multiplies - // TODO: Make full-color uint32_t inc = kResolution[0] / stride; uint32_t outH = kResolution[1] / inc; - for (unsigned int y = 0, outY = 0, outUV = outH; - y < kResolution[1]; y+=inc, outY++, outUV ) { + for (unsigned int y = 0, outY = 0; + y < kResolution[1]; y+=inc, outY++) { uint8_t *pxY = img + outY * stride; + uint8_t *pxVU = img + (outH + outY / 2) * stride; mScene.setReadoutPixel(0,y); - for (unsigned int x = 0; x < kResolution[0]; x+=inc) { - uint32_t rCount, gCount, bCount; + for (unsigned int outX = 0; outX < stride; outX++) { + int32_t rCount, gCount, bCount; // TODO: Perfect demosaicing is a cheat const uint32_t *pixel = mScene.getPixelElectrons(); rCount = pixel[Scene::R] * scale64x; + rCount = rCount < saturationPoint ? rCount : saturationPoint; gCount = pixel[Scene::Gr] * scale64x; + gCount = gCount < saturationPoint ? gCount : saturationPoint; bCount = pixel[Scene::B] * scale64x; - uint32_t avg = (rCount + gCount + bCount) / 3; - *pxY++ = avg < 255*64 ? avg / 64 : 255; + bCount = bCount < saturationPoint ? bCount : saturationPoint; + + *pxY++ = (rgbToY[0] * rCount + + rgbToY[1] * gCount + + rgbToY[2] * bCount) / scaleOutSq; + if (outY % 2 == 0 && outX % 2 == 0) { + *pxVU++ = (rgbToCr[0] * rCount + + rgbToCr[1] * gCount + + rgbToCr[2] * bCount + + rgbToCr[3]) / scaleOutSq; + *pxVU++ = (rgbToCb[0] * rCount + + rgbToCb[1] * gCount + + rgbToCb[2] * bCount + + rgbToCb[3]) / scaleOutSq; + } for (unsigned int j = 1; j < inc; j++) mScene.getPixelElectrons(); } } - for (unsigned int y = 0, outY = outH; y < kResolution[1]/2; y+=inc, outY++) { - uint8_t *px = img + outY * stride; - for (unsigned int x = 0; x < kResolution[0]; x+=inc) { - // UV to neutral - *px++ = 128; - *px++ = 128; - } - } ALOGVV("NV21 sensor image captured"); } diff --git a/camera/fake-pipeline2/Sensor.h b/camera/fake-pipeline2/Sensor.h index 8e2ffe8..b485844 100644 --- a/camera/fake-pipeline2/Sensor.h +++ b/camera/fake-pipeline2/Sensor.h @@ -18,6 +18,8 @@ * This class is a simple simulation of a typical CMOS cellphone imager chip, * which outputs 12-bit Bayer-mosaic raw images. * + * Unlike most real image sensors, this one's native color space is linear sRGB. + * * The sensor is abstracted as operating as a pipeline 3 stages deep; * conceptually, each frame to be captured goes through these three stages. The * processing step for the sensor is marked off by vertical sync signals, which @@ -186,7 +188,7 @@ class Sensor: private Thread, public virtual RefBase { // if there's a reasonable number of rows. static const nsecs_t kRowReadoutTime; - static const uint32_t kAvailableSensitivities[5]; + static const int32_t kSensitivityRange[2]; static const uint32_t kDefaultSensitivity; private: diff --git a/camera/media_codecs.xml b/camera/media_codecs.xml index c1af21a..8d46b98 100644 --- a/camera/media_codecs.xml +++ b/camera/media_codecs.xml @@ -89,7 +89,8 @@ Only the three quirks included above are recognized at this point: <MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" /> <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" /> <MediaCodec name="OMX.google.h264.decoder" type="video/avc" /> - <MediaCodec name="OMX.google.vpx.decoder" type="video/x-vnd.on2.vp8" /> + <MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8" /> + <MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9" /> </Decoders> <Encoders> @@ -100,6 +101,6 @@ Only the three quirks included above are recognized at this point: <MediaCodec name="OMX.google.h264.encoder" type="video/avc" /> <MediaCodec name="OMX.google.mpeg4.encoder" type="video/mp4v-es" /> <MediaCodec name="OMX.google.flac.encoder" type="audio/flac" /> - <MediaCodec name="OMX.google.vpx.encoder" type="video/x-vnd.on2.vp8" /> + <MediaCodec name="OMX.google.vp8.encoder" type="video/x-vnd.on2.vp8" /> </Encoders> </MediaCodecs> diff --git a/fstab.goldfish b/fstab.goldfish index ffc95d2..8617307 100644 --- a/fstab.goldfish +++ b/fstab.goldfish @@ -5,4 +5,4 @@ /dev/block/mtdblock0 /system ext4 ro,barrier=1 wait /dev/block/mtdblock1 /data ext4 noatime,nosuid,nodev,barrier=1,nomblk_io_submit wait,check /dev/block/mtdblock2 /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check -/devices/platform/goldfish_mmc.0 /storage/sdcard vfat defaults voldmanaged=sdcard:auto +/devices/platform/goldfish_mmc.0 auto vfat defaults voldmanaged=sdcard:auto diff --git a/init.goldfish.rc b/init.goldfish.rc index 26e2608..ead468d 100644 --- a/init.goldfish.rc +++ b/init.goldfish.rc @@ -4,7 +4,8 @@ on early-init on init # See storage config details at http://source.android.com/tech/storage/ - mkdir /storage/sdcard 0555 root root + mkdir /mnt/media_rw/sdcard 0700 media_rw media_rw + mkdir /storage/sdcard 0700 root root export EXTERNAL_STORAGE /storage/sdcard @@ -16,6 +17,7 @@ on boot setprop ARGH ARGH setprop net.eth0.gw 10.0.2.2 setprop net.eth0.dns1 10.0.2.3 + setprop net.dns1 10.0.2.3 setprop net.gprs.local-ip 10.0.2.15 setprop ro.radio.use-ppp no setprop ro.build.product generic @@ -87,3 +89,8 @@ service qemud /system/bin/qemud service goldfish-logcat /system/bin/logcat -Q oneshot + +# fusewrapped external sdcard daemon running as media_rw (1023) +service fuse_sdcard /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard /storage/sdcard + class late_start + disabled diff --git a/opengl/system/egl/egl.cpp b/opengl/system/egl/egl.cpp index 9babde9..cf3df52 100644 --- a/opengl/system/egl/egl.cpp +++ b/opengl/system/egl/egl.cpp @@ -1156,8 +1156,6 @@ EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EG case HAL_PIXEL_FORMAT_RGB_888: case HAL_PIXEL_FORMAT_RGB_565: case HAL_PIXEL_FORMAT_BGRA_8888: - case HAL_PIXEL_FORMAT_RGBA_5551: - case HAL_PIXEL_FORMAT_RGBA_4444: break; default: setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); diff --git a/opengl/system/gralloc/gralloc.cpp b/opengl/system/gralloc/gralloc.cpp index ed5d05f..6250a2f 100644 --- a/opengl/system/gralloc/gralloc.cpp +++ b/opengl/system/gralloc/gralloc.cpp @@ -219,16 +219,6 @@ static int gralloc_alloc(alloc_device_t* dev, glFormat = GL_RGB; glType = GL_UNSIGNED_SHORT_5_6_5; break; - case HAL_PIXEL_FORMAT_RGBA_5551: - bpp = 2; - glFormat = GL_RGB5_A1_OES; - glType = GL_UNSIGNED_SHORT_5_5_5_1; - break; - case HAL_PIXEL_FORMAT_RGBA_4444: - bpp = 2; - glFormat = GL_RGBA4_OES; - glType = GL_UNSIGNED_SHORT_4_4_4_4; - break; case HAL_PIXEL_FORMAT_RAW_SENSOR: bpp = 2; align = 16*bpp; |