[svn] / trunk / xvidcore / examples / ex1 / ex1.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/examples/ex1/ex1.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 182, Fri May 24 00:25:00 2002 UTC revision 222, Wed Jun 19 01:00:14 2002 UTC
# Line 1  Line 1 
1  /*******************************************************************************  /*******************************************************************************
2  * This file is a example for how to use the xvid core to compress YUV file  * This file is a example for how to use the xvid core to compress YUV file
3  *  *
4  *  * 0.01b   28.05.2002    chenm001<chenm001@163.com>
5    *                       fix a little bug for encode only codec I frame
6    * 0.01a   27.05.2002    chenm001<chenm001@163.com>
7    *                       fix a little bug for BFRAMES define locate
8  * 0.01    23.05.2002    chenm001<chenm001@163.com>  * 0.01    23.05.2002    chenm001<chenm001@163.com>
9  *                       the BFRAME option must be match to core compile option  *                       the BFRAME option must be match to core compile option
10  *******************************************************************************/  *******************************************************************************/
11    
 #include "ex1.h"  
12  #define BFRAMES  #define BFRAMES
13    #include "ex1.h"
14    
15  int Encode(char *, int, int, char *);  int Encode(char *, int, int, char *);
16  int Decode(char *, int, int, char *);  int Decode(char *, int, int, char *);
# Line 52  Line 55 
55          param->max_quantizer = 31;          param->max_quantizer = 31;
56          param->max_key_interval = 100;          param->max_key_interval = 100;
57    
58    #ifdef BFRAMES
59          param->max_bframes = 0;         // Disable B-frame          param->max_bframes = 0;         // Disable B-frame
60    #endif
61  }  }
62    
63  void set_enc_frame(XVID_ENC_FRAME *frame)  void set_enc_frame(XVID_ENC_FRAME *frame)
# Line 116  Line 121 
121          // Encode Frame          // Encode Frame
122          temp=fread(inBuf, 1, width*height*3/2, fpi);    // Read YUV data          temp=fread(inBuf, 1, width*height*3/2, fpi);    // Read YUV data
123          while(temp == width*height*3/2){          while(temp == width*height*3/2){
124                    //printf("Frames=%d\n",num);
125                  set_enc_frame(&frame);                  set_enc_frame(&frame);
126                  if (!(num%param.max_key_interval))                  if (!(num%param.max_key_interval))
127                          frame.intra = 1;        // Encode as I-frame                          frame.intra = 1;        // Encode as I-frame
# Line 124  Line 130 
130                  xvid_encore(param.handle, XVID_ENC_ENCODE, &frame, &stats);                  xvid_encore(param.handle, XVID_ENC_ENCODE, &frame, &stats);
131                  fwrite(outBuf, 1, frame.length, fpo);                  fwrite(outBuf, 1, frame.length, fpo);
132                  temp=fread(inBuf, 1, width*height*3/2, fpi);    // Read next YUV data                  temp=fread(inBuf, 1, width*height*3/2, fpi);    // Read next YUV data
133                    num++;
134          }          }
135    
136          // Free Encode Core          // Free Encode Core

Legend:
Removed from v.182  
changed lines
  Added in v.222

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4