camera: modified to support recording

The cameraHardware implementation has been
modified for recording and also to support
multipple resolutions.It also has additional
cameraParameters which are tried to access
by linphone application.

Note:Moving ahead we may have to add other
cameraparameters since there are a whole set
of parameters which application can querry

Change-Id: I7e3eee472c9ae0ca330d763b7272081962efb15b
Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
diff --git a/libcamera/Android.mk b/libcamera/Android.mk
index e2a82b9..9e7dc3e 100644
--- a/libcamera/Android.mk
+++ b/libcamera/Android.mk
@@ -7,7 +7,7 @@
 LOCAL_SRC_FILES :=       \
     CameraHardware.cpp   \
     V4L2Camera.cpp       \
-    converter.cpp
+    convert.S
 
 LOCAL_C_INCLUDES += external/jpeg
 
diff --git a/libcamera/CameraHardware.cpp b/libcamera/CameraHardware.cpp
index 64afcc3..1c30f0d 100644
--- a/libcamera/CameraHardware.cpp
+++ b/libcamera/CameraHardware.cpp
@@ -25,15 +25,20 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#define MIN_WIDTH           640
-#define MIN_HEIGHT          480
-#define CAM_SIZE            "640x480"
+#define MIN_WIDTH           320
+#define MIN_HEIGHT          240
+#define CAM_SIZE            "320x240"
 #define PIXEL_FORMAT        V4L2_PIX_FMT_YUYV
