• 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 » Embedded Software » Multimedia Software Codecs » Multimedia Software Codecs forum » why h264 encoder can't encode 1080*720 or 1920*1080 in davinci_dm365 platform?
Share
Multimedia Software Codecs
  • Forum
Options
  • Subscribe via RSS

Forums

why h264 encoder can't encode 1080*720 or 1920*1080 in davinci_dm365 platform?

  • Leon Yin
    Posted by Leon Yin
    on Jan 05 2010 22:12 PM
    Intellectual255 points

    Hi all;

    I use the encoder demo in "dvsdk_2_10_01_1->dvtb_4_10_03". I chave hanged the frame source to be come from a image sensor.
    I changed the colorspace of the result yuv image to be ColorSpace_YUV420PSEMI, And is encoded ok if i use mpeg4 encoder in every resolution.

    But when i use h264 encoder, it only succeeds in 640*480 or 720*480 resolution while int other resolution failed. why?

    Does any one has Any idea?
    thanks.

    the video code is as follow.

    /******************************************************************************
     * videoThrFxn
     ******************************************************************************/
    Void *videoThrFxn(Void *arg)
    {
        VideoEnv               *envp                = (VideoEnv *) arg;
        Void                   *status              = THREAD_SUCCESS;
        VIDENC1_Params          defaultParams       = Venc1_Params_DEFAULT;
        VIDENC1_DynamicParams   defaultDynParams    = Venc1_DynamicParams_DEFAULT;
        Venc1_Handle            hVe1                = NULL;
        Engine_Handle           hEngine             = NULL;
        BufTab_Handle           hBufTab             = NULL;
        Int                     frameCnt            = 0;
        Buffer_Handle           hCapBuf, hDstBuf;
        VIDENC1_Params         *params;
        VIDENC1_DynamicParams  *dynParams;
        Int                     fifoRet;
        Int                     bufIdx,i;
       //g_colorSpace is global and is set to be ColorSpace_YUV420PSEMI
        ColorSpace_Type         colorSpace = g_colorSpace;
        Bool                    localBufferAlloc = FALSE;
        /* Open the codec engine */
        hEngine = Engine_open(envp->engineName, NULL, NULL);

        if (hEngine == NULL) {
            printf("Failed to open codec engine %s\n", envp->engineName);
            cleanup(THREAD_FAILURE);
        }
       
        /* Use supplied params if any, otherwise use defaults */
        //indeed we use the defaultparams
        params = envp->params ? envp->params : &defaultParams;
        dynParams = envp->dynParams ? envp->dynParams : &defaultDynParams;

        /* Set up codec parameters */
        params->maxWidth          = envp->imageWidth;
        params->maxHeight         = envp->imageHeight;
        params->encodingPreset    = XDM_HIGH_SPEED;
       if (colorSpace ==  ColorSpace_YUV420PSEMI) {
            params->inputChromaFormat =XDM_YUV_420SP;
        } else {
            params->inputChromaFormat = XDM_YUV_422ILE;
        }
         
        params->reconChromaFormat = XDM_YUV_420SP;
        params->maxFrameRate      = envp->videoFrameRate;

        /* Set up codec parameters depending on bit rate */
        if (envp->videoBitRate < 0) {
            /* Variable bit rate */
            params->rateControlPreset = IVIDEO_NONE;
            params->maxBitRate        = 0;
        }
        else {
            /* Constant bit rate */
            params->rateControlPreset = IVIDEO_STORAGE;
            params->maxBitRate        = envp->videoBitRate;
        }

        dynParams->targetBitRate   = params->maxBitRate;
        dynParams->inputWidth      = params->maxWidth;
        dynParams->inputHeight     = params->maxHeight;   
        dynParams->refFrameRate    = params->maxFrameRate;
        dynParams->targetFrameRate = params->maxFrameRate;
        dynParams->interFrameInterval = 0;
        /* Create the video encoder */
        hVe1 = Venc1_create(hEngine, envp->videoEncoder, params, dynParams);
        if (hVe1 == NULL) {
            ERR("Failed to create video encoder: %s\n", envp->videoEncoder);
            cleanup(THREAD_FAILURE);
        }
        /* Store the output buffer size in the environment */
        envp->outBufSize = Venc1_getOutBufSize(hVe1);

        /* Signal that the codec is created and output buffer size available */
        Rendezvous_meet(envp->hRendezvousWriter);

        /* Signal that initialization is done and wait for other threads */
        Rendezvous_meet(envp->hRendezvousInit);
        while (!gblGetQuit()) {
            /* Pause processing? */
            Pause_test(envp->hPauseProcess);

            /* Get a buffer to encode from the capture thread */
            fifoRet = Fifo_get(envp->hCaptureOutFifo, &hCapBuf);

            /* Get a buffer to encode to from the writer thread */
            fifoRet = Fifo_get(envp->hWriterOutFifo, &hDstBuf);

            /* Make sure the whole buffer is used for input */
            BufferGfx_resetDimensions(hCapBuf);
            /* Decode the video buffer */
            if (Venc1_process(hVe1, hCapBuf, hDstBuf) < 0) {
                ERR("Failed to encode video buffer\n");
                cleanup(THREAD_FAILURE);
            }
            /* Send encoded buffer to writer thread for filesystem output */
            if (Fifo_put(envp->hWriterInFifo, hDstBuf) < 0) {
                ERR("Failed to send buffer to display thread\n");
                cleanup(THREAD_FAILURE);
            }

            /* Return buffer to capture thread */       
            if (Fifo_put(envp->hCaptureInFifo, hCapBuf) < 0) {
                ERR("Failed to send buffer to display thread\n");
                cleanup(THREAD_FAILURE);
            }
           
            /* Increment statistics for the user interface */
            gblIncVideoBytesProcessed(Buffer_getNumBytesUsed(hDstBuf));
            frameCnt++;
        }

    cleanup:
        ......
        return status;
    }
    /******************************************************************************
     * end of videoThrFxn
     ******************************************************************************/

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Yashwant Dutt
    Posted by Yashwant Dutt
    on Mar 18 2010 03:21 AM
    Genius15110 points

    What is the error you are getting ? Is the codec create failing ?

    Have you check the TI website for the latest dvsdk availabilty, latest dvsdk is 2.10.01.18 ? You should be able to encode any resolution upto 720P. If you are having trouble with DVTB, you can chek it using the DMAI based demo application also.

    Also, With the latesh codec patch, you should be able to encode any resoltution upto 1080P. See http://focus.ti.com/docs/toolsw/folders/print/dm365codecs.html

     

    regards

    Yashwant

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
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