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.

DM365 MPEG4 encode noise at inputWidth>=160

Hello, 

I am facing DM365 MPEG4 codec problem.

Problem:
Encoded stream have noise when input image width is less than 160 pixel.

Encoder: MPEG4 SP@L5 upto 1080P using HDVICP Encoder
         version 2.00.00.7

Noise sample:
                             

You can see same noise on loopback in DVSDK (/opt/dvsdk/dm365encodedecode).
  example)    ./encodedecode -r 160x128

Image size vs noise:

     144x120:noisy
     144x128:noisy
     160x120:noisy
     160x128:noisy

     176x120:No noise
     176x128:No noise

According to User's Guide (MPEG4 HDVICP Simple Profile Encoder on DM365 User's Guide Literature Number: SPRUGR4A),

    inputHeight: Minimum height supported is 64.(must be multiples of two.)
    inputWidth: Minimum width supported is 64.(must be multiples of two.)

Is there any other limitation for inputWidth?

Thanks.

 

  • Hi,

    We are looking into this issue, will get back to you by early next week.

    regards

    Yashwant

  • Hi,
    After the encode is done writeback cache invalidate is missing. Try modifying the code after calling VIDENC1_process. This function is getting called from file dvsdk_3_10_00_19\dmai_2_10_00_12\packages\ti\sdo\dmai\ce\Venc1.c.

        outBufDesc.numBufs                  = 1;
        outBufDesc.bufs                     = &outPtr;
        outBufDesc.bufSizes                 = outBufSizeArray;

     ..........
     ..........

        /* Encode video buffer */
        status = VIDENC1_process(hVe->hEncode, &inBufDesc, &outBufDesc, &inArgs,
                                 &outArgs);

     
     /* insert code to write back and invalidate cache for outBufDesc.bufs */

     

    Regards,

    Neelakanth

  • By design, the codec is supposed to indicate whether the encoded output buffer was filled by the codec using the CPU - my understanding is that the codec indicates this via the IVIDENC1_OutArgs.encodedBuf.accessMask field.  If that field has the XDM_ACCESSMODE_WRITE bit set, the codec wrote into that output buffer using the CPU, and the app needs to write-back the cache for that buffer before "anything other than the CPU" (e.g. DMA, frame buffer driver, etc) accesses it.  If that field is _not_ set, the codec is indicating that it _didn't_ touch that buffer with the CPU (likely filled it with DMA), and the app doesn't need to writeback that cache.

    Neelakanth, are you saying the codec is failing to set this .accessMask?  Or rather that the app should just be sure to manage the cache correctly as the codec has indicated via .accessMask?  If the latter, the app might do something like this to determine whether writebacks of that cache are needed:

    if (XDM_ISACCESSMODE_WRITE(outArgs.encodedBuf.accessMask)) {
        /* encoded output buffer is in cache, write it back */
        Memory_cacheWb(outArgs.encodedBuf.buf, outArgs.encodedBuf.bufSize);
    }

    Chris

  • Thank you for your help.
    However, the problem has not resolved.

    I think app does NOT need write-back the cache.
    -The XDM_ACCESSMODE_WRITE bit was set. (outArgs.encodedBuf.accessMask = 2)
    -App accesses output buffer with CPU.

    For trial, I called write-back the cache (Memory_cacheWb), but the noise still appears.

    Thanks,

  • can you post the code snippet and which file and function you modified.

    Regards,

    Neelakanth

  • 1563.Venc1.c.txtNeelakanth,

    The code is:

    -----------------------------------------------------------------------------------------------------------------

        /* Encode video buffer */
        status = VIDENC1_process(hVe->hEncode, &inBufDesc, &outBufDesc, &inArgs,
                                 &outArgs);

    #if 1
        if (XDM_ISACCESSMODE_WRITE(outArgs.encodedBuf.accessMask)) {
            /* encoded output buffer is in cache, write it back */
            Memory_cacheWb(outArgs.encodedBuf.buf, outArgs.encodedBuf.bufSize);

            printf("Memory_cacheWb(%08x,%5d) - ",
                        (unsigned int)outArgs.encodedBuf.buf,
                        (int)outArgs.encodedBuf.bufSize);
        }
        printf("outArgs.encodedBuf.accessMask = %d\n",
                (int)outArgs.encodedBuf.accessMask);
    #endif

    -----------------------------------------------------------------------------------------------------------------

    Pls see attached file, Venc.c, line 168.

    Regards,

  • Yoichi,

    We are able to reproduce the issue at our end. Issue is not related to cache, instead the issue is in the MPEG4 encoder code. We are working on it. I will update you after 2 days.

    Regards,

    Neelakanth

  • Yoichi,

    I wanted to know the minimum resolution you are looking for? From the earlier posting it looks like you want picture width till 144 and height of 120?

    Regards,

    Neelakanth

  • Neelakanth,

    As for now, the minimum resolution is 160x120.

    But I expect to support resolution which described in "User's Guide", til 64x64, for future systems.

    Regards,

  • Yoichi,

    We have fixed the issue and tested it on DVSDK 3.10.00.19. I have attached the test library. Replace the library which is at dvsdk_3_10_00_19/dm365_codecs_03_10_00_07/packages/ti/sdo/codecs/mpeg4enc_hdvicp/lib/mpeg4venc_ti_arm926.a. Let us know your observations. Please be advised that this is a test library and has not gone through full test cycle. Once you confirm we will be making official release with full testing.

    Regards,

    Neelakanth

    4606.mpeg4venc_ti_arm926.zip

  • Neelakanth,

    I have confirmed that the issue was fixed. Thank you.

    Pls let me know when you will be able to release official version.

    Regards,

  • Please note that the formal fix will be available by 8th April. You can get the same through you local TI FAE as it may take some more time before it gets uploaded on web.

    regards

    Yashwant

  • I got the formal fix from my local FAE, and confirmed that the issue has been resolved.
    Thank you for your support.

    Regards,