+extern "C" {
+    void yuyv422_to_yuv420sp(unsigned char*,unsigned char*,int,int);
+}
 
 namespace android {
 
 wp<CameraHardwareInterface> CameraHardware::singleton;
 
+const char supportedFpsRanges [] = "(8000,8000),(8000,10000),(10000,10000),(8000,15000),(15000,15000),(8000,20000),(20000,20000),(24000,24000),(25000,25000),(8000,30000),(30000,30000)";
+
 CameraHardware::CameraHardware(int cameraId)
                   : mCameraId(cameraId),
                     mParameters(),
@@ -61,10 +66,11 @@
     CameraParameters p;
 
     p.setPreviewSize(MIN_WIDTH, MIN_HEIGHT);
-    p.setPreviewFrameRate(15);
+    p.setPreviewFrameRate(30);
     p.setPreviewFormat("yuv422sp");
     p.set(p.KEY_SUPPORTED_PREVIEW_SIZES, CAM_SIZE);
-
+    p.set(p.KEY_SUPPORTED_PREVIEW_SIZES, "640x480");
+    p.set(CameraParameters::KEY_VIDEO_FRAME_FORMAT,CameraParameters::PIXEL_FORMAT_YUV420SP);
     p.setPictureSize(MIN_WIDTH, MIN_HEIGHT);
     p.setPictureFormat("jpeg");
     p.set(p.KEY_SUPPORTED_PICTURE_SIZES, CAM_SIZE);
@@ -125,15 +131,17 @@
 //-------------------------------------------------------------
 int CameraHardware::previewThread()
 {
+    int width, height;
+    mParameters.getPreviewSize(&width, &height);
     if (!previewStopped) {
         // Get preview frame
         camera.GrabPreviewFrame(mHeap->getBase());
         if ((mMsgEnabled & CAMERA_MSG_PREVIEW_FRAME) ||
-		(mMsgEnabled & CAMERA_MSG_VIDEO_FRAME)) {
-            if (mMsgEnabled & CAMERA_MSG_VIDEO_FRAME) {
-			camera.GrabRecordFrame(mRecordHeap->getBase());
-			nsecs_t timeStamp = systemTime(SYSTEM_TIME_MONOTONIC);
-			mTimestampFn(timeStamp, CAMERA_MSG_VIDEO_FRAME,mRecordBuffer, mUser);
+                (mMsgEnabled & CAMERA_MSG_VIDEO_FRAME)) {
+            if ((mMsgEnabled & CAMERA_MSG_VIDEO_FRAME ) && mRecordRunning ) {
+                yuyv422_to_yuv420sp((unsigned char *)mHeap->getBase(), (unsigned char*)mRecordHeap->getBase(), width, height);
+                nsecs_t timeStamp = systemTime(SYSTEM_TIME_MONOTONIC);
+                mTimestampFn(timeStamp, CAMERA_MSG_VIDEO_FRAME,mRecordBuffer, mUser);
             }
             mDataFn(CAMERA_MSG_PREVIEW_FRAME,mBuffer, mUser);
 	}
@@ -154,11 +162,11 @@
         return INVALID_OPERATION;
     }
     LOGI("startPreview: in startpreview \n");
-
+    mParameters.getPreviewSize(&width, &height);
     for( i=0; i<10; i++) {
         sprintf(devnode,"/dev/video%d",i);
-        LOGI("trying the node %s \n",devnode);
-        ret = camera.Open(devnode, MIN_WIDTH, MIN_HEIGHT, PIXEL_FORMAT);
+        LOGI("trying the node %s width=%d height=%d \n",devnode,width,height);
+        ret = camera.Open(devnode, width, height, PIXEL_FORMAT);
         if( ret >= 0)
             break;
         }
@@ -166,7 +174,7 @@
     if( ret < 0)
         return -1;
 
-    mPreviewFrameSize = MIN_WIDTH * MIN_HEIGHT * 2;
+    mPreviewFrameSize = width * height * 2;
 
     mHeap = new MemoryHeapBase(mPreviewFrameSize);
     mBuffer = new MemoryBase(mHeap, 0, mPreviewFrameSize);
@@ -201,12 +209,6 @@
         previewStopped = true;
     }
 
-    if (mPreviewThread != 0) {
-        camera.Uninit();
-        camera.StopStreaming();
-        camera.Close();
-    }
-
     {
         Mutex::Autolock lock(mLock);
         previewThread = mPreviewThread;
@@ -216,6 +218,12 @@
         previewThread->requestExitAndWait();
     }
 
+    if (mPreviewThread != 0) {
+        camera.Uninit();
+        camera.StopStreaming();
+        camera.Close();
+    }
+
     Mutex::Autolock lock(mLock);
     mPreviewThread.clear();
 }
@@ -229,8 +237,8 @@
 {
     Mutex::Autolock lock(mLock);
 
-    mRecordHeap = new MemoryHeapBase(mPreviewFrameSize);
-    mRecordBuffer = new MemoryBase(mRecordHeap, 0, mPreviewFrameSize);
+    mRecordHeap = new MemoryHeapBase(mPreviewFrameSize*3/4);
+    mRecordBuffer = new MemoryBase(mRecordHeap, 0, mPreviewFrameSize*3/4);
     mRecordRunning = true;
 
     return NO_ERROR;
@@ -307,11 +315,12 @@
 
     int width, height;
     mParameters.getPictureSize(&width, &height);
+    mParameters.getPreviewSize(&width, &height);
 
     for(i=0; i<10; i++) {
         sprintf(devnode,"/dev/video%d",i);
         LOGI("trying the node %s \n",devnode);
-        ret = camera.Open(devnode, MIN_WIDTH, MIN_HEIGHT, PIXEL_FORMAT);
+        ret = camera.Open(devnode, width, height, PIXEL_FORMAT);
         if( ret >= 0)
             break;
     }
@@ -374,16 +383,16 @@
     int w, h;
     int framerate;
 
+    mParameters = params;
+    params.getPictureSize(&w, &h);
+    mParameters.setPictureSize(w,h);
     params.getPreviewSize(&w, &h);
+    mParameters.setPreviewSize(w,h);
     framerate = params.getPreviewFrameRate();
     LOGD("PREVIEW SIZE: w=%d h=%d framerate=%d", w, h, framerate);
-
-    params.getPictureSize(&w, &h);
-
     mParameters = params;
-
-    // Set to fixed sizes
-    mParameters.setPreviewSize(MIN_WIDTH,MIN_HEIGHT);
+    mParameters.setPreviewSize(w,h);
+    mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE, supportedFpsRanges);
 
     return NO_ERROR;
 }
diff --git a/libcamera/V4L2Camera.cpp b/libcamera/V4L2Camera.cpp
index 6c0ed4b..78e17b0 100644
--- a/libcamera/V4L2Camera.cpp
+++ b/libcamera/V4L2Camera.cpp
@@ -13,7 +13,6 @@
 #include <utils/threads.h>
 #include <fcntl.h>
 
