summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Huang <d-huang@ti.com>2016-10-14 10:44:20 -0500
committerDavid Huang <d-huang@ti.com>2016-10-14 10:44:20 -0500
commit4abb78d52425efe38f91e0d2e36cd8ee96463414 (patch)
tree173a93e288fabeab904d94567cf3ccdf3d55bc86
parent9d3ac1dd7878605347e2c7f0881604c89214113a (diff)
downloaddra7xx-4abb78d52425efe38f91e0d2e36cd8ee96463414.tar.gz
dra7xx: camera: Remove unused in V4LCameraAdapter
Removing many unused functions and references in V4LCameraAdapter.cpp and its header. Change-Id: I7e764121f48c2325bad000d9a73ea4dfa3a7c4ac Signed-off-by: David Huang <d-huang@ti.com>
-rw-r--r--camera/V4LCameraAdapter/V4LCameraAdapter.cpp184
-rw-r--r--camera/inc/V4LCameraAdapter/V4LCameraAdapter.h8
2 files changed, 0 insertions, 192 deletions
diff --git a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
index efd7478..e69e4e6 100644
--- a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
+++ b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
@@ -63,9 +63,7 @@ namespace Camera {
#define FPS_PERIOD 30
//Proto Types
-static void convertYUV422i_yuyvTouyvy(uint8_t *src, uint8_t *dest, size_t size );
static void convertYUV422ToNV12Tiler(unsigned char *src, android_ycbcr *dest, int width, int height );
-static void convertYUV422ToNV12(unsigned char *src, unsigned char *dest, int width, int height );
android::Mutex gV4LAdapterLock;
char device[MAX_VIDEO_DEVICES][MAX_PATH_LENGTH];
@@ -94,10 +92,6 @@ static void debugShowFPS()
/*--------------------V4L wrapper functions -------------------------------*/
-bool V4LCameraAdapter::isNeedToUseDecoder() const {
- return mPixelFormat != V4L2_PIX_FMT_YUYV;
-}
-
status_t V4LCameraAdapter::v4lIoctl (int fd, int req, void* argp) {
status_t ret = NO_ERROR;
errno = 0;
@@ -170,23 +164,6 @@ status_t V4LCameraAdapter::v4lInitMmap(int& count, int width, int height) {
return ret;
}
-status_t V4LCameraAdapter::v4lInitUsrPtr(int& count) {
- status_t ret = NO_ERROR;
-
- mVideoInfo->rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- mVideoInfo->rb.memory = V4L2_MEMORY_USERPTR;
- mVideoInfo->rb.count = count;
-
- ret = v4lIoctl(mCameraHandle, VIDIOC_REQBUFS, &mVideoInfo->rb);
- if (ret < 0) {
- CAMHAL_LOGEB("VIDIOC_REQBUFS failed for USERPTR: %s", strerror(errno));
- return ret;
- }
-
- count = mVideoInfo->rb.count;
- return ret;
-}
-
status_t V4LCameraAdapter::v4lInitDmaBuf(int& count, int width, int height) {
status_t ret = NO_ERROR;
int bytes = width * height * 2;
@@ -1084,37 +1061,6 @@ status_t V4LCameraAdapter::getPictureBufferSize(CameraFrame &frame, size_t buffe
return NO_ERROR;
}
-status_t V4LCameraAdapter::recalculateFPS()
-{
- float currentFPS;
-
- mFrameCount++;
-
- if ( ( mFrameCount % FPS_PERIOD ) == 0 )
- {
- nsecs_t now = systemTime();
- nsecs_t diff = now - mLastFPSTime;
- currentFPS = ((mFrameCount - mLastFrameCount) * float(s2ns(1))) / diff;
- mLastFPSTime = now;
- mLastFrameCount = mFrameCount;
-
- if ( 1 == mIter )
- {
- mFPS = currentFPS;
- }
- else
- {
- //cumulative moving average
- mFPS = mLastFPS + (currentFPS - mLastFPS)/mIter;
- }
-
- mLastFPS = mFPS;
- mIter++;
- }
-
- return NO_ERROR;
-}
-
void V4LCameraAdapter::onOrientationEvent(uint32_t orientation, uint32_t tilt)
{
LOG_FUNCTION_NAME;
@@ -1174,27 +1120,6 @@ V4LCameraAdapter::~V4LCameraAdapter()
LOG_FUNCTION_NAME_EXIT;
}
-static void convertYUV422i_yuyvTouyvy(uint8_t *src, uint8_t *dest, size_t size ) {
- //convert YUV422I yuyv to uyvy format.
- uint32_t *bf = (uint32_t*)src;
- uint32_t *dst = (uint32_t*)dest;
-
- LOG_FUNCTION_NAME;
-
- if (!src || !dest) {
- return;
- }
-
- for(size_t i = 0; i < size; i = i+4)
- {
- dst[0] = ((bf[0] & 0x00FF00FF) << 8) | ((bf[0] & 0xFF00FF00) >> 8);
- bf++;
- dst++;
- }
-
- LOG_FUNCTION_NAME_EXIT;
-}
-
static void convertYUV422ToNV12Tiler(unsigned char *src, android_ycbcr *ycbcr, int width, int height ) {
//convert YUV422I to YUV420 NV12 format and copies directly to preview buffers (Tiler memory).
unsigned char *bf = src;
@@ -1285,119 +1210,10 @@ static void convertYUV422ToNV12Tiler(unsigned char *src, android_ycbcr *ycbcr, i
LOG_FUNCTION_NAME_EXIT;
}
-static void convertYUV422ToNV12(unsigned char *src, unsigned char *dest, int width, int height ) {
- //convert YUV422I to YUV420 NV12 format.
- unsigned char *bf = src;
- unsigned char *dst_y = dest;
- unsigned char *dst_uv = dest + (width * height);
-
- LOG_FUNCTION_NAME;
-
- if (width % 16 ) {
- for(int i = 0; i < height; i++) {
- for(int j = 0; j < width; j++) {
- *dst_y = *bf;
- dst_y++;
- bf = bf + 2;
- }
- }
-
- bf = src;
- bf++; //UV sample
- for(int i = 0; i < height/2; i++) {
- for(int j=0; j<width; j++) {
- *dst_uv = *bf;
- dst_uv++;
- bf = bf + 2;
- }
- bf = bf + width*2;
- }
- } else {
- //neon conversion
- for(int i = 0; i < height; i++) {
- int n = width;
- int skip = i & 0x1; // skip uv elements for the odd rows
- asm volatile (
- " pld [%[src], %[src_stride], lsl #2] \n\t"
- " cmp %[n], #16 \n\t"
- " blt 5f \n\t"
- "0: @ 16 pixel copy \n\t"
- " vld2.8 {q0, q1} , [%[src]]! @ q0 = yyyy.. q1 = uvuv.. \n\t"
- " @ now q0 = y q1 = uv \n\t"
- " vst1.32 {d0,d1}, [%[dst_y]]! \n\t"
- " cmp %[skip], #0 \n\t"
- " bne 1f \n\t"
- " vst1.32 {d2,d3},[%[dst_uv]]! \n\t"
- "1: @ skip odd rows for UV \n\t"
- " sub %[n], %[n], #16 \n\t"
- " cmp %[n], #16 \n\t"
- " bge 0b \n\t"
- "5: @ end \n\t"
-#ifdef NEEDS_ARM_ERRATA_754319_754320
- " vmov s0,s0 @ add noop for errata item \n\t"
-#endif
- : [dst_y] "+r" (dst_y), [dst_uv] "+r" (dst_uv), [src] "+r" (src), [n] "+r" (n)
- : [src_stride] "r" (width), [skip] "r" (skip)
- : "cc", "memory", "q0", "q1", "q2", "d0", "d1", "d2", "d3"
- );
- }
- }
-
- LOG_FUNCTION_NAME_EXIT;
-}
-
-
-
-
/* Preview Thread */
// ---------------------------------------------------------------------------
-void V4LCameraAdapter::returnOutputBuffer(int index)
-{
- LOG_FUNCTION_NAME;
-
- size_t width, height;
- int stride = 4096;
- CameraFrame frame;
-
- getFrameSize(width, height);
-
- android::Mutex::Autolock slock(mSubscriberLock);
-
- android::sp<MediaBuffer>& buffer = mOutBuffers.editItemAt(index);
-
- CameraBuffer* cbuffer = static_cast<CameraBuffer*>(buffer->buffer);
-
- frame.mFrameType = CameraFrame::PREVIEW_FRAME_SYNC;
- frame.mBuffer = cbuffer;
- if (isNeedToUseDecoder()) {
- //We always get NV12 on out, when using decoder.
- frame.mLength = height * stride * 3 / 2;
- } else {
- frame.mLength = CameraHal::calculateBufferSize(mParams.getPreviewFormat(), width, height);
- }
- frame.mAlignment = stride;
- frame.mOffset = buffer->getOffset();
- frame.mTimestamp = buffer->getTimestamp();
- frame.mFrameMask = (unsigned int)CameraFrame::PREVIEW_FRAME_SYNC;
-
- if (mRecording)
- {
- frame.mFrameMask |= (unsigned int)CameraFrame::VIDEO_FRAME_SYNC;
- mFramesWithEncoder++;
- }
-
- int ret = setInitFrameRefCount(frame.mBuffer, frame.mFrameMask);
- if (ret != NO_ERROR) {
- CAMHAL_LOGDB("Error in setInitFrameRefCount %d", ret);
- } else {
- ret = sendFrameToSubscribers(&frame);
- }
- //debugShowFPS();
- LOG_FUNCTION_NAME_EXIT;
-}
-
status_t V4LCameraAdapter::returnBufferToV4L(int id) {
status_t ret = NO_ERROR;
v4l2_buffer buf;
diff --git a/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h b/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h
index 181c7ad..728032b 100644
--- a/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h
+++ b/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h
@@ -199,7 +199,6 @@ private:
status_t v4lIoctl(int, int, void*);
status_t v4lInitMmap(int& count, int width, int height);
- status_t v4lInitUsrPtr(int&);
status_t v4lInitDmaBuf(int& count, int width, int height);
status_t v4lStartStreaming();
status_t v4lStopStreaming(int nBufferCount);
@@ -207,8 +206,6 @@ private:
status_t restartPreview();
status_t applyFpsValue();
status_t returnBufferToV4L(int id);
- void returnOutputBuffer(int index);
- bool isNeedToUseDecoder() const;
int mPreviewBufferCount;
int mPreviewBufferCountQueueable;
@@ -227,11 +224,6 @@ private:
int mFrameCount;
int mLastFrameCount;
- unsigned int mIter;
- nsecs_t mLastFPSTime;
-
- //variables holding the estimated framerate
- float mFPS, mLastFPS;
int mSensorIndex;