[XviD-devel] Fw: libxvidcore decompression

reno reballos rreballos at yahoo.com
Thu Apr 17 12:59:38 CEST 2008


Hi Dark Sylinc,

thanks, i was able to get now the data from the file that i am reading but the only problem now is by doing fread(mp4_buffer, sizeof(unsigned char),2130*2, fpi);<----- i dont know what magic does the 2130 can have me, which is supposedly to be the value of the file size through ftell(file), when i try to put into the third parameter of the fread(), i try to put 2130 in the third parameter based on the program that i have read which is using that to read the data from file as third parameter... i wonder why?.. it works for me but for the real value do not?.... weired!....(huh)  but the main problem is not yet solve, since i got now data inside my mp4_buffer which is the input to the decoder, when i try to feed it into my decoder function call taking mp4_buffer as an input to the decoder function it does not gives me the any values returned as product of the decoding process...

and in my decoder i dont think so, i am making mistakes in assigning some values, i am decoding 230x240 RGB data (the product of my encoding application), this is what exactly i did in my decoding routine:

//----------------------------------- xvid decoder function-----------------------------------

    int retVal_DEC_decode = NULL;
    /*global initialization routine calling function*/
    dec_global_init();    

    /*decoder initialization routine calling function*/
    dec_init();

    /*getting data width*/
    int dataWidth = sgGetDataWidth();<--getting the data width

    xvid_dec_frame_t dec_frame;
    memset(&dec_frame,0, sizeof(xvid_dec_frame_t));
    dec_frame.version = XVID_VERSION;
    
    xvid_dec_stats_t dec_stats;
    memset(&dec_stats,0, sizeof(xvid_dec_stats_t));
    dec_stats.version = XVID_VERSION;

    //no general flag to set
    dec_frame.general = 0;  //auto detect
    dec_frame.bitstream = dec_input_stream;<----- input data from mp4_buffer
    dec_frame.length = data_length;<---- input data length    

    //output frame structure
    dec_frame.general = XVID_DEBLOCKY |XVID_DEBLOCKUV |XVID_FILMEFFECT; 
    dec_frame.output.csp = XVID_CSP_BGR;
    dec_frame.output.stride[0] = dataWidth*3;
    dec_stats.type = XVID_TYPE_AUTO;//automatically detect the coding type
    dec_frame.output.plane[0] = dec_outputstream;<----------decoder output stream, i am getting here no return values but many (IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII) values which i assert as not a decoded stream

    retVal_DEC_decode = xvid_decore(dec_handle, XVID_DEC_DECODE, &dec_frame, &dec_stats);
    if(retVal_DEC_decode==-1){
            Msg(TEXT("XVID_DEC_INIT, Xvid General Fault"));
    }
    else if(retVal_DEC_decode==-2){
            Msg(TEXT("XVID_DEC_INIT, memory allocation error"));
    }
    else if(retVal_DEC_decode==-3){
            Msg(TEXT("XVID_DEC_INIT, file format error"));
    }
    else if(retVal_DEC_decode==-4){
            Msg(TEXT("XVID_DEC_INIT, structure version not supported"));
    }

    return retVal_DEC_decode;


........ i dont think so from the above code i am having trouble with my decoder settings, looking forward to hear from you...thank you for the time spent....

regards,
reno



----- Original Message ----
From: Dark Sylinc <dark_sylinc at yahoo.com.ar>
To: xvid-devel at xvid.org
Sent: Wednesday, April 16, 2008 11:50:19 PM
Subject: Re: [XviD-devel] Fw:  libxvidcore decompression

> 2. determine the buffer size to allocate for the
> read stream buffer through
>     fseek(fpi,0,SEEK_END);
>     long lFileSize = ftell(fpi);
>     unsigned char *buffer = NULL;
>     buffer = (unsigned char *) malloc (lFileSize);
>     int useful_bytes = fread(buffer, 1, lFileSize,
> fpi);
>     if(useful_bytes==NULL)
>           Msg(TEXT("Errorreading to file"));
> 






      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


More information about the XviD-devel mailing list