-#include "converter.h"
 #include "V4L2Camera.h"
 
 extern "C" { /* Android jpeglib.h missed extern "C" */
@@ -204,8 +203,6 @@
     unsigned char *tmpBuffer;
     int ret;
 
-    tmpBuffer = (unsigned char *) calloc (1, videoIn->width * videoIn->height * 2);
-
     videoIn->buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
     videoIn->buf.memory = V4L2_MEMORY_MMAP;
 
@@ -218,11 +215,7 @@
     }
     nDequeued++;
 
-    //memcpy (tmpBuffer, videoIn->mem[videoIn->buf.index], (size_t) videoIn->buf.bytesused);
-    memcpy (tmpBuffer, videoIn->mem[videoIn->buf.index], (size_t) videoIn->buf.bytesused);
-    //convertYUYVtoYUV422SP((uint8_t *)tmpBuffer, (uint8_t *)previewBuffer, videoIn->width, videoIn->height);
-    convert((unsigned char *)tmpBuffer, (unsigned char *)previewBuffer, videoIn->width, videoIn->height);
-
+    memcpy (previewBuffer, videoIn->mem[videoIn->buf.index], (size_t) videoIn->buf.bytesused);
     ret = ioctl(fd, VIDIOC_QBUF, &videoIn->buf);
     if (ret < 0) {
         LOGE("GrabPreviewFrame: VIDIOC_QBUF Failed");
@@ -231,42 +224,8 @@
 
     nQueued++;
 
-    free(tmpBuffer);
 }
 
-void V4L2Camera::GrabRecordFrame (void *recordBuffer)
-{
-    unsigned char *tmpBuffer;
-    int ret;
-
-    tmpBuffer = (unsigned char *) calloc (1, videoIn->width * videoIn->height * 2);
-
-    videoIn->buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-    videoIn->buf.memory = V4L2_MEMORY_MMAP;
-
-    /* DQ */
-    ret = ioctl(fd, VIDIOC_DQBUF, &videoIn->buf);
-    if (ret < 0) {
-        LOGE("GrabRecordFrame: VIDIOC_DQBUF Failed");
-
-        return;
-    }
-    nDequeued++;
-
-    memcpy (tmpBuffer, videoIn->mem[videoIn->buf.index], (size_t) videoIn->buf.bytesused);
-
-    yuyv422_to_yuv420((unsigned char *)tmpBuffer, (unsigned char *)recordBuffer, videoIn->width, videoIn->height);
-
-    ret = ioctl(fd, VIDIOC_QBUF, &videoIn->buf);
-    if (ret < 0) {
-        LOGE("GrabRecordFrame: VIDIOC_QBUF Failed");
-        return;
-    }
-
-    nQueued++;
-
-    free(tmpBuffer);
-}
 
 sp<IMemory> V4L2Camera::GrabRawFrame ()
 {
@@ -452,54 +411,4 @@
     return fileSize;
 }
 
-void V4L2Camera::convert(unsigned char *buf, unsigned char *rgb, int width, int height)
-{
-    int x,y,z=0;
-    int blocks;
-
-    blocks = (width * height) * 2;
-
-    for (y = 0; y < blocks; y+=4) {
-        unsigned char Y1, Y2, U, V;
-
-        Y1 = buf[y + 0];
-        U = buf[y + 1];
-        Y2 = buf[y + 2];
-        V = buf[y + 3];
-
-        yuv_to_rgb16(Y1, U, V, &rgb[y]);
-        yuv_to_rgb16(Y2, U, V, &rgb[y + 2]);
-    }
-
-}
-
-void V4L2Camera::yuv_to_rgb16(unsigned char y, unsigned char u, unsigned char v, unsigned char *rgb)
-{
-    int r,g,b;
-    int z;
-    int rgb16;
-
-    z = 0;
-
-    r = 1.164 * (y - 16) + 1.596 * (v - 128);
-    g = 1.164 * (y - 16) - 0.813 * (v - 128) - 0.391 * (u -128);
-    b = 1.164 * (y - 16) + 2.018 * (u - 128);
-
-    if (r > 255) r = 255;
-    if (g > 255) g = 255;
-    if (b > 255) b = 255;
-
-    if (r < 0) r = 0;
-    if (g < 0) g = 0;
-    if (b < 0) b = 0;
-
-    rgb16 = (int)(((r >> 3)<<11) | ((g >> 2) << 5)| ((b >> 3) << 0));
-
-    *rgb = (unsigned char)(rgb16 & 0xFF);
-    rgb++;
-    *rgb = (unsigned char)((rgb16 & 0xFF00) >> 8);
-
-}
-
-
 }; // namespace android
