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.

Video upscaling on DM365

Hi,

I am facing issue for video upscaling. H264 Decoder outputs the data in IPIPE_YUV420SP pixel format. I configured resizer in single shot mode and set its input and output pixel format is  IPIPE_YUV420SP. I got the failure in resizer configuration and got davinci_resizer.2: rsz_validate_out_pix_formatspix format not supported, 9” error. I looked into the LSP and found that kernel does not have the support for IPIPE_YUV420SP input pixel format.

Can anyone advice how I can do the video upscaling?

Thanks,

Dilip

 

 

  • To be honest, I am suprised H,264 decoder outputs YCbCr:4:2:0 data,, since YCbCr4:2:2 is very commonly used in the industry; I do not have DM365 software installed, but the software installation should include the h.264 decoder user guide/data-sheet... I would check there to see if h.264 can be configured to output YCbCr:4:2:2.

  • HI Juan,

     

    Thanks for response.

    I referred the h264_decoder_dm365_datasheet.pdf and it is mentioned that outputs are available in 4:2:0 interleaved little endian format(page 1).

    H264 Decoder only supports the XDM_YUV_420SP format others are not supported as mentioned in "h264_decoder_dm365_userguide.pdf( page:54-55).

    As per the message from kernel IPIPE module does not support XDM_YUV_420SP format. Can yo please advice how can I do the upscaling?

    Can you please share if you have any upscaling example?

     

     

  • Being new to this platform myself, I first started with the hardware guides to make sure this could be done.  Looking at the VPFE UG (http://focus.ti.com/lit/ug/sprufg8/sprufg8.pdf), it appears the hardware can scale YCbCr:4:2:0 images (see section 4.7.15).  That said, I do not have the software installed yet to see if this support may be available via some other API, so maybe someone more familiar with the software will chime in.  Also, please keep in mind that this product is rather new and perhaps this support has not been added to the software yet.  But the good news is the hardware can do it so it is just a matter of time until the software catches up if it is not there already.

  • Hey Dilip,

                      I consulted the VPBE datasheet - section 4.7.15 mentions that for 4:2:0 input, the resizer has to be run twice (once for Y samples, and then another for U/V samples).

    I did a simple grep in the kernel source for the error (found in drivers/char/dm365_ipipe.c) - you'll notice that the input pixel format has to be IPIPE_420SP_Y, and IPIPE_420SP_C for it to work, as reflected in the datasheet.

    Grep is your friend :)

    Jerry

  • Hi Jerry,

    I serched for data sheet of VPBE but i did not find it.

    Can you please share it with me if you have it?

    - Dilip

     

     

     

     

  • Dilip,

    Jerry and I were referring to section 4.7.15 of http://focus.ti.com/lit/ug/sprufg8/sprufg8.pdf.

    Of course, Jerry went one step further and actually grepped the source code (I do not have it installed).

    By the way Jerry, I wanted to extend my thanks for helping out with our community, your expertise really comes across in the solid answers you are providing.

  • Its been a pleasure to help out, as I've gleaned quite a few answers from here as well :)

  • Hi Jerry,

    Thanks for your response.

    I tried the resizing with Y  and CbCr data seperately but I am getting the disported video (No video image). I am giving same buffer for Y data resizing and Cbcr data resizing.

    I am able to do downscaling with my resizer code. I just change the pixel formax and width and height parameters.

    Can you please give the idea how can I do upscaling?

    - Dilip

  • Dilip Patel said:
    I tried the resizing with Y  and CbCr data seperately but I am getting the disported video (No video image).

    Could you provide some specifics on how the video output is being effected, you say (No video image) so do you get nothing out at all or something that is just distorted somehow (bad colors, stretching, noise, appearance of sync loss, etc)?

  • So, with the *same* resizer code, your able to do downscaling but not upscaling? And when you do upscaling, are you just setting output height/width? 

    Make sure that your width/height is a multiple of 32.

    Also, the fact that downscaling works but not upscaling seems to smell of a memory overwrite problem on your output buffers...check that they have sufficient size and that your Y and CbCr buffers are not overlapping.

  • Hi Bernie,

    I am getting the bad color and only dots on the screen(appearance of sync loss).

     

     

  • I am giving the decoder output buffer for resizing. so output of decoder is single buffer and I am giving same buffer pointer for Y and Cbcr data resizing.

    Do I need to give different buffer pointer for Y( base pointer of buffer ) and CbCr data ( base pointer + size of Y data )?

     

     

     

  • Hi,

    Thanks for response.

    When I do the resizing for Y and Cbcr data separetely, resizer hangs. when I start tracing using strace -f -p <Process ID> command then system comes out of the hang and at that time display rate is too slow. I do not understand this behaviour.

    When I do only Y data resizing, I did not observe any hangs but I am getting two windows of video image on screen( same video content in both windows and content is correct) and color is not good. bad color is acceptable for this case because I am not doing CbCr data resizing.

    Please advice me.

    Thanks,

    Dilip

     

     

  • We are still investigating this internally as to the upscaling support on the DM365 resizer driver but in the mean time I am a bit curious as to your observation of two windows of video on the screen, I agree that the color will be way off if you are not scalling the chroma but I am not sure exactly what you mean by the same video content in both windows, could you post an image of what the output looks like?

     

  • Hi Bernie,

    I attached image for your reference. In that image It has the single frame. I am getting video frame in same manner on display device(TV). I am trying to do CIF upscaling to D1.

    Please let me know if you need more details.

    Thanks,
    Dilip

  • Hi,

    Thanks for response.

    I am also getting resizer hangs when I try to do resizing CbCr data with Y data. I observed the IOCTL for resizer hangs.

    When I start tracing using strace -f -p <Process ID> command then system comes out of the hang and at that time display rate is too slow. I do not understand this behaviour.

    When I do only Y data resizing, I did not observe any hangs but I am getting two windows of video image on screen( same video content in both windows and content is correct) and color is not good. bad color is acceptable for this case because I am not doing CbCr data resizing.

    Please advice me.

    Thanks,

    Dilip

     

     

  • Hi,

    I did software resizing using the source code I am having. I am able to resize it properly but when I use IPIPE module of DM365 for resizing it gives me dual image on screen as i mentioned earlier and When I do chroma resizing then it hangs whole system.

    I tried chroma resizing with both the option like

    1. Give the chroma buffer pointer for chroma resizing( base + sizeof y data for Chroma resizing)

    2. Gave the same pointer as Y buffer

    In both the case I am getting system hangs.

    If I do only Y data resing then getting dual image. I dumped the data before giving to display driver and analyed using YUV analyzer and I observed the CIF->D1 conversion outputs dual image after resizing call. I verified the input data also I contains the CIF image only and proper video data.

    Please advice me how to resolve this issue.

     

    Thanks,

    Dilip

     

     

     

  • Based on your dual image it appears that the vertical aspect of the resizing is working properly and that only the horizontal is somehow being duplicated, is this the case?

    I am looking to see if we have some example that would suit this situation, but in the mean time could you post your resizer register settings/configuration?

  • Hi Bernie,

    Thanks for response.

    Yes, Your understanding is correct.

    pResizeParams_->nInputWidth = 352;

    pResizeParams_->nOutputWidth = 736;

    pResizeParams_->nInputHeight = 288;

    pResizeParams_->nOutputHeight = 480;

    pResizeParams_->nPixelFormat = IPIPE_420SP_Y;

        // Validate arguments
        if ((INVALID_RETURN == nResizerId_) || (NULL == pResizeParams_))
        {
            DBG_PRINT0 (1, "VideoResize_InitDevice: Invalid arguments\n");
            return RESIZER_INVALID_ARG; // EARLY RETURN HERE
        }
        else if ((pResizeParams_->nInputWidth < 0) || (pResizeParams_->nInputHeight < 0) ||
                 (pResizeParams_->nOutputWidth < 0) || (pResizeParams_->nOutputHeight < 0))
        {
            DBG_PRINT0 (1, "VideoResize_InitDevice: Invalid arguments\n");
            return RESIZER_INVALID_ARG; // EARLY RETURN HERE
        }

        // Check for scaling ratio
        nHrzScaleFactor = pResizeParams_->nInputWidth * 256 / pResizeParams_->nOutputWidth;
        nVerScaleFactor = pResizeParams_->nInputHeight * 256 / pResizeParams_->nOutputHeight;

        if ((nHrzScaleFactor < 32) || (nHrzScaleFactor > 4096) || (nVerScaleFactor < 32) ||
            (nVerScaleFactor > 4096))
        {
            DBG_PRINT0 (1, "up-scaling or down-scaling must not exceed 8x or 1/16x\n");
            return RESIZER_INVALID_ARG; // EARLY RETURN HERE
        }

        // Set configuration to chain resizer with preview
        tResizeChannelConfig.oper_mode = IMP_MODE_SINGLE_SHOT;
        tResizeChannelConfig.chain = 0;
        tResizeChannelConfig.len = 0;

        // Set NULL to set default value from driver
        tResizeChannelConfig.config = NULL;

        if (ioctl (nResizerId_, RSZ_S_CONFIG, &tResizeChannelConfig) < 0)
        {
            DBG_PRINT0 (1, "Failed to configure resizer in single shot mode\n");
            nReturnVal = RESIZER_FAILURE;
        }
        else
        {
            MEMSET (&tResizeSingleShotCfg, 0, sizeof (struct rsz_single_shot_config));
            tResizeChannelConfig.oper_mode = IMP_MODE_SINGLE_SHOT;
            tResizeChannelConfig.chain = 0;
            tResizeChannelConfig.len = sizeof (struct rsz_single_shot_config);
            tResizeChannelConfig.config = &tResizeSingleShotCfg;

            if (ioctl (nResizerId_, RSZ_G_CONFIG, &tResizeChannelConfig) < 0)
            {

            DBG_PRINT0 (1, "Failed to configure resizer in single shot mode\n");
            nReturnVal = RESIZER_FAILURE;
        }
        else
        {
            MEMSET (&tResizeSingleShotCfg, 0, sizeof (struct rsz_single_shot_config));
            tResizeChannelConfig.oper_mode = IMP_MODE_SINGLE_SHOT;
            tResizeChannelConfig.chain = 0;
            tResizeChannelConfig.len = sizeof (struct rsz_single_shot_config);
            tResizeChannelConfig.config = &tResizeSingleShotCfg;

            if (ioctl (nResizerId_, RSZ_G_CONFIG, &tResizeChannelConfig) < 0)
            {
                DBG_PRINT0 (1, "Failed to configure resizer in single shot mode\n");
                nReturnVal = RESIZER_FAILURE;
            }
            else
            {
                tResizeSingleShotCfg.input.image_width = (pResizeParams_->nInputWidth + pResizeParams_->nInputWidth % 32);
                tResizeSingleShotCfg.input.image_height = pResizeParams_->nInputHeight;
                tResizeSingleShotCfg.input.ppln = (tResizeSingleShotCfg.input.image_width) + 8;
                tResizeSingleShotCfg.input.lpfr = tResizeSingleShotCfg.input.image_height + 10;
                tResizeSingleShotCfg.input.pix_fmt = pResizeParams_->nPixelFormat;
                tResizeSingleShotCfg.output1.pix_fmt = IPIPE_YUV420SP;
                tResizeSingleShotCfg.output1.enable = true;
                tResizeSingleShotCfg.output1.width = (pResizeParams_->nOutputWidth + (pResizeParams_->nOutputWidth % 32));
                tResizeSingleShotCfg.output1.height = pResizeParams_->nOutputHeight;
                tResizeSingleShotCfg.output2.enable = false;
                tResizeChannelConfig.oper_mode = IMP_MODE_SINGLE_SHOT;
                tResizeChannelConfig.chain = 0;
                tResizeChannelConfig.len = sizeof (struct rsz_single_shot_config);
                tResizeChannelConfig.config = &tResizeSingleShotCfg;

                if (ioctl (nResizerId_, RSZ_S_CONFIG, &tResizeChannelConfig) < 0)
                {
                    DBG_PRINT0 (1, "Failed to configure resizer in single shot mode\n");
                    nReturnVal = RESIZER_FAILURE;
                }
                else
                {
                    tResizeChannelConfig.oper_mode = IMP_MODE_SINGLE_SHOT;
                    tResizeChannelConfig.chain = 0;
                    tResizeChannelConfig.len = sizeof (struct rsz_single_shot_config);

                    if (ioctl (nResizerId_, RSZ_G_CONFIG, &tResizeChannelConfig) < 0)
                    {
                        DBG_PRINT0 (1, "Failed to configure resizer in single shot mode\n");
                        nReturnVal = RESIZER_FAILURE;
                    }
                }
            }

    Please let me know if you need more information.

    Thanks,

    Dilip