[RK3288][Android6.0] 调试笔记 --- UVC Camera jpg和yuv数据帧dump

Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92

diff --git a/CameraHal/CameraUSBAdapter.cpp b/CameraHal/CameraUSBAdapter.cpp
index 2dcd1fa..fdca035 100644
--- a/CameraHal/CameraUSBAdapter.cpp
+++ b/CameraHal/CameraUSBAdapter.cpp
@@ -915,6 +915,7 @@ int CameraUSBAdapter::reprocessFrame(FramInfo_s* frame)
 {
     int ret = 0;
    long phy_addr;
+   static int frameCount=0;

    if(gCamInfos[mCamId].pcam_total_info->mIsIommuEnabled)
        phy_addr = mPreviewBufProvider->getBufShareFd(frame->frame_index);
@@ -931,6 +932,26 @@ int CameraUSBAdapter::reprocessFrame(FramInfo_s* frame)
         output_len = 0;
         input_len = frame->frame_size;

+
+#if 0
+   {
+        if(++frameCount>10 && frameCount<16){
+          FILE* fp =NULL;
+          char filename[40];
+          filename[0] = 0x00;
+          sprintf(filename, "/data/dump/raw1_%dx%d_%d.jpg",frame->frame_width,frame->frame_height,frameCount);
+          fp = fopen(filename, "wb+");
+          if (fp > 0) {
+               fwrite((char*)frame->vir_addr, 1,input_len,fp);
+               fclose(fp);
+               LOGD("Write success mjpeg data to %s",filename);
+          } else {
+               LOGE("Create %s failed(%d, %s)",filename,fp, strerror(errno));
+          }
+        }
+   }
+#endif
+
         ret = mMjpegDecoder.decode(mMjpegDecoder.decoder,
                                     (unsigned char*)&outbuf, &output_len, 
                                      (unsigned char*)frame->vir_addr, &input_len,
@@ -976,6 +997,24 @@ int CameraUSBAdapter::reprocessFrame(FramInfo_s* frame)
            free(buf);
        }
    }
+#if 0
+   {
+        if(frameCount>10 && frameCount<16){
+          FILE* fp =NULL;
+          char filename[40];
+          filename[0] = 0x00;
+          sprintf(filename, "/data/dump/raw2_%dx%d_%d.yuv",w,h,frameCount);
+          fp = fopen(filename, "wb+");
+          if (fp > 0) {
+               fwrite((char*)frame->vir_addr, 1,w*h*3/2,fp);
+               fclose(fp);
+               LOGD("Write success yuv data to %s",filename);
+          } else {
+               LOGE("Create %s failed(%d, %s)",filename,fp, strerror(errno));
+          }
+        }
+   }
+#endif

     //do zoom here?
     return ret;

你可能感兴趣的:(子类__Camera,UVC,camera,yuv,jpg,dump)