9 |
* the BFRAME option must be match to core compile option |
* the BFRAME option must be match to core compile option |
10 |
*******************************************************************************/ |
*******************************************************************************/ |
11 |
|
|
12 |
#define BFRAMES |
//#define BFRAMES |
13 |
#include "ex1.h" |
#include "ex1.h" |
14 |
|
|
15 |
int Encode(char *, int, int, char *); |
int Encode(char *, int, int, char *); |
104 |
} |
} |
105 |
|
|
106 |
// get Xvid core status |
// get Xvid core status |
107 |
|
init_param.cpu_flags = 0; |
108 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
109 |
// Check API Version is 2.1? |
// Check API Version is 2.1? |
110 |
if (init_param.api_version != ((2<<16)|(1))) |
if (init_param.api_version != ((2<<16)|(1))) |
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); |
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 |