• 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 » MJPEG encode problem(01.00.00.09)
Share
Multimedia Software Codecs
  • Forum
Options
  • Subscribe via RSS

MJPEG encode problem(01.00.00.09)

MJPEG encode problem(01.00.00.09)

This question is answered
william wang63854
Posted by william wang63854
on Jun 14 2011 05:02 AM
Intellectual715 points

Hi,

i'm facing MJPEG encode issue.

mjpeg codec lib version:01.00.00.09

i try to encode 320x192 video and output 192x180 resolution, but the actual output resolution is only 320x176

can you give me some suggestion? thanks in advance.

my parameters setting:

    dynamicParams.size = sizeof(IMGENC1_DynamicParams);
    dynamicParams.numAU = XDM_DEFAULT;
    dynamicParams.inputChromaFormat = XDM_YUV_420SP;
    dynamicParams.inputHeight = 180;
    dynamicParams.inputWidth = 320;
    dynamicParams.captureWidth = 0;
    dynamicParams.generateHeader = XDM_ENCODE_AU;
    dynamicParams.qValue = 60;

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Yashwant Dutt
    Posted by Yashwant Dutt
    on Jun 14 2011 13:49 PM
    Genius15110 points

    I believe this query is related to DM36x. Have you tried using captureWidth parmatere. Please set captureWidth = 320 and inputWidth = 192. This should work.

     

    regards

    Yashwant

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • william wang63854
    Posted by william wang63854
    on Jun 14 2011 20:22 PM
    Intellectual715 points

    i try to implement this solution based on your suggestion, but the output size is 192x176. i want to get 320x180 size

    my setting:

    captureWidth = 320

    inputWidth = 192

    inputHeight= 180

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Akshay Panday
    Posted by Akshay Panday
    on Jun 15 2011 00:57 AM
    Expert1570 points

    Hi William, 

    It's not clear if you want the output size to be 320x180 or 192x180. Can you please clarify?

    Also, can you also let us know all your input parameters?

     

    Thanks & Regards,

     

    Akshay

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • william wang63854
    Posted by william wang63854
    on Jun 15 2011 01:10 AM
    Intellectual715 points

    Hi Akshay,

    sorry bring you any confuse, I made a mistake in the first mail, now, i want to clarify my problem once again.

    my input video data is 320x192, after MJPEG encode, i want to get 320x180(16:9) output, but my MJPEG encode engine always output 320x176 size.

    however, similarly, when input video data is 640x368, 640x360(16:9) MJPEG encode data can be output correctly.

    MJPEG codec lib is : 01.00.00.09

    all paramenters listed as follows:

    params.size = sizeof(IMGENC1_Params);
        params.maxWidth = 320;
        params.maxHeight = 192;
        params.maxScans = 1;
        params.dataEndianness = XDM_BYTE;
        params.forceChromaFormat = XDM_YUV_420P;

    dynamicParams.size = sizeof(IMGENC1_DynamicParams);
        dynamicParams.numAU = XDM_DEFAULT;
        dynamicParams.inputChromaFormat = XDM_YUV_420SP;
        dynamicParams.inputHeight = 180;
        dynamicParams.inputWidth = 320;
        dynamicParams.captureWidth = 0;
        dynamicParams.generateHeader = XDM_ENCODE_AU;
        dynamicParams.qValue = 60;

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • william wang63854
    Posted by william wang63854
    on Jun 15 2011 01:50 AM
    Intellectual715 points

    In addition, MJPEG encode process inbuf and outbuf setting as following:

    offset = width * height;

     inBufDesc.numBufs  = 2;
     inBufDesc.descs[0].bufSize = width*height;
     inBufDesc.descs[0].buf = (XDAS_Int8*)inBuf;
     inBufDesc.descs[0].accessMask = 0;

     inBufDesc.descs[1].bufSize = width * height / 2;
     inBufDesc.descs[1].buf = (XDAS_Int8*)(inBuf + offset);
     inBufDesc.descs[1].accessMask = 0;

     outBufDesc.numBufs = 1;
     outBufDesc.descs[0].bufSize = 1280x720x3/2;
     outBufDesc.descs[0].buf = (XDAS_Int8*)outBuf;
     outBufDesc.descs[0].accessMask = 0;

     inArgs.size = sizeof(IMGENC1_InArgs);
     outArgs.size = sizeof(IMGENC1_OutArgs);

     /* perform the image (JPEG) encoding */
     status = IMGENC1_process(hEncode, &inBufDesc, &outBufDesc, &inArgs,&outArgs);

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • william wang63854
    Posted by william wang63854
    on Jun 16 2011 01:48 AM
    Intellectual715 points

    do you any idea? it's urgent for us!!!!!!!!!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Akshay Panday
    Posted by Akshay Panday
    on Jun 16 2011 02:14 AM
    Expert1570 points

    Hi William,

    I checked the jpeg encoder with the params you have mentioned. I am able to get 320x180 output from a 320x192 420SP YUV. 

     

    The JPEG encoder does support cropping by width by means of the inputWidth and captureWidth parameters. However, there isn't inherent support for cropping height. But since you are using 420SP input, it can be done by manipulating the input buffer pointers accordingly. 

    In your case, the input chroma buffer would need to be offset by 320x192 from the input luma buffer, even though the inputHeight you are passing to the encoder is 180. 

    Let me know how it goes.

    Regards,

    Akshay

     

     

     

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • william wang63854
    Posted by william wang63854
    on Jun 16 2011 03:04 AM
    Intellectual715 points

    Akshay,

    i'm really appreaciate for your reply.

    but i'm still confused, why my 640x368 input data can be MJPEG encoded and then output 640x360 correctly?

    at the same time, i'll follow your suggestion and let you know anything. thanks once again.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • william wang63854
    Posted by william wang63854
    on Jun 16 2011 03:07 AM
    Intellectual715 points

    in addition, can you provide your all MJPEG encode parameters?

    i'll check what's different between my setting and yours. 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Akshay Panday
    Posted by Akshay Panday
    on Jun 16 2011 03:27 AM
    Expert1570 points

    Hi William,

    I'm not really sure what width*height are referred to in the code snippet you posted. But if it's equal to what you're using as maxWidth*maxHeight, then I guess you've taken care of it already. 

    -Akshay

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Akshay Panday
    Posted by Akshay Panday
    on Jun 16 2011 03:37 AM
    Expert1570 points

    William,

     

    I'm running this in the dvtb test environment. My test parameters are:

     

     codec                           =>  jpegenc1

             maxHeight                       =>  192

             maxWidth                         =>  320

             maxScans                         =>  0

             dataEndianness                 =>  1

             forceChromaFormat           =>  1

             numAU                           =>  0

             inputChromaFormat           =>  9

             inputHeight                     =>  180

             inputWidth                       =>  320

             captureWidth                     =>  0

             generateHeader                 =>  0

             qValue                           =>  73

             halfBufCB                       =>  0

             halfBufCBarg                     =>  0

             extDynParamsRstInterval =>  4

             extDynParamsDisableEOI =>  0

             extDynParamsRotation             =>  0

             customQ                         =>  0

     

    -Akshay

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • william wang63854
    Posted by william wang63854
    on Jun 16 2011 03:47 AM
    Intellectual715 points

    Akshay,

    maybe you are still not able to my problem. so I'll describle it again.

    firstly, my problem mainly focus on MJPEG encode. mjpeg codec lib version:01.00.00.09

    1: when input YUV data size is 320x192, after MJPEG encode, only 320x176 size MJPEG data can be output correctly view by VLC, but i want to get 320x180 size MJPEG encoded data. all paramenters as following:

    params.size = sizeof(IMGENC1_Params);
        params.maxWidth = 320;
        params.maxHeight = 192;
        params.maxScans = 1;
        params.dataEndianness = XDM_BYTE;
        params.forceChromaFormat = XDM_YUV_420P;

    dynamicParams.size = sizeof(IMGENC1_DynamicParams);
        dynamicParams.numAU = XDM_DEFAULT;
        dynamicParams.inputChromaFormat = XDM_YUV_420SP;
        dynamicParams.inputHeight = 180;
        dynamicParams.inputWidth = 320;
        dynamicParams.captureWidth = 0;
        dynamicParams.generateHeader = XDM_ENCODE_AU;
        dynamicParams.qValue = 60;

    offset = 320* 192;

     inBufDesc.numBufs  = 2;
     inBufDesc.descs[0].bufSize = 320* 192;
     inBufDesc.descs[0].buf = (XDAS_Int8*)inBuf;
     inBufDesc.descs[0].accessMask = 0;

     inBufDesc.descs[1].bufSize = 320* 192 / 2;
     inBufDesc.descs[1].buf = (XDAS_Int8*)(inBuf + offset);
     inBufDesc.descs[1].accessMask = 0;

     outBufDesc.numBufs = 1;
     outBufDesc.descs[0].bufSize = 1280x720x3/2;
     outBufDesc.descs[0].buf = (XDAS_Int8*)outBuf;
     outBufDesc.descs[0].accessMask = 0;

     inArgs.size = sizeof(IMGENC1_InArgs);
     outArgs.size = sizeof(IMGENC1_OutArgs);

     /* perform the image (JPEG) encoding */
     status = IMGENC1_process(hEncode, &inBufDesc, &outBufDesc, &inArgs,&outArgs);

     

    2: However, when input YUV data size is 640x368, after MJPEG encode, 640x360 size MJPEG data can be output correctly view by VLC. all paramenters as following:

    params.size = sizeof(IMGENC1_Params);
        params.maxWidth = 640;
        params.maxHeight = 368;
        params.maxScans = 1;
        params.dataEndianness = XDM_BYTE;
        params.forceChromaFormat = XDM_YUV_420P;

    dynamicParams.size = sizeof(IMGENC1_DynamicParams);
        dynamicParams.numAU = XDM_DEFAULT;
        dynamicParams.inputChromaFormat = XDM_YUV_420SP;
        dynamicParams.inputHeight = 360;
        dynamicParams.inputWidth = 640;
        dynamicParams.captureWidth = 0;
        dynamicParams.generateHeader = XDM_ENCODE_AU;
        dynamicParams.qValue = 60;

    offset = 640* 368;

     inBufDesc.numBufs  = 2;
     inBufDesc.descs[0].bufSize = 640* 368;
     inBufDesc.descs[0].buf = (XDAS_Int8*)inBuf;
     inBufDesc.descs[0].accessMask = 0;

     inBufDesc.descs[1].bufSize = 640* 368 / 2;
     inBufDesc.descs[1].buf = (XDAS_Int8*)(inBuf + offset);
     inBufDesc.descs[1].accessMask = 0;

     outBufDesc.numBufs = 1;
     outBufDesc.descs[0].bufSize = 1280x720x3/2;
     outBufDesc.descs[0].buf = (XDAS_Int8*)outBuf;
     outBufDesc.descs[0].accessMask = 0;

     inArgs.size = sizeof(IMGENC1_InArgs);
     outArgs.size = sizeof(IMGENC1_OutArgs);

     /* perform the image (JPEG) encoding */
     status = IMGENC1_process(hEncode, &inBufDesc, &outBufDesc, &inArgs,&outArgs);

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Akshay Panday
    Posted by Akshay Panday
    on Jun 16 2011 05:17 AM
    Verified Answer
    Verified by william wang63854
    Expert1570 points

    William, 

    MJPEG is just a series of JPEG frames, so it makes no difference, as such.

    Can you attach the 320x176 output you are getting here, so that I can have a look?

    If it works with 640x360 then it really should work for 320x180 too.... 

    -Akshay

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • william wang63854
    Posted by william wang63854
    on Jun 16 2011 05:34 AM
    Intellectual715 points

    Akshay,

    that's my confused points. i don't know why 640x360 is ok, but 320x180 is not ok.

    i have set all parameters the same with yours, but i still only get 320x176,

    i have encosed my 320x176 output data for your reference.

    thanks for you help.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • william wang63854
    Posted by william wang63854
    on Jun 16 2011 05:40 AM
    Intellectual715 points

    Hi Akshay,

    as you mentioned, you are running this in the dvtb test environment, my test results is based on DVSDK_3,

    my app interface as follows:
    IMGENC1_create;

    IMGENC1_control;

    IMGENC1_process

    i don't if it's related with my unexpected output?

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