This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/TMS320DM368: Capture 720P-30 YUV422 from camera OV5640 .

Part Number: TMS320DM368

Tool/software: Linux

Hi  !

I'm trying to capture video frames from the camera in 720p-30 (YUV 422) mode with the subsequent compression of the H264 codec, but frame capture occurs at a frequency of half the time, that is, 15 Hz.

My set:

Camera( OV5640 720P-30  YUV 422) ----> LEOPARDBOARD( DM368 ARM 432 MHz  DDR: 340 MHz ) ---> Linux DVSDK 4.02.00.06-->program capture ENCODE (from DVSDK) display video output OFF.

encode log:

ARM Load: 2% Video fps: 15 fps Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: N/A Sound Codec: N/A Sampling Freq: N/A 
............... ARM Load: 0% Video fps: 15 fps Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: N/A Sound Codec: N/A Sampling Freq: N/A ARM Load: 0% Video fps: 15 fps Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: N/A Sound Codec: N/A Sampling Freq: N/A



in Capture.c file (dmai_2_20_00_15) :

/* In DM365 the capture driver does not support 720P-30, but the
LSP has an option to reduce the capture rate to half. So when user
sets for 720P-30, we treat it as 720P-60 except we set LSP capture
rate to half. */
/* NOTE: make execption for DM368 camera input which supports 720P-30*/

I tried to forcefully disable halfRateCapture = TRUE;

In the state halfRateCapture = FALSE;

As a result, frames are no longer captured at all .....

encode log:

ARM Load: 3% Video fps: 0 fps Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: N/A Sound Codec: N/A Sampling Freq: N/A 
................. ARM Load: 0% Video fps: 0 fps Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: N/A Sound Codec: N/A Sampling Freq: N/A ARM Load: 0% Video fps: 0 fps Demo: Encode Display: 720P 60Hz Video Codec: H.264 HP Resolution: N/A Sound Codec: N/A Sampling Freq: N/A


I tried to apply recommendations for optimizing the DM36x:

MSTPRI0: 0x00550011(default) to 0x00440022 or 0x00440011 or 0x00220044
DMA_RZA: 0x00(default) to 0x20 or 0x40 or 0x80 or 0x90

The result is the same 0 frames received.

I tried to lower the frame rate of the camera to 4-10 Hz, the result is the same 0 frames captured.

What needs to be done to capture frames without missing every second frame ?
Tell me how to solve this problem ?
what am I doing wrong ? what could be the problem ?

My log VPFE register.

