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.

How to dump decoded raw yuv data in ICS?

hello,

I have question about how to get/dump raw decoded yuv data in ics,  thanks in advance.

In ICS, I use gst-openmax, and decoded buffers could got from  FillBufferDone ,  in OMX_BUFFERHEADERTYPE,  field pBuffer is ANativeWindowBuffer,

I have tried to write the ANativeWindowBuffer->handle to files, but it seams not raw yuv data, maybe also wrappered.

I donot know how to extract the raw yuv data from it.

thanks.

  • Can you check next 2 posts? I think they can answer your question.

    http://e2e.ti.com/support/omap/f/849/p/193199/690788.aspx

    http://e2e.ti.com/support/omap/f/849/p/189036/679771.aspx

  • hello Manuel:

    I read the link mentioned:

    and firstly i enable the macro,

    LOCAL_CFLAGS += -DENABLE_RAW_BUFFERS_DUMP_UTILITY, and

    LOCAL_SHARED_LIBRARIES += libcutils

    to avoid crash,

    modifications are made in fucntion:


    static void convertNV12ToYuv420(DebugFrame_Dump *frameInfo, void *dst)
    {
        int stride = 4096; /* ARM Page size = 4k */
        uint32_t ybuf_offset = frameInfo->frame_yoffset * stride + frameInfo->frame_xoffset;
        uint8_t* p1y = (uint8_t*)frameInfo->y_uv[0] + ybuf_offset;
        uint8_t* p2y = (uint8_t*) dst;
        int i, j, j1;
        int width = frameInfo->frame_width;
        int height = frameInfo->frame_height;

        LOGE("Coverting NV-12 to YUV420p Width[%d], Height[%d] and Stride[%d] offset[%d]",
        width, height, stride, ybuf_offset);

        /* copy y-buffer, almost bytewise copy, except for stride jumps.*/
        for(i=0;i<height;i++)
        {
            /* copy whole row of Y pixels. source and desination will point to new row each time.*/
            TIMM_OSAL_Memcpy(p2y+i*width, p1y+i*stride, width);
            //LOGE("Coverting NV-12 to YUV420p %d/%d, p2y=[%p], p1y=[%p]", i, height, p2y, p1y);
        }

        /** copy uv buffers
        * rearrange from  packed planar [uvuvuv] to planar [uuu][vvvv] packages pixel wise
        * calculate the offset for UV buffer
        */
        uint32_t UV_offset = frameInfo->frame_xoffset +
                                 (frameInfo->frame_yoffset * stride)/2;

        LOGE("Coverting NV-12 to YUV420p UV_offset=%d, yuv[0]=%p, yuv[1]=%p", UV_offset, frameInfo->y_uv[0], frameInfo->y_uv[1]);

    //    const uint8_t* p1uv = (uint8_t*)frameInfo->y_uv[1] + UV_offset;  ==> y_uv[1] is always NULL pointer
        const uint8_t* p1uv = (uint8_t*)frameInfo->y_uv[0] + stride * height ; ==> change it like this.
        LOGE("Coverting NV-12 to YUV420p p1uv =%p", p1uv );

        uint8_t* p2u = ((uint8_t*) dst + (width * height));
        LOGE("Coverting NV-12 to YUV420p p2u  =%p", p2u );
        
        uint8_t* p2v = ((uint8_t*) p2u + ((width/2) * (height/2)));
        LOGE("Coverting NV-12 to YUV420p p2v =%p", p2v );

        for(i=0;(i < height/2);i++)
        {
            for(j=0,j1=0;(j< width/2);j++,j1+=2)
            {
                p2u[j] = p1uv[j1];
                p2v[j] = p1uv[j1+1];
            }
            p1uv+=stride;
            p2u+=width/2;
            p2v+=width/2;
        }

        LOGE("Coverting NV-12 to YUV420p ===> DONE" );
    }

     the decode file is 1280 * 720, and tablet could display it well, but After check the output file, it is only 140K, that's not correct.

  • Can you try removing the conversion code and dump NV12 data before the converter?

  • hello Manuel:

    frame_nv12.txt is the file before convert,  I change to .txt to follow the policy of allowed attachment file name, please rename it after download.

    4135.frame_nv12.txt

    frame_yuv.txt is the file after convert

    1067.frame_yuv.txt

    thanks.

  • Can you please let us know the width and height of the frame buffer?

  • Hello:

    video frame is 1280 * 720, crop rect = [32, 24, 1408, 816]

  • it is not clear to me what you mean by 1280 * 720, crop rect = [32, 24, 1408, 816]. I tried to view the file 4135.frame_nv12.txt in 1280x720 and 1408x816 and both ways it looks like an invalid frame.

  • Hello Mayank:

    Thanks ,I could dump the yuv data now, the file attached is the 1st FillBufferDone yuv raw data, that's not valid frame (before port reconfig), so I alway got error data, but the following data after port reconfigure are right. thanks for your time.