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
     /*ddl@rock-chips.com: 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<h; 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;
+}
+

     
 

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值