11.log
IPIPEIF ADDRU = 0x0
IPIPEIF ADDRL = 0x0
IPIPEIF ADOFS = 0x0
IPIPEIF RSZ = 0x10
IPIPEIF GAIN = 0x200
IPIPEIF DPCM = 0x0
IPIPEIF CFG2 = 0x48
IPIPEIF INIRSZ = 0x0
IPIPEIF OCLIP = fff
IPIPEIF DTUDF = 0
IPIPEIF CLKDIV = 1
IPIPEIF DPC1 = 0
IPIPEIF DPC2  = 0
IPIPEIF DFSGVL  = 0
IPIPEIF DFSGTH  = fff
IPIPEIF RSZ3A  = 10
IPIPEIF INIRSZ3A  = 0
IPIPE Registers
**************************************************
IPIPE_SRC_EN = 0x0
IPIPE_SRC_MODE = 0x0
IPIPE_SRC_FMT = 0x3
IPIPE_SRC_COL = 0xe4
IPIPE_SRC_VPS = 0x1
IPIPE_SRC_VSZ = 0x2cf
IPIPE_SRC_HPS = 0x0
IPIPE_SRC_HSZ = 0x4ff
IPIPE_SEL_SBU = 0x0
IPIPE_DMA_STA = 0x0
IPIPE_GCK_MMR = 0x1
IPIPE_GCK_PIX = 0xe
Resizer Registers
**************************************************
RSZ_SRC_EN = 0x0
RSZ_SRC_MODE = 0x0
RSZ_SRC_FMT0 = 0x0
RSZ_SRC_FMT1 = 0x0
RSZ_SRC_VPS = 0x0
RSZ_SRC_VSZ = 0x2cf
RSZ_SRC_HPS = 0x0
RSZ_SRC_HSZ = 0x4ff
RSZ_DMA_RZA = 0x90
RSZ_DMA_RZB = 0x0
RSZ_DMA_STA = 0x0
RSZ_GCK_MMR = 0x1
RSZ_GCK_SDR = 0x1
RSZ_IRQ_RZA = 0x1fff
RSZ_IRQ_RZB = 0x1fff
RSZ_YUV_Y_MIN = 0x0
RSZ_YUV_Y_MAX = 0xff
RSZ_YUV_C_MIN = 0x0
RSZ_YUV_C_MAX = 0xff
RSZ_YUV_PHS = 0x0
RSZ_SEQ = 0x0
RSZ A EN = 0x0
RSZ A MODE = 0x0
RSZ A 420 = 0x3
RSZ A I_VPS = 0x0
RSZ A I_HPS = 0x0
RSZ A O_VSZ = 0x2cf
RSZ A O_HSZ = 0x4ff
RSZ A V_PHS_Y = 0x0
RSZ A V_PHS_C = 0x0
RSZ A V_DIF = 0x100
RSZ A V_TYP = 0x0
RSZ A V_LPF = 0x0
RSZ A H_PHS = 0x0
RSZ A H_PHS_ADJ = 0x0
RSZ A H_DIF = 0x100
RSZ A H_TYP = 0x0
RSZ A H_LPF = 0x0
RSZ A DWN_EN = 0x0
RSZ A DWN_AV = 0x0
RSZ A RGB_EN = 0x0
RSZ A RGB_TYP = 0x0
RSZ A RGB_BLD = 0x0
RSZ A SDR_Y_BAD_H = 0x86ef
RSZ A SDR_Y_BAD_L = 0xa000
RSZ A SDR_Y_SAD_H = 0x86ef
RSZ A SDR_Y_SAD_L = 0xa000
RSZ A SDR_Y_OFT = 0x500
RSZ A SDR_Y_Y_PTR_S = 0x0
RSZ A SDR_Y_PTR_E = 0x2d0
RSZ A SDR_C_BAD_H = 0x86fd
RSZ A SDR_C_BAD_L = 0xb000
RSZ A SDR_C_SAD_H = 0x86fd
RSZ A SDR_C_SAD_L = 0xb000
RSZ A SDR_C_OFT = 0x500
RSZ A SDR_C_PTR_S = 0x0
RSZ A SDR_C_PTR_E = 0x168
RSZ B EN = 0x0
RSZ B MODE = 0x0
RSZ B 420 = 0x0
RSZ B I_VPS = 0x0
RSZ B I_HPS = 0x0
RSZ B O_VSZ = 0x0
RSZ B O_HSZ = 0x1
RSZ B V_PHS_Y = 0x0
RSZ B V_PHS_C = 0x0
RSZ B V_DIF = 0x100
RSZ B V_TYP = 0x0
RSZ B V_LPF = 0x0
RSZ B H_PHS = 0x0
RSZ B H_PHS_ADJ = 0x0
RSZ B H_DIF = 0x100
RSZ B H_TYP = 0x0
RSZ B H_LPF = 0x0
RSZ B DWN_EN = 0x0
RSZ B DWN_AV = 0x0
RSZ B RGB_EN = 0x0
RSZ B RGB_TYP = 0x0
RSZ B RGB_BLD = 0x0
RSZ B SDR_Y_BAD_H = 0x0
RSZ B SDR_Y_BAD_L = 0x0
RSZ B SDR_Y_SAD_H = 0x0
RSZ B SDR_Y_SAD_L = 0x0
RSZ B SDR_Y_OFT = 0x0
RSZ B SDR_Y_Y_PTR_S = 0x0
RSZ B SDR_Y_PTR_E = 0x1fff
RSZ b SDR_C_BAD_H = 0x0
RSZ B SDR_C_BAD_L = 0x0
RSZ B SDR_C_SAD_H = 0x0
RSZ B SDR_C_SAD_L = 0x0
RSZ B SDR_C_OFT = 0x0
RSZ B SDR_C_PTR_S = 0x0
RSZ B SDR_C_PTR_E = 0x1fff




  • Hi Georgy,

    1. Have you tried reducing the frame rate from the OV sensor end itself to 15fps and revert the flag changes ? In that case you will be not missing frames, but fps will be 15.
    2. I am not sure how/where is the pipeline settings in v4l2 based framework. Let me check it, but what I am trying to say is ISIF_IN->IPIPEIF->RESZ->ENCODER->DDR pipeline you can follow instead of ISIF_IN->DDR->IPIPE->RSZ->ENCODER->DDR flow(though I am not sure what you are following now, since no logs). I am not seeing full register dump ISIF and IPIPEIF initial registers missing. hope you are taking dump, when pipeline is running.

    You should be able to achieve 1080@30 fps with DM368(hardware max capable performance), though we have seen this using IPNC RDK package and not DVSDK package.
  • Hi !

    I lowered the frame rate of the camera from 30Hz to 15Hz (and even from 15Hz to 7Hz), the result is the same.

    if halfRateCapture = TRUE then result frame capture / 2  -> 15/2 = 7, capture ok,(interrupt vpfe present)

    if halfRateCapture = FALSE then  result frame capture / 1  -> 15/1 = 0, No capture(NO interrupt vpfe).

    The output capture does not depend on the frame rate, but depends on the state of the HalfRateCapture flag.

    My application capture.c + dump registers ISIF, IPIPEIF, IPIPE, RSZ in the attachment.

    Capture.c
    /******************************************************************************
     * Capture_create
     ******************************************************************************/
    Capture_Handle Capture_create(BufTab_Handle hBufTab, Capture_Attrs *attrs)
    {
        struct v4l2_capability      cap;
        struct v4l2_cropcap         cropCap;
        struct v4l2_crop            crop;
        struct v4l2_format          fmt;
        enum v4l2_buf_type          type;
        Capture_Handle              hCapture;
        VideoStd_Type               videoStd, videoStdOld;
        Int32                       width, height;
        Uint32                      pixelFormat;
        Bool                        halfRateCapture = FALSE;
        struct v4l2_control         ctrl;
    
        assert(attrs);
        Dmai_clear(fmt);
    
    //	printf("DMAI: Capture_create !\n");
    
        /* Allocate space for state object */
    //	printf("DMAI: TRY calloc.\n");
        hCapture = calloc(1, sizeof(Capture_Object));
    
        if (hCapture == NULL) {
            Dmai_err0("Failed to allocate space for Capture Object\n");
            return NULL;
        }
    
        /* User allocated buffers by default */
        hCapture->userAlloc = TRUE;
    
        /* In DM365 the capture driver does not support 720P-30, but the
        LSP has an option to reduce the capture rate to half. So when user
        sets for 720P-30, we treat it as 720P-60 except we set LSP capture
        rate to half. */
        /* NOTE: make execption for DM368 camera input which supports 720P-30*/
        if (attrs->videoStd == VideoStd_720P_30 && attrs->videoInput != 
                Capture_Input_CAMERA) {
           halfRateCapture = TRUE;
           attrs->videoStd = VideoStd_720P_60;
           printf("DMAI: !!! halfRateCapture = TRUE; attrs->videoStd = VideoStd_720P_60;\n");
        }
    
    //       halfRateCapture = TRUE;
    
    	printf("DMAI: TRY onTheFly.\n");
    
        if (attrs->onTheFly == TRUE) {
    	printf("DMAI: attrs->onTheFly == TRUE\n");
    
    	printf("DMAI: TRY Resizer_continuous_config\n");
            hCapture->resizerFd = Resizer_continuous_config();
    	printf("DMAI: hCapture->resizerFd = %d\n",hCapture->resizerFd);
    
            if(hCapture->resizerFd <= 0) {
                Dmai_err0("Unable to configure Resizer\n");
                cleanup(hCapture);
                return NULL;            
            }
    
    	printf("DMAI: TRY Previewer_continuous_config\n");
            hCapture->previewerFd = Previewer_continuous_config(attrs->videoInput 
                == Capture_Input_CAMERA ? 1 : 0);
    	printf("DMAI: hCapture->previewerFd = %d\n",hCapture->previewerFd);
    
            if(hCapture->previewerFd <= 0) {
                Dmai_err0("Unable to configure Previewer\n");
                cleanup(hCapture);
                return NULL;            
            }
        }
    
        /* Open video capture device */
    	printf("DMAI: TRY open file=%s.\n", attrs->captureDevice);
        hCapture->fd = open(attrs->captureDevice, O_RDWR, 0);
    	printf("DMAI: TRY open fd =%d\n", hCapture->fd);
        if (hCapture->fd == -1) {
            Dmai_err2("Cannot open %s (%s)\n", attrs->captureDevice,
                                               strerror(errno));
            cleanup(hCapture);
            return NULL;
        }
    
        /* See if an input is connected, and if so which standard */
    	printf("DMAI: TRY detectVideoStd.\n");
        videoStdOld = attrs->videoStd;
        if (Capture_detectVideoStd(hCapture, &videoStd, attrs) < 0) {
    	Dmai_err0("Capture_detectVideoStd FAILED!\n");
            printf("ERROR:Capture_detectVideoStd FAILED!\n");
            cleanup(hCapture);
            return NULL;
        }
    
        if (videoStdOld != videoStd) {
            Dmai_dbg0("New video standard detected.\n");
            printf("New video standard detected.\n");
        }
    
        if (videoStdOld != VideoStd_AUTO) {
            Dmai_dbg0("Forcing user specified video standard\n");
            printf("Forcing user specified video standard\n");
            videoStd = videoStdOld;        
        }
    
        hCapture->videoStd = videoStd;
    
    	printf("DMAI: TRY getResolution.\n");
    
        if (VideoStd_getResolution(videoStd, &width, &height) < 0) {
            cleanup(hCapture);
            Dmai_err0("Failed to get resolution of capture video standard\n");
            return NULL;
        }
    
        /* DM365 can have a resizer chained to the capture device. In this case, 
        capture driver can take non-standard resolution. */
        if(attrs->captureDimension != NULL) {
            height = attrs->captureDimension->height;
            width  = attrs->captureDimension->width;
        }
        Dmai_dbg2("Capture dimention is set to %ldx%ld\n", 
            width, height);    
        printf("Capture dimention is set to %ldx%ld\n", 
            width, height);    
    
        /* Query for capture device capabilities */
    	printf("DMAI: TRY VIDIOC_QUERYCAP.\n");
        if (ioctl(hCapture->fd, VIDIOC_QUERYCAP, &cap) == -1) {
            cleanup(hCapture);
            if (errno == EINVAL) {
                Dmai_err1("%s is no V4L2 device\n", attrs->captureDevice);
                cleanup(hCapture);
                return NULL;
            }
            Dmai_err2("Failed VIDIOC_QUERYCAP on %s (%s)\n", attrs->captureDevice,
                                                           strerror(errno));
            cleanup(hCapture);
            return NULL;
        }
    
        if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
            Dmai_err1("%s is not a video capture device\n", attrs->captureDevice);
            cleanup(hCapture);
            return NULL;
        }
    
        if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
            Dmai_err1("%s does not support streaming i/o\n", attrs->captureDevice);
            cleanup(hCapture);
            return NULL;
        }
    
        fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        if (ioctl(hCapture->fd, VIDIOC_G_FMT, &fmt) == -1) {
            Dmai_err2("Failed VIDIOC_G_FMT on %s (%s)\n", attrs->captureDevice,
                                                          strerror(errno));
            cleanup(hCapture);
            return NULL;
        }
    
        fmt.fmt.pix.width        = width;
        fmt.fmt.pix.height       = height; 
        fmt.type                 = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    
        switch(attrs->colorSpace) {
            case ColorSpace_UYVY: 
                fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
                break;
            case ColorSpace_YUV420PSEMI:
                fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_NV12;
                break;
            case ColorSpace_YUV422PSEMI:
                fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_NV16;
                break;
            default:
                Dmai_err1("Unsupported color format %g\n", attrs->colorSpace);            
                cleanup(hCapture);
                return NULL;
        }
    
        fmt.fmt.pix.bytesperline = 0;
        fmt.fmt.pix.sizeimage = 0;
        pixelFormat = fmt.fmt.pix.pixelformat;
        
        if ((videoStd == VideoStd_CIF) || (videoStd == VideoStd_SIF_PAL) || 
            (videoStd == VideoStd_SIF_NTSC) || (videoStd == VideoStd_D1_PAL) ||
            (videoStd == VideoStd_D1_NTSC) || (videoStd == VideoStd_1080I_30) ||
            (videoStd == VideoStd_1080I_25) || (videoStd == VideoStd_1080I_60)) { 
            fmt.fmt.pix.field        = V4L2_FIELD_INTERLACED;
        } else {
            fmt.fmt.pix.field        = V4L2_FIELD_NONE;
        }
    
        if (attrs->videoInput == Capture_Input_CAMERA) {
            ctrl.id = V4L2_CID_EXPOSURE;
            if (videoStd == VideoStd_D1_PAL) {
                ctrl.value = 0x556;//FIX MY: PAL 25 Hz
            }
            /* Set flicker setting to 60 Hz for camera for better picture */
            else if (videoStd == VideoStd_720P_30
                || videoStd == VideoStd_720P_50
                || videoStd == VideoStd_720P_60) {
                ctrl.value = 0x312;//FIX MY: 720p 25 Hz
            }
            else if (videoStd == VideoStd_1080P_30
                || videoStd == VideoStd_1080P_50
                || videoStd == VideoStd_1080P_60
                || videoStd == VideoStd_1080I_25
                || videoStd == VideoStd_1080I_30) {
                ctrl.value = 0x456;
            }
            else {
                ctrl.value = 0x5F4;
            }
    
            if (-1 == ioctl (hCapture->fd, VIDIOC_S_CTRL, &ctrl)) {
                Dmai_err0("VIDIOC_S_EXPOSURE failed\n");
                return NULL;
            }
    
            fmt.fmt.pix.field     = V4L2_FIELD_NONE;
    
            if (attrs->colorSpace == ColorSpace_YUV420PSEMI) {
                fmt.fmt.pix.bytesperline = ((width + 31) & ~31);
                fmt.fmt.pix.sizeimage = ((fmt.fmt.pix.bytesperline * height) + (fmt.fmt.pix.bytesperline * (height >>1)));
            }
    
            if (attrs->colorSpace == ColorSpace_UYVY) {
                fmt.fmt.pix.bytesperline = width * 2;
                fmt.fmt.pix.sizeimage = (fmt.fmt.pix.bytesperline * height);
            }
        }
        if (ioctl(hCapture->fd, VIDIOC_TRY_FMT, &fmt) == -1) {
            Dmai_err2("Failed VIDIOC_TRY_FMT on %s (%s)\n", attrs->captureDevice,
                                                            strerror(errno));
            cleanup(hCapture);
            return NULL;
        }
        if (ioctl(hCapture->fd, VIDIOC_S_FMT, &fmt) == -1) {
            Dmai_err2("Failed VIDIOC_S_FMT on %s (%s)\n", attrs->captureDevice,
                                                          strerror(errno));
            printf("DMAI: ERROR: VIDIOC_S_FMT.\n");
            cleanup(hCapture);
            return NULL;
        }
    
        if ((fmt.fmt.pix.width != width)  || (fmt.fmt.pix.height != height)) {
            Dmai_err4("Failed to set resolution %d x %d (%d x %d)\n", width,
                        height, fmt.fmt.pix.width, fmt.fmt.pix.height);
            cleanup(hCapture);
            return NULL;
        }
    
        Dmai_dbg3("Video input connected size %dx%d pitch %d\n",
                  fmt.fmt.pix.width, fmt.fmt.pix.height, fmt.fmt.pix.bytesperline);
    
        printf("DMAI: ? halfRateCapture == TRUE.\n");
    
        if (halfRateCapture == TRUE) {
            v4l2_std_id std;        
            struct v4l2_streamparm streamparam, streamparam_s;
    
            Dmai_dbg0("Setting capture frame rate to half.\n");
    
    	printf("Setting capture frame rate to half.\n");
    	printf("DMAI: VIDIOC_QUERYSTD.\n");
    
            if (ioctl(hCapture->fd, VIDIOC_QUERYSTD, &std) < 0) {
                Dmai_err1("VIDIOC_QUERYSTD failed (%s)\n", strerror(errno));
                printf("VIDIOC_QUERYSTD failed (%s)\n", strerror(errno));
                cleanup(hCapture);
                return NULL;
            }
    
    std = V4L2_STD_720P_60; //My add
    
            if (std != V4L2_STD_720P_60) {
                Dmai_err1("Video standard set to 0%lx, required is 720P_60\n", std);
                printf("Video standard set to 0%lx, required is 720P_60\n", std);
                cleanup(hCapture);
                return NULL;        
            }
        
            /* set the streaming parameter to reduce the capture frequency to half */
            Dmai_clear(streamparam);
            streamparam.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            streamparam.parm.capture.timeperframe.numerator = 1;
            streamparam.parm.capture.timeperframe.denominator = 30; 
            streamparam_s = streamparam;
    
    	printf("DMAI: VIDIOC_S_PARM.\n");
            
            if (ioctl(hCapture->fd, VIDIOC_S_PARM , &streamparam) < 0) {
                Dmai_err1("VIDIOC_S_PARM failed (%s)\n", strerror(errno));
                cleanup(hCapture);
                return NULL;
            }
    
    	printf("DMAI: VIDIOC_G_PARM.\n");
            /* verify the params */
            if (ioctl(hCapture->fd, VIDIOC_G_PARM, &streamparam) < 0) {
                Dmai_err1("VIDIOC_G_PARM failed (%s)\n", strerror(errno));
                cleanup(hCapture);
                return NULL;
            }
    
    printf("PARAM num=%d deno=%d\n", streamparam.parm.capture.timeperframe.numerator, streamparam.parm.capture.timeperframe.denominator);
    printf("PARAM num_s=%d deno_s=%d\n", streamparam_s.parm.capture.timeperframe.numerator, streamparam_s.parm.capture.timeperframe.denominator);
    
            if ((streamparam.parm.capture.timeperframe.numerator != 
                streamparam_s.parm.capture.timeperframe.numerator) ||
                (streamparam.parm.capture.timeperframe.denominator !=
                streamparam_s.parm.capture.timeperframe.denominator)) {
                Dmai_err0("Could not set capture driver for 30fps\n");
    	    printf("Could not set capture driver for 30fps\n");
                cleanup(hCapture);
                return NULL;            
            }
    
        }
    	printf("DMAI: if (attrs->cropWidth > 0 && attrs->cropHeight > 0)\n");
        if (attrs->cropWidth > 0 && attrs->cropHeight > 0) {
    
    	printf("DMAI: VIDIOC_CROPCAP.\n");
    
            cropCap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            if (ioctl(hCapture->fd, VIDIOC_CROPCAP, &cropCap) == -1) {
                Dmai_err2("VIDIOC_CROPCAP failed on %s (%s)\n", attrs->captureDevice,
                                                                strerror(errno));
                cleanup(hCapture);
                return NULL;
            }
    
            if (attrs->cropX & 0x1) {
                Dmai_err1("Crop width (%ld) needs to be even\n", attrs->cropX);
                cleanup(hCapture);
                return NULL;
            }
    
            crop.type     = V4L2_BUF_TYPE_VIDEO_CAPTURE;
            crop.c.left   = attrs->cropX;
            crop.c.top    = attrs->cropY;
            crop.c.width  = attrs->cropWidth;
            crop.c.height = hCapture->topOffset ? attrs->cropHeight + 4 + 2 :
                                                  attrs->cropHeight;
    
            Dmai_dbg4("Setting capture cropping at %dx%d size %dx%d\n",
                      crop.c.left, crop.c.top, crop.c.width, crop.c.height);
    
            printf("Setting capture cropping at %dx%d size %dx%d\n",
                      crop.c.left, crop.c.top, crop.c.width, crop.c.height);
    
    	printf("DMAI: VIDIOC_S_CROP.\n");
    
            /* Crop the image depending on requested image size */
            if (ioctl(hCapture->fd, VIDIOC_S_CROP, &crop) == -1) {
                Dmai_err2("VIDIOC_S_CROP failed on %s (%s)\n", attrs->captureDevice,
                                                               strerror(errno));
                cleanup(hCapture);
                return NULL;
            }
        }
    
    	printf("DMAI: if (hBufTab == NULL)\n");
    
        if (hBufTab == NULL) {
            hCapture->userAlloc = FALSE;
    	printf("DMAI: (hBufTab == NULL)\n");
            /* The driver allocates the buffers */
            if (_Dmai_v4l2DriverAlloc(hCapture->fd,
                                      attrs->numBufs,
                                      V4L2_BUF_TYPE_VIDEO_CAPTURE,
                                      &hCapture->bufDescs,
                                      &hBufTab,
                                      hCapture->topOffset,
                                      attrs->colorSpace) < 0) {
                Dmai_err1("Failed to allocate capture driver buffers on %s\n",
                          attrs->captureDevice);
                cleanup(hCapture);
                return NULL;
            }
        }
        else {
    	printf("DMAI: (hBufTab != NULL)\n");
            /* Make the driver use the user supplied buffers */
            if (_Dmai_v4l2UserAlloc(hCapture->fd,
                                    attrs->numBufs,
                                    V4L2_BUF_TYPE_VIDEO_CAPTURE,
                                    &hCapture->bufDescs,
                                    hBufTab,
                                    0, attrs->colorSpace, TRUE) < 0) {
                Dmai_err1("Failed to intialize capture driver buffers on %s\n",
                          attrs->captureDevice);
                printf("Failed to intialize capture driver buffers on %s\n", attrs->captureDevice);
    
                cleanup(hCapture);
                return NULL;
            }
        }
    
        hCapture->hBufTab = hBufTab;
    
        /* Start the video streaming */
        type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    
    	printf("DMAI: VIDIOC_STREAMON\n");
    
        if (ioctl(hCapture->fd, VIDIOC_STREAMON, &type) == -1) {
            Dmai_err2("VIDIOC_STREAMON failed on %s (%s)\n", attrs->captureDevice,
                                                             strerror(errno));
            printf("VIDIOC_STREAMON failed on %s (%s)\n", attrs->captureDevice,
                                                             strerror(errno));
            cleanup(hCapture);
            return NULL;
        }
    
    
        int level;
        if (ioctl(hCapture->previewerFd, PREV_DUMP_HW_CONFIG, &level) < 0) {
            printf("======================================\n");
            printf("======== Error in debug ioctl ========\n");
            printf("======================================\n");
            return NULL;
        }
    
    
    
        hCapture->started = TRUE;
        return hCapture;
    }
    
    /******************************************************************************
     * Capture_detectVideoStd
     ******************************************************************************/
    Int Capture_detectVideoStd(Capture_Handle hCapture, VideoStd_Type *videoStdPtr,
                               Capture_Attrs *attrs)
    {
        Int                 failCount  =  0;
        Int                 firstInput;
        Int                 queryInput;
        struct v4l2_input   v4l2Input;
        v4l2_std_id         std;
        Int                 input;
        Int                 fd;
        Int                 ret;
        struct v4l2_format  fmt;
        struct v4l2_control ctrl;
    
        assert(videoStdPtr);
        assert(attrs);
    
        /*
         * Initialize variables outside of variable declarations to suppress
         * "unused variable" warnings for platforms that don't use them.
         */
        Dmai_clear(v4l2Input);
        Dmai_clear(fmt);
        queryInput =  0;
        firstInput = -1;
    printf("=========1\n");
        if (attrs->videoStd < 0 || attrs->videoStd > VideoStd_COUNT) {
            Dmai_err1("Invalid capture standard given (%d)\n", attrs->videoStd);
            printf("Invalid capture standard given (%d)\n", attrs->videoStd);
            return Dmai_EINVAL;
        }
    printf("=========2\n");
        if (hCapture) {
            fd = hCapture->fd;
            printf("=========3\n");
        }
        else {
            fd = open(attrs->captureDevice, O_RDWR, 0);
            printf("=========4\n");
            if (fd == -1) {
                Dmai_err2("Cannot open %s (%s)\n", attrs->captureDevice, strerror(errno));
                printf("Cannot open %s (%s)\n", attrs->captureDevice, strerror(errno));
                printf("=========5\n");
                return Dmai_EFAIL;
            }
        }
    
        v4l2Input.type = V4L2_INPUT_TYPE_CAMERA;
        v4l2Input.index = 0;
        printf("=========6\n");
        do {
            if (ioctl(fd, VIDIOC_ENUMINPUT, &v4l2Input) != 0) {
                printf("=========7\n");
                Dmai_err2("%s input not found (%s)\n", captureInputString[attrs->videoInput], strerror(errno));
                printf("%s input not found (%s)\n", captureInputString[attrs->videoInput], strerror(errno));
                return Dmai_EFAIL;
            }
            v4l2Input.index++;       
            printf("captureInputString[attrs->videoInput] = %s\n", captureInputString[attrs->videoInput]);
        } while (strcmp((Char *) v4l2Input.name,
                            captureInputString[attrs->videoInput]) != 0);
        input = --v4l2Input.index;
    
        Dmai_dbg1("%s input selected\n", v4l2Input.name);
    
        if (ioctl(fd, VIDIOC_S_INPUT, &input) == -1) {
            Dmai_err2("Failed to set video input to %d (%s)\n", input, strerror(errno));
            return Dmai_EFAIL;
        }
    
        if (ioctl(fd, VIDIOC_G_INPUT, &queryInput) == -1) {
            Dmai_err0("Failed to retrieve video input setting\n");
            return Dmai_EFAIL;
        }
    
        if (input != queryInput) {
            Dmai_dbg2("Attempted to set video input to %d, but it still has a"
                      "setting of %d\n", input, queryInput);
    
            return Dmai_EFAIL;
        }
    printf("=========8\n");
        if (attrs->videoStd != VideoStd_AUTO) {
            /* Force video standard */
            std = stds[attrs->videoStd];
            printf("=========9\n");
        } else {
            Dmai_dbg0("Checking video standard\n");
            printf("Checking video standard\n");
    
            /* It might take a few tries to detect the signal */
            do {
                ret = ioctl(fd, VIDIOC_QUERYSTD, &std);
    
                if (ret == -1 && errno == EAGAIN) {
                    usleep(1);
                    failCount++;
                }
            } while (ret == -1 && errno == EAGAIN && failCount < NUM_IOCTL_RETRIES);
    
            if (ret == -1) {
                Dmai_err1("VIDIOC_QUERYSTD failed on %s. Video input connected?\n",
                          attrs->captureDevice);
                printf("VIDIOC_QUERYSTD failed on %s. Video input connected?\n",
                          attrs->captureDevice);
                return Dmai_EFAIL;
            }
        }
    printf("=========10\n");
    printf("attrs->videoInput( %d ) == Capture_Input_CAMERA( %d )\n",attrs->videoInput, Capture_Input_CAMERA);
    
        if (attrs->videoInput == Capture_Input_CAMERA) {
            ctrl.id = V4L2_CID_EXPOSURE;
            /* Set flicker setting to 60 Hz for camera for better picture */
            printf("DMAI: Capture_detecVideoStd videoStd=0x%X\n",(unsigned int) std);
            if (std == VideoStd_D1_PAL) {
                ctrl.value = 0x556;//FIX MY: PAL 25 Hz
                printf("=std == VideoStd_D1_PAL\n");
            }
            else if (std == VideoStd_720P_30
                || std == VideoStd_720P_50
                || std == VideoStd_720P_60) {
                ctrl.value = 0x312;//FIX MY: 720p 25 Hz
                printf("=std == std == VideoStd_720P\n");
            }
            else if (std == VideoStd_1080P_30
                || std == VideoStd_1080P_50
                || std == VideoStd_1080P_60
                || std == VideoStd_1080I_25
                || std == VideoStd_1080I_30) {
                ctrl.value = 0x456;
                printf("=std == std == VideoStd_1080\n");
            }
            else {
                ctrl.value = 0x5F4;
            }
    
            if (-1 == ioctl (fd, VIDIOC_S_CTRL, &ctrl)) {
                Dmai_err0("VIDIOC_S_EXPOSURE failed\n");
                printf("VIDIOC_S_EXPOSURE failed\n");
                return Dmai_EFAIL;
            }
        }
    
        Dmai_dbg1("Setting video standard to: %d\n", attrs->videoStd);
    
        if(ioctl(fd, VIDIOC_S_STD, &std) == -1) {
            Dmai_err2("VIDIOC_S_STD failed on %s (%s)\n",
                      attrs->captureDevice, strerror(errno));
            return Dmai_EFAIL;
        }
    
        if (std & V4L2_STD_NTSC) {
           *videoStdPtr = VideoStd_D1_NTSC;
        }
        else if (std & V4L2_STD_PAL) {
            *videoStdPtr = VideoStd_D1_PAL;
        }
        else if (std & V4L2_STD_525P_60) {
            *videoStdPtr = VideoStd_480P;
        }
        else if (std & V4L2_STD_625P_50) {
            *videoStdPtr = VideoStd_576P;
        }
        else if (std == V4L2_STD_720P_60) {
           *videoStdPtr = VideoStd_720P_60;
        }
        else if (std == V4L2_STD_720P_50) {
            *videoStdPtr = VideoStd_720P_50;
        }
        else if (std == V4L2_STD_720P_30) {
            *videoStdPtr = VideoStd_720P_30;
        }
        else if (std == V4L2_STD_1080I_30) {
            *videoStdPtr = VideoStd_1080I_30;
        }
        else if (std == V4L2_STD_1080I_60) {
            *videoStdPtr = VideoStd_1080I_60;
        }
        else if (std == V4L2_STD_1080P_30) {
            *videoStdPtr = VideoStd_1080P_30;
        }
    #if 0    
        else if (std == V4L2_STD_1080I_50) {
            *videoStdPtr = VideoStd_1080I_25;
        }
        else if (std == V4L2_STD_1080P_25) {
            *videoStdPtr = VideoStd_1080P_25;
        }
        else if (std == V4L2_STD_1080P_24) {
            *videoStdPtr = VideoStd_1080P_24;
        }
    #endif
        else if (std == V4L2_STD_1080P_60) {
            *videoStdPtr = VideoStd_1080P_60;
        }
        else if (std == V4L2_STD_1080P_50) {
            *videoStdPtr = VideoStd_1080P_50;
        }        
        else {
            Dmai_err1("Unknown video standard on capture device %s\n",
                      attrs->captureDevice);
            printf("Unknown video standard on capture device %s\n",
                      attrs->captureDevice);
            return Dmai_EFAIL; 
        }
    printf("====== !!!!!\n");
        if (!hCapture) {
            close(fd);
        }
    
        attrs->videoStd = *videoStdPtr;
        Dmai_dbg2("Capture input set to %s:%d\n",
                  captureInputString[attrs->videoInput], *videoStdPtr);
    
        return Dmai_EOK;
    }
    /******************************************************************************
     * Capture_get
     ******************************************************************************/
    Int Capture_get(Capture_Handle hCapture, Buffer_Handle *hBufPtr)
    {
        struct v4l2_buffer v4l2buf;
    
        assert(hCapture);
        assert(hBufPtr);
    
        Dmai_clear(v4l2buf);
        v4l2buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        v4l2buf.memory = hCapture->userAlloc ? V4L2_MEMORY_USERPTR :
                                               V4L2_MEMORY_MMAP;
    
        /* Get a frame buffer with captured data */
        if (ioctl(hCapture->fd, VIDIOC_DQBUF, &v4l2buf) < 0) {
            Dmai_err1("VIDIOC_DQBUF failed (%s)\n", strerror(errno));
            return Dmai_EFAIL;
        }
    
        *hBufPtr = hCapture->bufDescs[v4l2buf.index].hBuf;
        hCapture->bufDescs[v4l2buf.index].used = TRUE;
        Buffer_setNumBytesUsed(*hBufPtr, v4l2buf.bytesused);
    
        return Dmai_EOK;
    }
    
    /******************************************************************************
     * Capture_put
     ******************************************************************************/
    Int Capture_put(Capture_Handle hCapture, Buffer_Handle hBuf)
    {
        Int idx;
    
        assert(hCapture);
        assert(hBuf);
    
        idx = getUsedIdx(hCapture->bufDescs, BufTab_getNumBufs(hCapture->hBufTab));
    
        if (idx < 0) {
            Dmai_err0("You must get a captured buffer before putting one\n");
            return Dmai_ENOMEM;
        }
    
        hCapture->bufDescs[idx].v4l2buf.m.userptr =
            (Int) Buffer_getUserPtr(hBuf);
        hCapture->bufDescs[idx].v4l2buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    
        /* Issue captured frame buffer back to device driver */
        if (ioctl(hCapture->fd, VIDIOC_QBUF,
                  &hCapture->bufDescs[idx].v4l2buf) == -1) {
            Dmai_err1("VIDIOC_QBUF failed (%s)\n", strerror(errno));
            return Dmai_EFAIL;
        }
    
        hCapture->bufDescs[idx].hBuf = hBuf;
        hCapture->bufDescs[idx].used = FALSE;
    
        return Dmai_EOK;
    }
    
    15hz_to_7hz.log
    ******************** ccdc_reg_dump, ISIF **************
    SYNCEN = 0x1
    MODESET = 0x2000
    HDW = 0x0
    VDM = 0x0
    PPLN = 0x0
    LPFR = 0x0
    SPH = 0x0
    LNH = 0x9ff
    SLV0 = 0x1
    SLV1 = 0x1
    LNV = 0x2cf
    CULH = 0xffff
    CULV = 0xff
    HSIZE = 0x50
    SDOFST = 0x0
    CADU = 0x0
    CADL = 0x0
    LINCFG0 = 0x0
    LINCFG1 = 0x0
    CCOLP = 0x0
    CRGAIN = 0x200
    CGRGAIN = 0x200
    CGBGAIN = 0x200
    CBGAIN = 0x200
    COFSTA = 0x0
    FLSHCFG0 = 0x0
    FLSHCFG1 = 0x0
    FLSHCFG2 = 0x0
    VDINT0 = 0x2cf
    VDINT1 = 0x169
    VDINT2 = 0x0
    MISC = 0x0
    CGAMMAWD = 0x0
    REC656IF = 0x0
    CCDCFG = 0x12
    DFCCTL = 0x0
    VDFSATLV = 0x0
    DFCMEMCTL = 0x0
    DFCMEM0 = 0x0
    DFCMEM1 = 0x0
    DFCMEM2 = 0x0
    DFCMEM3 = 0x0
    DFCMEM4 = 0x0
    CLAMPCFG = 0x0
    CLDCOFST = 0x0
    CLSV = 0x0
    CLHWIN0 = 0x0
    CLHWIN1 = 0x0
    CLHWIN2 = 0x0
    CLVRV = 0x0
    CLVWIN0 = 0x0
    CLVWIN1 = 0x0
    CLVWIN2 = 0x0
    CLVWIN3 = 0x0
    DATAHOFST = 0x0
    DATAVOFST = 0x0
    LSCHVAL = 0x0
    LSCVVAL = 0x0
    TWODLSCCFG = 0x0
    TWODLSCOFST = 0x0
    TWODLSCINI = 0x0
    TWODLSCGRBU = 0x0
    TWODLSCGRBL = 0x0
    TWODLSCGROF = 0x0
    TWODLSCORBU = 0x0
    TWODLSCORBL = 0x0
    TWODLSCOROF = 0x0
    TWODLSCIRQEN = 0x0
    TWODLSCIRQST = 0x0
    FMTCFG = 0x0
    FMTPLEN = 0x0
    FMTSPH = 0x0
    FMTLNH = 0x0
    FMTSLV = 0x0
    FMTLNV = 0x0
    FMTRLEN = 0x0
    FMTHCNT = 0x0
    FMTPGMVF0 = 0x0
    FMTPGMVF1 = 0x0
    FMTPGMAPU0 = 0x0
    FMTPGMAPU1 = 0x0
    FMTPGMAPS0 = 0x0
    FMTPGMAPS1 = 0x0
    FMTPGMAPS2 = 0x0
    FMTPGMAPS3 = 0x0
    FMTPGMAPS4 = 0x0
    FMTPGMAPS5 = 0x0
    FMTPGMAPS6 = 0x0
    FMTPGMAPS7 = 0x0
    CSCCTL = 0x0
    CSCM0 = 0x0
    CSCM1 = 0x0
    CSCM2 = 0x0
    CSCM3 = 0x0
    CSCM4 = 0x0
    CSCM5 = 0x0
    CSCM6 = 0x0
    CSCM7 = 0x0
    =================================================
    IPIPE Configuration context
    **************************************************
    Operation mode = CONTINUOUS
    Resizer chained
    Serializer is disabled
    Previewer is configured
    Resizer is configured
    IPIPEIF Registers
    **************************************************
    IPIPEIF ENABLE = 0x0
    IPIPEIF CFG = 0x2000
    IPIPEIF PPLN = 0x0
    IPIPEIF LPFR = 0x0
    IPIPEIF HNUM = 0x0
    IPIPEIF VNUM = 0x0
    IPIPEIF ADDRU = 0x0
    IPIPEIF ADDRL = 0x0
    IPIPEIF ADOFS = 0x0
    IPIPEIF RSZ = 0x10
    IPIPEIF GAIN = 0x200
    IPIPEIF DPCM = 0x0
    IPIPEIF CFG2 = 0x48
    IPIPEIF INIRSZ = 0x0
    IPIPEIF OCLIP = fff
    IPIPEIF DTUDF = 0
    IPIPEIF CLKDIV = 1
    IPIPEIF DPC1 = 0
    IPIPEIF DPC2  = 0
    IPIPEIF DFSGVL  = 0
    IPIPEIF DFSGTH  = fff
    IPIPEIF RSZ3A  = 10
    IPIPEIF INIRSZ3A  = 0
    IPIPE Registers
    **************************************************
    IPIPE_SRC_EN = 0x1
    IPIPE_SRC_MODE = 0x0
    IPIPE_SRC_FMT = 0x3
    IPIPE_SRC_COL = 0xe4
    IPIPE_SRC_VPS = 0x1
    IPIPE_SRC_VSZ = 0x2cf
    IPIPE_SRC_HPS = 0x0
    IPIPE_SRC_HSZ = 0x4ff
    IPIPE_SEL_SBU = 0x0
    IPIPE_DMA_STA = 0x0
    IPIPE_GCK_MMR = 0x1
    IPIPE_GCK_PIX = 0xe
    Resizer Registers
    **************************************************
    RSZ_SRC_EN = 0x1
    RSZ_SRC_MODE = 0x0
    RSZ_SRC_FMT0 = 0x0
    RSZ_SRC_FMT1 = 0x0
    RSZ_SRC_VPS = 0x0
    RSZ_SRC_VSZ = 0x2cf
    RSZ_SRC_HPS = 0x0
    RSZ_SRC_HSZ = 0x4ff
    RSZ_DMA_RZA = 0x90
    RSZ_DMA_RZB = 0x0
    RSZ_DMA_STA = 0x0
    RSZ_GCK_MMR = 0x1
    RSZ_GCK_SDR = 0x1
    RSZ_IRQ_RZA = 0x1fff
    RSZ_IRQ_RZB = 0x1fff
    RSZ_YUV_Y_MIN = 0x0
    RSZ_YUV_Y_MAX = 0xff
    RSZ_YUV_C_MIN = 0x0
    RSZ_YUV_C_MAX = 0xff
    RSZ_YUV_PHS = 0x0
    RSZ_SEQ = 0x0
    RSZ A EN = 0x1
    RSZ A MODE = 0x0
    RSZ A 420 = 0x3
    RSZ A I_VPS = 0x0
    RSZ A I_HPS = 0x0
    RSZ A O_VSZ = 0x2cf
    RSZ A O_HSZ = 0x4ff
    RSZ A V_PHS_Y = 0x0
    RSZ A V_PHS_C = 0x0
    RSZ A V_DIF = 0x100
    RSZ A V_TYP = 0x0
    RSZ A V_LPF = 0x0
    RSZ A H_PHS = 0x0
    RSZ A H_PHS_ADJ = 0x0
    RSZ A H_DIF = 0x100
    RSZ A H_TYP = 0x0
    RSZ A H_LPF = 0x0
    RSZ A DWN_EN = 0x0
    RSZ A DWN_AV = 0x0
    RSZ A RGB_EN = 0x0
    RSZ A RGB_TYP = 0x0
    RSZ A RGB_BLD = 0x0
    RSZ A SDR_Y_BAD_H = 0x86da
    RSZ A SDR_Y_BAD_L = 0x8000
    RSZ A SDR_Y_SAD_H = 0x86c5
    RSZ A SDR_Y_SAD_L = 0x6000
    RSZ A SDR_Y_OFT = 0x500
    RSZ A SDR_Y_Y_PTR_S = 0x0
    RSZ A SDR_Y_PTR_E = 0x2d0
    RSZ A SDR_C_BAD_H = 0x86d3
    RSZ A SDR_C_BAD_L = 0x7000
    RSZ A SDR_C_SAD_H = 0x86d3
    RSZ A SDR_C_SAD_L = 0x7000
    RSZ A SDR_C_OFT = 0x500
    RSZ A SDR_C_PTR_S = 0x0
    RSZ A SDR_C_PTR_E = 0x168
    RSZ B EN = 0x0
    RSZ B MODE = 0x0
    RSZ B 420 = 0x0
    RSZ B I_VPS = 0x0
    RSZ B I_HPS = 0x0
    RSZ B O_VSZ = 0x0
    RSZ B O_HSZ = 0x1
    RSZ B V_PHS_Y = 0x0
    RSZ B V_PHS_C = 0x0
    RSZ B V_DIF = 0x100
    RSZ B V_TYP = 0x0
    RSZ B V_LPF = 0x0
    RSZ B H_PHS = 0x0
    RSZ B H_PHS_ADJ = 0x0
    RSZ B H_DIF = 0x100
    RSZ B H_TYP = 0x0
    RSZ B H_LPF = 0x0
    RSZ B DWN_EN = 0x0
    RSZ B DWN_AV = 0x0
    RSZ B RGB_EN = 0x0
    RSZ B RGB_TYP = 0x0
    RSZ B RGB_BLD = 0x0
    RSZ B SDR_Y_BAD_H = 0x0
    RSZ B SDR_Y_BAD_L = 0x0
    RSZ B SDR_Y_SAD_H = 0x0
    RSZ B SDR_Y_SAD_L = 0x0
    RSZ B SDR_Y_OFT = 0x0
    RSZ B SDR_Y_Y_PTR_S = 0x0
    RSZ B SDR_Y_PTR_E = 0x1fff
    RSZ b SDR_C_BAD_H = 0x0
    RSZ B SDR_C_BAD_L = 0x0
    RSZ B SDR_C_SAD_H = 0x0
    RSZ B SDR_C_SAD_L = 0x0
    RSZ B SDR_C_OFT = 0x0
    RSZ B SDR_C_PTR_S = 0x0
    RSZ B SDR_C_PTR_E = 0x1fff
    
    15hz_to_0hz.log
    ******************** ccdc_reg_dump, ISIF **************
    SYNCEN = 0x1
    MODESET = 0x2000
    HDW = 0x0
    VDM = 0x0
    PPLN = 0x0
    LPFR = 0x0
    SPH = 0x0
    LNH = 0x9ff
    SLV0 = 0x1
    SLV1 = 0x1
    LNV = 0x2cf
    CULH = 0xffff
    CULV = 0xff
    HSIZE = 0x50
    SDOFST = 0x0
    CADU = 0x0
    CADL = 0x0
    LINCFG0 = 0x0
    LINCFG1 = 0x0
    CCOLP = 0x0
    CRGAIN = 0x200
    CGRGAIN = 0x200
    CGBGAIN = 0x200
    CBGAIN = 0x200
    COFSTA = 0x0
    FLSHCFG0 = 0x0
    FLSHCFG1 = 0x0
    FLSHCFG2 = 0x0
    VDINT0 = 0x2cf
    VDINT1 = 0x169
    VDINT2 = 0x0
    MISC = 0x0
    CGAMMAWD = 0x0
    REC656IF = 0x0
    CCDCFG = 0x12
    DFCCTL = 0x0
    VDFSATLV = 0x0
    DFCMEMCTL = 0x0
    DFCMEM0 = 0x0
    DFCMEM1 = 0x0
    DFCMEM2 = 0x0
    DFCMEM3 = 0x0
    DFCMEM4 = 0x0
    CLAMPCFG = 0x0
    CLDCOFST = 0x0
    CLSV = 0x0
    CLHWIN0 = 0x0
    CLHWIN1 = 0x0
    CLHWIN2 = 0x0
    CLVRV = 0x0
    CLVWIN0 = 0x0
    CLVWIN1 = 0x0
    CLVWIN2 = 0x0
    CLVWIN3 = 0x0
    DATAHOFST = 0x0
    DATAVOFST = 0x0
    LSCHVAL = 0x0
    LSCVVAL = 0x0
    TWODLSCCFG = 0x0
    TWODLSCOFST = 0x0
    TWODLSCINI = 0x0
    TWODLSCGRBU = 0x0
    TWODLSCGRBL = 0x0
    TWODLSCGROF = 0x0
    TWODLSCORBU = 0x0
    TWODLSCORBL = 0x0
    TWODLSCOROF = 0x0
    TWODLSCIRQEN = 0x0
    TWODLSCIRQST = 0x0
    FMTCFG = 0x0
    FMTPLEN = 0x0
    FMTSPH = 0x0
    FMTLNH = 0x0
    FMTSLV = 0x0
    FMTLNV = 0x0
    FMTRLEN = 0x0
    FMTHCNT = 0x0
    FMTPGMVF0 = 0x0
    FMTPGMVF1 = 0x0
    FMTPGMAPU0 = 0x0
    FMTPGMAPU1 = 0x0
    FMTPGMAPS0 = 0x0
    FMTPGMAPS1 = 0x0
    FMTPGMAPS2 = 0x0
    FMTPGMAPS3 = 0x0
    FMTPGMAPS4 = 0x0
    FMTPGMAPS5 = 0x0
    FMTPGMAPS6 = 0x0
    FMTPGMAPS7 = 0x0
    CSCCTL = 0x0
    CSCM0 = 0x0
    CSCM1 = 0x0
    CSCM2 = 0x0
    CSCM3 = 0x0
    CSCM4 = 0x0
    CSCM5 = 0x0
    CSCM6 = 0x0
    CSCM7 = 0x0
    =================================================
    IPIPE Configuration context
    **************************************************
    Operation mode = CONTINUOUS
    Resizer chained
    Serializer is disabled
    Previewer is configured
    Resizer is configured
    IPIPEIF Registers
    **************************************************
    IPIPEIF ENABLE = 0x0
    IPIPEIF CFG = 0x2000
    IPIPEIF PPLN = 0x0
    IPIPEIF LPFR = 0x0
    IPIPEIF HNUM = 0x0
    IPIPEIF VNUM = 0x0
    IPIPEIF ADDRU = 0x0
    IPIPEIF ADDRL = 0x0
    IPIPEIF ADOFS = 0x0
    IPIPEIF RSZ = 0x10
    IPIPEIF GAIN = 0x200
    IPIPEIF DPCM = 0x0
    IPIPEIF CFG2 = 0x48
    IPIPEIF INIRSZ = 0x0
    IPIPEIF OCLIP = fff
    IPIPEIF DTUDF = 0
    IPIPEIF CLKDIV = 1
    IPIPEIF DPC1 = 0
    IPIPEIF DPC2  = 0
    IPIPEIF DFSGVL  = 0
    IPIPEIF DFSGTH  = fff
    IPIPEIF RSZ3A  = 10
    IPIPEIF INIRSZ3A  = 0
    IPIPE Registers
    **************************************************
    IPIPE_SRC_EN = 0x1
    IPIPE_SRC_MODE = 0x0
    IPIPE_SRC_FMT = 0x3
    IPIPE_SRC_COL = 0xe4
    IPIPE_SRC_VPS = 0x1
    IPIPE_SRC_VSZ = 0x2cf
    IPIPE_SRC_HPS = 0x0
    IPIPE_SRC_HSZ = 0x4ff
    IPIPE_SEL_SBU = 0x0
    IPIPE_DMA_STA = 0x0
    IPIPE_GCK_MMR = 0x1
    IPIPE_GCK_PIX = 0xe
    Resizer Registers
    **************************************************
    RSZ_SRC_EN = 0x1
    RSZ_SRC_MODE = 0x0
    RSZ_SRC_FMT0 = 0x0
    RSZ_SRC_FMT1 = 0x0
    RSZ_SRC_VPS = 0x0
    RSZ_SRC_VSZ = 0x2cf
    RSZ_SRC_HPS = 0x0
    RSZ_SRC_HSZ = 0x4ff
    RSZ_DMA_RZA = 0x90
    RSZ_DMA_RZB = 0x0
    RSZ_DMA_STA = 0x0
    RSZ_GCK_MMR = 0x1
    RSZ_GCK_SDR = 0x1
    RSZ_IRQ_RZA = 0x1fff
    RSZ_IRQ_RZB = 0x1fff
    RSZ_YUV_Y_MIN = 0x0
    RSZ_YUV_Y_MAX = 0xff
    RSZ_YUV_C_MIN = 0x0
    RSZ_YUV_C_MAX = 0xff
    RSZ_YUV_PHS = 0x0
    RSZ_SEQ = 0x0
    RSZ A EN = 0x1
    RSZ A MODE = 0x0
    RSZ A 420 = 0x3
    RSZ A I_VPS = 0x0
    RSZ A I_HPS = 0x0
    RSZ A O_VSZ = 0x2cf
    RSZ A O_HSZ = 0x4ff
    RSZ A V_PHS_Y = 0x0
    RSZ A V_PHS_C = 0x0
    RSZ A V_DIF = 0x100
    RSZ A V_TYP = 0x0
    RSZ A V_LPF = 0x0
    RSZ A H_PHS = 0x0
    RSZ A H_PHS_ADJ = 0x0
    RSZ A H_DIF = 0x100
    RSZ A H_TYP = 0x0
    RSZ A H_LPF = 0x0
    RSZ A DWN_EN = 0x0
    RSZ A DWN_AV = 0x0
    RSZ A RGB_EN = 0x0
    RSZ A RGB_TYP = 0x0
    RSZ A RGB_BLD = 0x0
    RSZ A SDR_Y_BAD_H = 0x86ef
    RSZ A SDR_Y_BAD_L = 0xa000
    RSZ A SDR_Y_SAD_H = 0x86ef
    RSZ A SDR_Y_SAD_L = 0xa000
    RSZ A SDR_Y_OFT = 0x500
    RSZ A SDR_Y_Y_PTR_S = 0x0
    RSZ A SDR_Y_PTR_E = 0x2d0
    RSZ A SDR_C_BAD_H = 0x86fd
    RSZ A SDR_C_BAD_L = 0xb000
    RSZ A SDR_C_SAD_H = 0x86fd
    RSZ A SDR_C_SAD_L = 0xb000
    RSZ A SDR_C_OFT = 0x500
    RSZ A SDR_C_PTR_S = 0x0
    RSZ A SDR_C_PTR_E = 0x168
    RSZ B EN = 0x0
    RSZ B MODE = 0x0
    RSZ B 420 = 0x0
    RSZ B I_VPS = 0x0
    RSZ B I_HPS = 0x0
    RSZ B O_VSZ = 0x0
    RSZ B O_HSZ = 0x1
    RSZ B V_PHS_Y = 0x0
    RSZ B V_PHS_C = 0x0
    RSZ B V_DIF = 0x100
    RSZ B V_TYP = 0x0
    RSZ B V_LPF = 0x0
    RSZ B H_PHS = 0x0
    RSZ B H_PHS_ADJ = 0x0
    RSZ B H_DIF = 0x100
    RSZ B H_TYP = 0x0
    RSZ B H_LPF = 0x0
    RSZ B DWN_EN = 0x0
    RSZ B DWN_AV = 0x0
    RSZ B RGB_EN = 0x0
    RSZ B RGB_TYP = 0x0
    RSZ B RGB_BLD = 0x0
    RSZ B SDR_Y_BAD_H = 0x0
    RSZ B SDR_Y_BAD_L = 0x0
    RSZ B SDR_Y_SAD_H = 0x0
    RSZ B SDR_Y_SAD_L = 0x0
    RSZ B SDR_Y_OFT = 0x0
    RSZ B SDR_Y_Y_PTR_S = 0x0
    RSZ B SDR_Y_PTR_E = 0x1fff
    RSZ b SDR_C_BAD_H = 0x0
    RSZ B SDR_C_BAD_L = 0x0
    RSZ B SDR_C_SAD_H = 0x0
    RSZ B SDR_C_SAD_L = 0x0
    RSZ B SDR_C_OFT = 0x0
    RSZ B SDR_C_PTR_S = 0x0
    RSZ B SDR_C_PTR_E = 0x1fff
    

     

  • Hi,

    It looks like ISIF->DDR-IPIPE->RSZ->DDR->ENCODE is being used. Can try ISIF->IPIPEIF->RSZ->DDR->ENCODE. What happens to the 7HZ and halfRateCapture = FALSE, does it work ?
  • Hi !

    I'm fix this problems:

    File: vpss.c

    /* AEW, RSZ_INT_DMA */

    isp5_write((isp5_read(0x14) | 0x1f0a0f1f), 0x14); 

    INTSEL3 Selects the interrupt for vpss_int[3] = 0x0f - this value is RESERVED !!!!?????

    Fix:

    isp5_write((isp5_read(0x14) | 0x1f0a0e1f), 0x14); // set the interrupt = RSZ_INT_LAST_PIX( 0x0e )

     

    Tested is OK (DM365 & DM368).

    Now the frames are captured as it should !

  • Hi,

    Congrats. Thanks for posting the solution you have tried.