diff --git a/tools/emulator/system/camera/EmulatedFakeCamera2.cpp b/tools/emulator/system/camera/EmulatedFakeCamera2.cpp index 633ad83ad..ef273ba0a 100644 --- a/tools/emulator/system/camera/EmulatedFakeCamera2.cpp +++ b/tools/emulator/system/camera/EmulatedFakeCamera2.cpp @@ -773,8 +773,13 @@ bool EmulatedFakeCamera2::ReadoutThread::threadLoop() { ALOGV("Sending image buffer to output stream."); GraphicBufferMapper::get().unlock(*mBuffer); - mParent->mRawStreamOps->enqueue_buffer(mParent->mRawStreamOps, + res = mParent->mRawStreamOps->enqueue_buffer(mParent->mRawStreamOps, captureTime, mBuffer); + if (res != OK) { + ALOGE("Error enqueuing image buffer %p: %s (%d)", mBuffer, + strerror(-res), res); + // TODO: Should this cause a stop? + } mBuffer = NULL; return true; @@ -1127,13 +1132,13 @@ status_t EmulatedFakeCamera2::constructDefaultRequest( /** android.sensor */ - static const int64_t exposureTime = 30 * MSEC; + static const int64_t exposureTime = 10 * MSEC; ADD_OR_SIZE(ANDROID_SENSOR_EXPOSURE_TIME, &exposureTime, 1); static const int64_t frameDuration = 33333333L; // 1/30 s ADD_OR_SIZE(ANDROID_SENSOR_FRAME_DURATION, &frameDuration, 1); - static const int32_t sensitivity = 400; + static const int32_t sensitivity = 100; ADD_OR_SIZE(ANDROID_SENSOR_SENSITIVITY, &sensitivity, 1); // TIMESTAMP set only in frame diff --git a/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp b/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp index 7ce6dab02..bd4a6562a 100644 --- a/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp +++ b/tools/emulator/system/camera/fake-pipeline2/Sensor.cpp @@ -386,10 +386,7 @@ void Sensor::captureRaw(uint32_t gain, uint32_t stride, void Sensor::captureRGBA(uint32_t gain, uint32_t stride, uint8_t **capturedBuffer, nsecs_t captureTime, nsecs_t frameReadoutTime) { - float totalGain = gain/100.0 * kBaseGainFactor; - float noiseVarGain = totalGain * totalGain; - float readNoiseVar = kReadNoiseVarBeforeGain * noiseVarGain - + kReadNoiseVarAfterGain; + int totalGain = gain/100.0 * kBaseGainFactor; for (unsigned int y = 0; y < kResolution[1]; y++ ) { uint8_t *px = (uint8_t*)mNextCapturedBuffer + y * stride * 4; @@ -397,13 +394,13 @@ void Sensor::captureRGBA(uint32_t gain, uint32_t stride, uint32_t rCount, gCount, bCount; // TODO: Perfect demosaicing is a cheat const uint32_t *pixel = mScene.getPixelElectrons(); - rCount = pixel[Scene::R] * totalGain; - gCount = pixel[Scene::Gr] * totalGain; - bCount = pixel[Scene::B] * totalGain; + rCount = pixel[Scene::R] * totalGain / (kMaxRawValue / 255); + gCount = pixel[Scene::Gr] * totalGain / (kMaxRawValue / 255); + bCount = pixel[Scene::B] * totalGain / (kMaxRawValue / 255); - *px++ = rCount / (kMaxRawValue / 255); - *px++ = gCount / (kMaxRawValue / 255); - *px++ = bCount / (kMaxRawValue / 255); + *px++ = rCount < 255 ? rCount : 255; + *px++ = gCount < 255 ? gCount : 255; + *px++ = bCount < 255 ? bCount : 255; *px++ = 255; } // TODO: Handle this better