[XviD-devel] Using XVID_CSP_INTERNAL

Kyle Meadows darktyco at yahoo.com
Sun Oct 29 05:21:30 CET 2006


Hi,

I have a question about decoding a stream using XVID_CSP_INTERNAL. I wrote a program that used XVID_CSP_YV12 to decode video in the planar format and display it to the screen. Everything was working normally- every time I called the decoder new video data was put into the buffer I provided and the plane strides were all reported correctly (1774, 1774/2, and 1774/2 for my test stream.)

I wanted to start using XVID_CSP_INTERNAL to gain performance, so I tried to decipher how it worked from the XVID source and I have it running, but with weird results. The first time the decoder is called the pointer at xvid_dec_frame_t.output pointer is NULL and the plane strides are all reported as 0. The next two times the decoder is called the pointers won't be NULL and will actually point to the decoded video data, but the strides are reported incorrectly (1904, 1904/2, and 1904/2 instead of the values I gave as an example above.) So while the video is being decoded and I can display it, it is being stretched out in the X dimension. Then the sequence repeats itself, a NULL pointer being returned once and the stretched out data being returned twice, repeat again and again.

Here is a snippet of how I am calling the decoder:

    xvid_dec_frame_t xvid_dec_frame;
    memset(&xvid_dec_frame, 0, sizeof(xvid_dec_frame_t));
    xvid_dec_frame.version = XVID_VERSION;
    decoder_stats->version = XVID_VERSION;     

    xvid_dec_frame.general          = 0;
    xvid_dec_frame.bitstream       = in_buffer;
    xvid_dec_frame.length            = bytes_in_stream;

    xvid_dec_frame.output.csp         = XVID_CSP_INTERNAL;
    xvid_dec_frame.output.stride[0] = 1774;
    xvid_dec_frame.output.stride[1] = 1774/2;
    xvid_dec_frame.output.stride[2] = 1774/2;

    out = xvid_decore(decoder_handle, XVID_DEC_DECODE, &xvid_dec_frame, decoder_stats);

    y_plane_buffer = (unsigned char*) xvid_dec_frame.output.plane[0];

Am I using the decoder properly? I used basically the same code when I was using XVID_CSP_YV12 and all was happy. Any help would be greatly appreciated. Thanks!

-Kyle








More information about the XviD-devel mailing list