[XviD-devel] Problems encoding/decoding xvid - what I am missing?

Paul Paul paulgfx at yahoo.com
Wed Nov 12 06:33:43 CET 2003


Hi.
I have a problem using encoding/decoding xvid.
The movies encoded with xvid cannot be decoded.
The result is a vrey grabbled movie (almost always is
green and there are only some dots). When I close the
xvid instances, most time it crash(sometimes).
I looked over the documentation and other source, and
I down't realise what I am missing. Also I double
checked that the bitstream that result from the
encoding is the same as passed thru the decoder.
I listed here the portion of code that interfaces with
xvid (I didn't listed the "destroy" of the instance of
the encoding).
Can you help me? Do you need more information?
Thank you.
Paul.


Encoder
=======

  XVID_INIT_PARAM xinit;
  XVID_ENC_PARAM xparam;
  XVID_ENC_STATS xstats;
  XVID_ENC_FRAME xframe;

1) Start
    xinit.cpu_flags=0;
    xvid_init(NULL,0,&xinit,NULL);


    xparam.width=sizex;//x
    xparam.height=sizex;//y

    xparam.fincr=1;
    xparam.fbase=10;//fps

    xparam.rc_bitrate=1000000;//bps
    xparam.rc_reaction_delay_factor=-1;
    xparam.rc_averaging_period=-1;
    xparam.rc_buffer=-1;

    xparam.min_quantizer=-1;
    xparam.max_quantizer=-1;

    xparam.max_key_interval=25;
    int xerr =
xvid_encore(NULL,XVID_ENC_CREATE,&xparam,NULL);


2) For each frame
    xframe.general=XVID_MPEGQUANT;
    xframe.motion=PMV_ADVANCEDDIAMOND16;

    xframe.quant=0;
    xframe.quant_intra_matrix=NULL;
    xframe.quant_inter_matrix=NULL;

    xframe.colorspace=XVID_CSP_RGB24;//sa modific
    xframe.image=frame;

    xframe.bitstream=bitstream;
    xframe.intra=-1;

    int
xerr=xvid_encore(xparam.handle,XVID_ENC_ENCODE,&xframe,&xstats);



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

Decoder
========
    XVID_INIT_PARAM xinit;
    XVID_DEC_PARAM xparam;

1) Start
    xinit.cpu_flags=0;
    xvid_init(NULL,0,&xinit,NULL);

    xparam.width=sizex;
    xparam.height=sizey;

    int
xerr=xvid_decore(NULL,XVID_DEC_CREATE,&xparam,NULL);


2) For each frame:

    XVID_DEC_FRAME xframe;

    xframe.bitstream=bitstream;
    xframe.length=framesize;
    xframe.image=frame;
    xframe.stride=sizex;//????  ; I tried with sizex*3
and other values
    xframe.colorspace=XVID_CSP_RGB24;
    xframe.general=0;

    int
xerr=xvid_decore(xparam.handle,XVID_DEC_DECODE,&xframe,NULL);
    //first time xerr is -1, rest is 0



__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


More information about the XviD-devel mailing list