• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Digital Signal Processors (DSP) » DaVinci™ Video Processors » DM3x DaVinci Video Processor Forum » Resize On Dm365
Share
DaVinci™ Video Processors
  • Forums
  • Announcements
Options
  • Subscribe via RSS

Resize On Dm365

Resize On Dm365

This question has suggested answer(s)
Joni 14324
Posted by Joni 14324
on Aug 20 2009 04:14 AM
Prodigy45 points

Hi

I would line to encode the same captured frame twice, but in different resolution, by using the Resizer.

I'm Using DMAI 1.21.0.10 and seem that for DM365 the Capture module already open the Resizer device,

Can you suggest  other way for resizing?

Thanks

Joni

DM365 DMAI resizer
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Juan Gonzales
    Posted by Juan Gonzales
    on Aug 20 2009 10:06 AM
    Mastermind33965 points

    Joni,

    They way I see it, we have your classic case of flexible but complex API vs. simple but less flexible API.  Normally, driver APIs are designed to be more flexible but a little more complex to use; you could write your user application right on top of these driver APIs if you wish, and we did write our demos this way before DMAI existed.  DMAI is simply a layer between the driver API and the application which tries to hide some of the complexity of driver APIs and provide a simpler API for applications to use and hiding some of the complex choices.

    We see similar scenerious all over the industry; windows OS is an abstration of the hardware, MS Word abstracts things even further and for a very specific purpose (word processing) when in fact, the hardware is capable of much more (fexibility sacrificed).  Choices need to be made to simplify user interface at the sacrifice of fexibility of what the hardware can do because it would be too difficult for all computer users to learn how to program to the hardware directly (e.g. no os, no word processor...).

    Fortunately, embedded systems are simpler than desktop PCs and you do have the source code for the Linux kernel (drivers), DMAI and the demo applications.  The closer you stay to the upper layers of software, the more you will be able to leverage these layers to make your life easier.  If DMAI does not meet your goal but is close, I would probrably try to change it to support your required scenerious. If DMAI is way off in meeting your goals, then I may consider talking to the driver layer directly (what DMAI does for you) and bypassing DMAI altogether.  I doubt you will need to modify the drivers, but you do have the source code if you need to do that as well. 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Joni 14324
    Posted by Joni 14324
    on Aug 20 2009 11:00 AM
    Prodigy45 points

    Hi

    I went into the code (Capture.c in of DMAI) and there is a flag "captureChainMode" only for DM365.

    Is it recommended to set it to false and to do the resizing and the chroma conversion in my application?

    Is there others considerations in this case?

    Thanks

    Joni

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • JerryJohns
    Posted by JerryJohns
    on Aug 20 2009 11:07 AM
    Intellectual650 points

    Hey Joni,
                     There are two options available to you - the resizer hardware supports outputting two different resolution images from a single source, and it can be configured in either 'chain' mode (where the source comes directly from the VPFE raw stream) or in single-shot-mode, where the source comes from SDRAM. The current driver doesn't support dual resizer outputs in chain mode i think (i've had to add support for this) but if you do the DDR mode, all of this is entirely possible. You can then setup the resizer to output two different outputs, and then trigger the resizer each and every time with your video input in ddr memory, and two video output locations in memory as well.

    Jerry

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Marco Braga
    Posted by Marco Braga
    on Aug 31 2009 04:13 AM
    Expert1755 points

    Hi Joni,

     

    I confirm that you can use the resizer multiple times using DMAI,  but you must disable chaining in DMAI's source code, as already suggested. Also you have to configure IPIPE in One-shoot mode (kernel boot parameter). Then you can use DMAI's resize API to do what need. I didn't know that the resize can do multiple jobs while chained...

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Thomas Lee
    Posted by Thomas Lee
    on Sep 20 2009 23:30 PM
    Prodigy80 points

    The DaVinciLSP_02_10_00_14.tar.gz has resizer A&B support already, what you need is a patch to DMAI.

     

    Put the following code into Resize.c, and recompiled DMAI

    When initialization,  call Resizer_B_config() after Resizer_continous_config() was called

    Then call Capture_get(), get Resizer_A output followed by Resizer_B output

    /******************************************************************************
     * Initialize & configure resizer B in on-the-fly (continous) mode
     ******************************************************************************/
    int Resizer_B_config(int rsz_fd, unsigned int width, unsigned int height)
    {
        unsigned int user_mode;
        struct rsz_channel_config rsz_chan_config;
        struct rsz_continuous_config rsz_cont_config;

        user_mode = IMP_MODE_CONTINUOUS;
        if(rsz_fd <= 0) {
            Dmai_err0("Cannot use resize device \n");
            return NULL;
        }
        
        bzero(&rsz_cont_config, sizeof(struct rsz_continuous_config));
        rsz_chan_config.oper_mode = user_mode;
        rsz_chan_config.chain = 1;
        rsz_chan_config.len = sizeof(struct rsz_continuous_config);
        rsz_chan_config.config = &rsz_cont_config;

        if (ioctl(rsz_fd, RSZ_G_CONFIG, &rsz_chan_config) < 0) {
            Dmai_err1("Error in getting channel configuration from resizer (%s)\n",
                strerror(errno));
            return Dmai_EFAIL;
        }
           
        /* we can ignore the input spec since we are chaining. So only
           set output specs */

       
        rsz_cont_config.output2.width = width;
        rsz_cont_config.output2.height= height;
        rsz_cont_config.output2.pix_fmt = IPIPE_YUV420SP;
        rsz_cont_config.output2.enable = 1;
        rsz_chan_config.len = sizeof(struct rsz_continuous_config);
        rsz_chan_config.config = &rsz_cont_config;
        if (ioctl(rsz_fd, RSZ_S_CONFIG, &rsz_chan_config) < 0) {
            Dmai_err1("Error in setting resizer configuration (%s)\n",
                strerror(errno));
            return Dmai_EFAIL;
        }
        Dmai_dbg0("Resizer initialized\n");
        return Dmai_EOK;
    }

     

    The ploblem is, when I use Resizer A&B simultaneously, I get jittering images, anybody can help?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Juraj
    Posted by Juraj
    on Oct 01 2009 18:17 PM
    Prodigy245 points

    It works for me, but I have to increase size of input buffer for second resizer output. The output is normally stored after first resizer output.

    bufSize += 640*480*2; // add maximum size for second buffer

    I found also the limitation about max size 640x480 for second rescaller output. E.g. in davinci_vpfe.c - there is 640x480 constant and there are also in other sources.

    Thank to Thomas Lee for the post about simple enhancement of DMAI for using second resizer.


    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • weidong shi
    Posted by weidong shi
    on Oct 09 2009 04:00 AM
    Intellectual700 points

    hi,I just want to resize the D1 to the cif format. But when I do this ,the error displayed as follows:

    root@192.168.1.180:/mnt# ./myencoder 

    davinci_resizer davinci_resizer.2: RSZ_G_CONFIG:0:1:108

    davinci_previewer davinci_previewer.2: ipipe_set_preview_config

    davinci_previewer davinci_previewer.2: ipipe_set_preview_config

    vpfe ccdc capture vpfe ccdc capture.1: IMP chained 

    vpfe ccdc capture vpfe ccdc capture.1: Resizer present

    vpfe ccdc capture vpfe ccdc capture.1: hpitch = 720, vpitch = 576, bpp = 1

    vpfe ccdc capture vpfe ccdc capture.1: hpitch = 720, vpitch = 576, bpp = 1

    Starting ccdc_config_ycbcr...<7>

    starting ccdc_reset...<7>

    End of ccdc_reset...<7>

    Starting ccdc_setwin...<7>ipipe_set_resizer, resizer - A enabled

    DavinciDisplay DavinciDisplay.1: Before finishing with S_FMT:

    layer.pix_fmt.bytesperline = 736,

     layer.pix_fmt.width = 720, 

     layer.pix_fmt.height = 576, 

     layer.pix_fmt.sizeimage =635904

    DavinciDisplay DavinciDisplay.1: pixfmt->width = 720,

     layer->layer_info.config.line_length= 736

    davinci_resizer davinci_resizer.2: 

     mode doesn't allow multiple instances

    Failed to create hResize: Device or resource busy

     

    Can you give me some ways for this problem?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Juraj
    Posted by Juraj
    on Oct 09 2009 05:48 AM
    Prodigy245 points

    weidong shi, You probably trying to open resizer more than once.

    "mode doesn't allow multiple instances" shown when more instances are going to be opened (/drivers/char/imp_resizer.c)

    Please open it at most once.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Juan Gonzales
    Posted by Juan Gonzales
    on Oct 09 2009 10:48 AM
    Mastermind33965 points

    weidong shi

    hi,I just want to resize the D1 to the cif format. But when I do this ,the error displayed as follows:

    Can you give me some ways for this problem?

    Running the encode demo which comes with the DVSDK with the proper options on top of DM365 EVM should do the resizing you need.  No need to modify code or rebuild anything.  (./encode -y 1 -r 352x288 -v test.mpeg4 ); the -y option is your input resolution, the -r defines your output resolution, if there is a difference resizer will be used to resize accordingly, see accompanying encode.txt for more details.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • weidong shi
    Posted by weidong shi
    on Oct 09 2009 21:20 PM
    Intellectual700 points

    Hi, Thank you for your reply. 

    But actually I want to encode the stream to D1 format and meanwhile save it to disk as cif format .

    So maybe I need to resize the video stream two times.

    What should I do?

    Could you give me some help?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • weidong shi
    Posted by weidong shi
    on Oct 10 2009 04:10 AM
    Intellectual700 points

    How can I get Resizer_A output followed by Resizer_B output?

     

    Could you explain to me clearly?

    Thank you sincerely.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Anshuman Saxena
    Posted by Anshuman Saxena
    on Oct 12 2009 00:13 AM
    Mastermind19870 points

    Hi Weidong Shi,

    DM365 has two resizers RSZA and RSZB. Both of them work simultaneously to give output of different resolutions. LSP drivers for resizer support enabling both RSZA and RSZB.

    DVSDK demos already support RSZB output, but if you want to change your code, please use refer to the following example code, where i am enabling RSZB (output2) in CONTINUOUS mode for output resolution of 352x288. The same is applicable for Single Shot mode also.

    /* rsz_cont_config.output2.enable = 1;
     rsz_cont_config.output2.width = 352;
     rsz_cont_config.output2.height = 288; 
     rsz_cont_config.output2.pix_fmt = IPIPE_YUV420SP;
    // rsz_cont_config.output2.pix_fmt = IPIPE_UYVY; */

    Please note that the output of RSZB follows just after RSZA, so address for RSZB is not configured by application but is configured by kernel driver itself.

     

    Regards,

    Anshuman

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • weidong shi
    Posted by weidong shi
    on Oct 12 2009 03:39 AM
    Intellectual700 points

    Dear Anshuman:

         Thank you for your support.

         I do this configure in Resizer_continous_config(void) in Resizer.c and rebuild Dmai.

        I suppose that when I call Capture_get(hCapture, &hCapBuf) in my application.

       Do you mean that the RSZA output and RSZB output are both in hCapBuf ?

       How can I get the second buffer output.

     

     Regards,

     Weidong.Shi

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Anshuman Saxena
    Posted by Anshuman Saxena
    on Oct 12 2009 04:20 AM
    Mastermind19870 points

    Dear Weidong,

    Yes, both resizer output are in the same buffer. RSZA output is followed by RSZB. You can get RSZB ouput by adding (RSZA_LineOffset*RSZA_Height*2) to get RSZB output when the output format is UYVY.

     

    Regards,

    Anshuman

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • weidong shi
    Posted by weidong shi
    on Oct 12 2009 04:40 AM
    Intellectual700 points

    Thank you sincerely.
       I see almost now. My mentor almost kill me because I can't encode the stream to two formats(d1 and cif). :-)
    By the way, should I increase the buffersize of hCapture?
    buffersize = 720*576*3/2 + 365*288*3/2   // YUV420SP
    ` hCapture = Buffer_create(buffersize, &attrs);
            Capture_get(hCapture, &hCapBuf)
         Do you mean that?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
12345
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use