rk3288拍照picture左右镜像镜像

全路径diff --git a/hardware/rockchip/camera/CameraHal/AppMsgNotifier.cpp b/CameraHal/AppMsgNotifier.cpp  纯粹记录日志
index 8c074f3..64ee207 100755
--- a/CameraHal/AppMsgNotifier.cpp
+++ b/CameraHal/AppMsgNotifier.cpp
@@ -1447,6 +1447,17 @@ int AppMsgNotifier::captureEncProcessPicture(FramInfo_s* frame){
         callback_notify_shutter();
 
     LOGD("captureEncProcessPicture,rotation = %d,jpeg_w = %d,jpeg_h = %d",rotation,jpeg_w,jpeg_h);
+    
+    //mirror
+    if(1) //(mDataCbFrontMirror)
+        {
+        char *dbuf = (char*)malloc(frame->frame_width*frame->frame_height*3/2);
+        YuvData_Mirror(V4L2_PIX_FMT_NV12, (char*)frame->vir_addr,(char*)dbuf, frame->frame_width, frame->frame_height);
+        memcpy((void*)frame->vir_addr,dbuf,frame->frame_width*frame->frame_height*3/2);
+        free(dbuf);
+
+        }
 
     //2. copy to output buffer for mirro and flip
     /*[email protected]: v0.4.7*/


diff --git a/CameraHal/CameraHal.h b/CameraHal/CameraHal.h
index e53fe49..3da2beb 100755
--- a/CameraHal/CameraHal.h
+++ b/CameraHal/CameraHal.h
@@ -112,6 +112,10 @@ extern "C" int rk_camera_yuv_scale_crop_ipp(int v4l2_fmt_src, int v4l2_fmt_dst,
 extern "C"  int YData_Mirror_Line(int v4l2_fmt_src, int *psrc, int *pdst, int w);
 extern "C"  int UVData_Mirror_Line(int v4l2_fmt_src, int *psrc, int *pdst, int w);
 extern "C"  int YuvData_Mirror_Flip(int v4l2_fmt_src, char *pdata, char *pline_tmp, int w, int h);
+extern "C"  int YuvData_Mirror(int v4l2_fmt_src, char *pdata, char *pline_tmp, int w, int h);

 extern "C" int YUV420_rotate(const unsigned char* srcy, int src_stride,  unsigned char* srcuv,
                    unsigned char* dsty, int dst_stride, unsigned char* dstuv,
                    int width, int height,int rotate_angle);
diff --git a/CameraHal/CameraHalUtil.cpp b/CameraHal/CameraHalUtil.cpp
index bd31b31..bd932c0 100755
--- a/CameraHal/CameraHalUtil.cpp
+++ b/CameraHal/CameraHalUtil.cpp
@@ -1185,6 +1185,104 @@ extern "C"  int YuvData_Mirror_Flip(int v4l2_fmt_src, char *pdata, char *pline_t
 YuvData_Mirror_Flip_end:
     return err;
 }
+
+//xhh add yuv data mirror
+extern "C"  int YuvData_Mirror(int v4l2_fmt_src, char *pdata, char *pline_tmp, int w, int h)
+{
+    int err = 0,i,j;

+    //420sp
+        int *pdst = NULL;
+        int *psrc;
+
+        pdst = (int*)pline_tmp;
+
+        psrc = (int*)pdata;
+        for (j=0; j +            YData_Mirror_Line(v4l2_fmt_src, psrc, pdst+((w>>2)-1),w);
+            psrc += (w>>2);
+            pdst += (w>>2);
+        }
+        
+        // UV mirror
+        psrc = (int*)(pdata+w*h);
+        pdst = (int*)(pline_tmp+w*h);
+        for (j=0; j<(h>>1); j++) {
+            UVData_Mirror_Line(v4l2_fmt_src, psrc, pdst+((w>>2)-1),w);
+            psrc += (w>>2);
+            pdst += (w>>2);
+        }

+
+YuvData_Mirror_end:
+    return err;
+}
+

     
 

你可能感兴趣的:(android源码相关)