FILE *fp_in, *fp_out;
int ret, i;
unsigned int width, height;
unsigned int frame_rate, bitrate, gop_num;
unsigned int intraqp, qpmax;
float gamma;
unsigned int num_slices;
unsigned int change_param[2], cur_pic_opt[2];
long size;
unsigned char *p_inbuf;
unsigned char *p_outbuf;
fp_in = fopen("\\Storage Card\\newsvga.yuv","rb");
if (fp_in == NULL) {
RETAILMSG(1,(L"File not found\n"));
return 0;
}
fp_out = fopen("\\Storage Card\\news_vga.264", "wb");
if (fp_out == NULL) {
RETAILMSG(1,(L"Cannot open the output file.\n"));
return 0;
/////////////////////////////////////////////
// Read Video Stream from File //
// (Size of reading is returned //
// by SsbSipMfcDecodeGetInBuf() call) //
/////////////////////////////////////////////
nReadLeng = fread(pStrmBuf, 1, nStrmSize, fp_in);
////////////////////////////////////////////////////////////////
/// 3. Configuring the instance with the config stream ///
/// (SsbSipMfcDecodeExe) ///
////////////////////////////////////////////////////////////////
if (SsbSipMfcDecodeExe(handle, nReadLeng) != SSBSIP_MFC_DEC_RET_OK) {
RETAILMSG(1,(L"MFC Decoder(RING_BUF mode) Configuration Failed.\n"));
return 0;
}
/////////////////////////////////////
/// 4. Get stream information ///
/////////////////////////////////////
SsbSipMfcDecodeGetConfig(handle, MFC_DEC_GETCONF_STREAMINFO, &stream_info);
//////////////////////////////////////////////////
/// Fill the Input Buffer only if required. ///
//////////////////////////////////////////////////
if (nStrmSize > 0) {
RETAILMSG(1,(L"\n *** 1 *** "));
if (feof(fp_in)) {
RETAILMSG(1, (L"\n###############################"));
RETAILMSG(1, (L"\n## END OF FILE ##\n"));
RETAILMSG(1, (L"\n###############################"));
break;
}
RETAILMSG(1,(L"\n *** 2 *** "));
// Read data from file
nReadLeng = fread(pStrmBuf, 1, nStrmSize, fp_in);
RETAILMSG(1,(L"\n *** 3 *** "));
if (nReadLeng == nStrmSize) {
// RETAILMSG(1, (L"\n##################################"));
// RETAILMSG(1, (L"\n# READING ONE UNIT FROM FILE #"));
// RETAILMSG(1, (L"\n##################################\n"));
}
else if (nReadLeng < nStrmSize) {
RETAILMSG(1, (L"\n##########################################"));
RETAILMSG(1, (L"\n## READING THE LAST BLOCK OF FILE ##"));
RETAILMSG(1, (L"\n##########################################"));
}
}
else
nReadLeng = 0;