diff --git a/libcamera/V4L2Camera.h b/libcamera/V4L2Camera.h
index a4cf55b..97255ec 100644
--- a/libcamera/V4L2Camera.h
+++ b/libcamera/V4L2Camera.h
@@ -48,7 +48,6 @@
     int StopStreaming ();
 
     void GrabPreviewFrame (void *previewBuffer);
-    void GrabRecordFrame (void *recordBuffer);
     sp<IMemory> GrabRawFrame ();
     sp<IMemory> GrabJpegFrame ();
 
diff --git a/libcamera/convert.S b/libcamera/convert.S
new file mode 100644
index 0000000..5254a30
--- /dev/null
+++ b/libcamera/convert.S
@@ -0,0 +1,35 @@
+        .arch   armv7-a
+        .fpu    neon
+        .text
+
+        .globl  yuyv422_to_yuv420sp
+        .type   yuyv422_to_yuv420sp, STT_FUNC
+        .func   yuyv422_to_yuv420sp
+yuyv422_to_yuv420sp:
+        push            {r4-r5,lr}
+        mul             r12, r2,  r3
+        add             r4,  r0,  r2,  lsl #1   @ in_1
+        add             r5,  r1,  r2            @ out_1
+        add             lr,  r1,  r12           @ out_uv
+1:
+        mov             r12, r2
+2:
+        vld1.8          {q0},     [r0]!
+        vld1.8          {q1},     [r4]!
+        vuzp.8          d0,  d1
+        vuzp.8          d2,  d3
+        vhadd.u8        d1,  d1,  d3
+        vrev16.8        d1,  d1
+        vst1.8          {d0},     [r1]!
+        vst1.8          {d2},     [r5]!
+        vst1.8          {d1},     [lr]!
+        subs            r12, r12, #8
+        bgt             2b
+        add             r0,  r0,  r2,  lsl #1
+        add             r4,  r4,  r2,  lsl #1
+        add             r1,  r1,  r2
+        add             r5,  r5,  r2
+        subs            r3,  r3,  #2
+        bgt             1b
+        pop             {r4-r5,pc}
+.endfunc
diff --git a/libcamera/converter.cpp b/libcamera/converter.cpp
deleted file mode 100644
index f0dc54d..0000000
--- a/libcamera/converter.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
-**
-** Copyright (C) 2009 0xlab.org - http://0xlab.org/
-** Copyright 2008, The Android Open Source Project
-**
-** This work is based on yuvconverter project.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-#include "converter.h"
-
-void
-yuyv422_to_yuv420(unsigned char *bufsrc, unsigned char *bufdest, int width, int height)
-{
-    unsigned char *ptrsrcy1, *ptrsrcy2;
-    unsigned char *ptrsrcy3, *ptrsrcy4;
-    unsigned char *ptrsrccb1, *ptrsrccb2;
-    unsigned char *ptrsrccb3, *ptrsrccb4;
-    unsigned char *ptrsrccr1, *ptrsrccr2;
-    unsigned char *ptrsrccr3, *ptrsrccr4;
-    int srcystride, srcccstride;
-
-    ptrsrcy1  = bufsrc ;
-    ptrsrcy2  = bufsrc + (width<<1) ;
-    ptrsrcy3  = bufsrc + (width<<1)*2 ;
-    ptrsrcy4  = bufsrc + (width<<1)*3 ;
-
-    ptrsrccb1 = bufsrc + 1;
-    ptrsrccb2 = bufsrc + (width<<1) + 1;
-    ptrsrccb3 = bufsrc + (width<<1)*2 + 1;
-    ptrsrccb4 = bufsrc + (width<<1)*3 + 1;
-
-    ptrsrccr1 = bufsrc + 3;
-    ptrsrccr2 = bufsrc + (width<<1) + 3;
-    ptrsrccr3 = bufsrc + (width<<1)*2 + 3;
-    ptrsrccr4 = bufsrc + (width<<1)*3 + 3;
-
-    srcystride  = (width<<1)*3;
-    srcccstride = (width<<1)*3;
-
-    unsigned char *ptrdesty1, *ptrdesty2;
-    unsigned char *ptrdesty3, *ptrdesty4;
-    unsigned char *ptrdestcb1, *ptrdestcb2;
-    unsigned char *ptrdestcr1, *ptrdestcr2;
-    int destystride, destccstride;
-
-    ptrdesty1 = bufdest;
-    ptrdesty2 = bufdest + width;
-    ptrdesty3 = bufdest + width*2;
-    ptrdesty4 = bufdest + width*3;
-
-    ptrdestcb1 = bufdest + width*height;
-    ptrdestcb2 = bufdest + width*height + (width>>1);
-
-    ptrdestcr1 = bufdest + width*height + ((width*height) >> 2);
-    ptrdestcr2 = bufdest + width*height + ((width*height) >> 2) + (width>>1);
-
-    destystride  = (width)*3;
-    destccstride = (width>>1);
-
-    int i, j;
-
-    for(j=0; j<(height/4); j++)
-    {
-        for(i=0;i<(width/2);i++)
-        {
-            (*ptrdesty1++) = (*ptrsrcy1);
-            (*ptrdesty2++) = (*ptrsrcy2);
-            (*ptrdesty3++) = (*ptrsrcy3);
-            (*ptrdesty4++) = (*ptrsrcy4);
-
-            ptrsrcy1 += 2;
-            ptrsrcy2 += 2;
-            ptrsrcy3 += 2;
-            ptrsrcy4 += 2;
-
-            (*ptrdesty1++) = (*ptrsrcy1);
-            (*ptrdesty2++) = (*ptrsrcy2);
-            (*ptrdesty3++) = (*ptrsrcy3);
-            (*ptrdesty4++) = (*ptrsrcy4);
-
-            ptrsrcy1 += 2;
-            ptrsrcy2 += 2;
-            ptrsrcy3 += 2;
-            ptrsrcy4 += 2;
-
-            (*ptrdestcb1++) = (*ptrsrccb1);
-            (*ptrdestcb2++) = (*ptrsrccb3);
-
-            ptrsrccb1 += 4;
-            ptrsrccb3 += 4;
-
-            (*ptrdestcr1++) = (*ptrsrccr1);
-            (*ptrdestcr2++) = (*ptrsrccr3);
-
-            ptrsrccr1 += 4;
-            ptrsrccr3 += 4;
-
-        }
-
-
-        /* Update src pointers */
-        ptrsrcy1  += srcystride;
-        ptrsrcy2  += srcystride;
-        ptrsrcy3  += srcystride;
-        ptrsrcy4  += srcystride;
-
-        ptrsrccb1 += srcccstride;
-        ptrsrccb3 += srcccstride;
-
-        ptrsrccr1 += srcccstride;
-        ptrsrccr3 += srcccstride;
-
-
-        /* Update dest pointers */
-        ptrdesty1 += destystride;
-        ptrdesty2 += destystride;
-        ptrdesty3 += destystride;
-        ptrdesty4 += destystride;
-
-        ptrdestcb1 += destccstride;
-        ptrdestcb2 += destccstride;
-
-        ptrdestcr1 += destccstride;
-        ptrdestcr2 += destccstride;
-
-    }
-}
-
-void
-yuyv422_to_yuv420sp(unsigned char *bufsrc, unsigned char *bufdest, int width, int height)
-{
-    unsigned char *ptrsrcy1, *ptrsrcy2;
-    unsigned char *ptrsrcy3, *ptrsrcy4;
-    unsigned char *ptrsrccb1, *ptrsrccb2;
-    unsigned char *ptrsrccb3, *ptrsrccb4;
-    unsigned char *ptrsrccr1, *ptrsrccr2;
-    unsigned char *ptrsrccr3, *ptrsrccr4;
-    int srcystride, srcccstride;
-
-    ptrsrcy1  = bufsrc ;
-    ptrsrcy2  = bufsrc + (width<<1) ;
-    ptrsrcy3  = bufsrc + (width<<1)*2 ;
-    ptrsrcy4  = bufsrc + (width<<1)*3 ;
-
-    ptrsrccb1 = bufsrc + 1;
-    ptrsrccb2 = bufsrc + (width<<1) + 1;
-    ptrsrccb3 = bufsrc + (width<<1)*2 + 1;
-    ptrsrccb4 = bufsrc + (width<<1)*3 + 1;
-
-    ptrsrccr1 = bufsrc + 3;
-    ptrsrccr2 = bufsrc + (width<<1) + 3;
-    ptrsrccr3 = bufsrc + (width<<1)*2 + 3;
-    ptrsrccr4 = bufsrc + (width<<1)*3 + 3;
-
-    srcystride  = (width<<1)*3;
-    srcccstride = (width<<1)*3;
-
-    unsigned char *ptrdesty1, *ptrdesty2;
-    unsigned char *ptrdesty3, *ptrdesty4;
-    unsigned char *ptrdestcb1, *ptrdestcb2;
-    unsigned char *ptrdestcr1, *ptrdestcr2;
-    int destystride, destccstride;
-
-    ptrdesty1 = bufdest;
-    ptrdesty2 = bufdest + width;
-    ptrdesty3 = bufdest + width*2;
-    ptrdesty4 = bufdest + width*3;
-
-    ptrdestcb1 = bufdest + width*height;
-    ptrdestcb2 = bufdest + width*height + width;
-
-    ptrdestcr1 = bufdest + width*height + 1;
-    ptrdestcr2 = bufdest + width*height + width + 1;
-
-    destystride  = (width)*3;
-    destccstride = width;
-
-    int i, j;
-
-    for(j=0; j<(height/4); j++)
-    {
-        for(i=0;i<(width/2);i++)
-        {
-            (*ptrdesty1++) = (*ptrsrcy1);
-            (*ptrdesty2++) = (*ptrsrcy2);
-            (*ptrdesty3++) = (*ptrsrcy3);
-            (*ptrdesty4++) = (*ptrsrcy4);
-
-            ptrsrcy1 += 2;
-            ptrsrcy2 += 2;
-            ptrsrcy3 += 2;
-            ptrsrcy4 += 2;
-
-            (*ptrdesty1++) = (*ptrsrcy1);
-            (*ptrdesty2++) = (*ptrsrcy2);
-            (*ptrdesty3++) = (*ptrsrcy3);
-            (*ptrdesty4++) = (*ptrsrcy4);
-
-            ptrsrcy1 += 2;
-            ptrsrcy2 += 2;
-            ptrsrcy3 += 2;
-            ptrsrcy4 += 2;
-
-            (*ptrdestcb1) = (*ptrsrccb1);
-            (*ptrdestcb2) = (*ptrsrccb3);
-            ptrdestcb1 += 2;
-            ptrdestcb2 += 2;
-
-            ptrsrccb1 += 4;
-            ptrsrccb3 += 4;
-
-            (*ptrdestcr1) = (*ptrsrccr1);
-            (*ptrdestcr2) = (*ptrsrccr3);
-            ptrdestcr1 += 2;
-            ptrdestcr2 += 2;
-
-            ptrsrccr1 += 4;
-            ptrsrccr3 += 4;
-
-        }
-
-
-        /* Update src pointers */
-        ptrsrcy1  += srcystride;
-        ptrsrcy2  += srcystride;
-        ptrsrcy3  += srcystride;
-        ptrsrcy4  += srcystride;
-
-        ptrsrccb1 += srcccstride;
-        ptrsrccb3 += srcccstride;
-
-        ptrsrccr1 += srcccstride;
-        ptrsrccr3 += srcccstride;
-
-
-        /* Update dest pointers */
-        ptrdesty1 += destystride;
-        ptrdesty2 += destystride;
-        ptrdesty3 += destystride;
-        ptrdesty4 += destystride;
-
-        ptrdestcb1 += destccstride;
-        ptrdestcb2 += destccstride;
-
-        ptrdestcr1 += destccstride;
-        ptrdestcr2 += destccstride;
-
-    }
-}
diff --git a/libcamera/converter.h b/libcamera/converter.h
deleted file mode 100644
index e7ecf40..0000000
--- a/libcamera/converter.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-**
-** Copyright (C) 2009 0xlab.org - http://0xlab.org/
-** Copyright 2008, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-**     http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-#ifndef CONVERTER_H
-#define CONVERTER_H
-
-void yuyv422_to_yuv420(unsigned char *bufsrc, unsigned char *bufdest, int width, int height);
-void yuyv422_to_yuv420sp(unsigned char *bufsrc, unsigned char *bufdest, int width, int height);
-
-#endif